手把手教你搭建功能强大的监控平台cacti+nagios(源码安装)

上传人:大米 文档编号:569293688 上传时间:2024-07-28 格式:PDF 页数:13 大小:771.49KB
返回 下载 相关 举报
手把手教你搭建功能强大的监控平台cacti+nagios(源码安装)_第1页
第1页 / 共13页
手把手教你搭建功能强大的监控平台cacti+nagios(源码安装)_第2页
第2页 / 共13页
手把手教你搭建功能强大的监控平台cacti+nagios(源码安装)_第3页
第3页 / 共13页
手把手教你搭建功能强大的监控平台cacti+nagios(源码安装)_第4页
第4页 / 共13页
手把手教你搭建功能强大的监控平台cacti+nagios(源码安装)_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《手把手教你搭建功能强大的监控平台cacti+nagios(源码安装)》由会员分享,可在线阅读,更多相关《手把手教你搭建功能强大的监控平台cacti+nagios(源码安装)(13页珍藏版)》请在金锄头文库上搜索。

1、1 / 13源码安装 cacti+nagios 目录索引安装前的准备工作1、操作系统要求2、配置编译环境以及安装一些依赖包3、关闭不需要的服务(以下未列出的一律关闭)可选操作4、下载所需软件包LAMP环境的搭建1、 mysql 的安装2、 apache 的安装3、 php 的安装4、 验证安装CACTI的安装1、安装 rrdtool2、安装 net-snmp3、 解压 cacti 包并做好安装前的配置4、 安装 cacti-spine 5、安装 cactiNagios的安装1、 nagios 的安装2、 编译并安装Nagios 插件2 / 13安装前的准备工作1、操作系统要求CentOS_5.

2、5 或 Red Hat 5.5 (Red Hat 5.5不能使用 yum命令有关如何修改Red Hat 使用 CentOS的更新源请参照以下连接)http:/ install y pango glib pango pango-devel cairo gd gd-devel gcc glibc glibc-common 3、关闭不需要的服务(以下未列出的一律关闭)可选操作atd crond irqbalance microcode_ctl network sendmail sshd syslog 4、下载所需软件包以下连接是我个人上传到rayfile 的源代码包,有兴趣的朋友也可以上各个官方网站

3、去下载(有些版本间存在不兼容的情况)下列版本都已测试过没有问题。mysql-5.0.75.tar .gz http:/ http:/ http:/ http:/ .gz http:/ .gz http:/ / 13nagios-3.2.3.tar .gz http:/ .gz http:/ / 13LAMP环境的搭建1、mysql 的安装#groupadd mysql #useradd -r -g mysql mysql #cd /usr/local #tar zxvf /path/to/ mysql-5.0.75.tar.gz #./configure prefix=/usr/local/m

4、ysql & make & make install #cd mysql #chown -R mysql . #chgrp -R mysql . #bin/mysql_install_db -user=mysql #chown -R root . #chown -R mysql var #cp share/mysql/my-f /etc/f # bin/mysqld_safe -user=mysql & #cp share/mysql/mysql.server /etc/init.d/mysqld #chkconfig add mysqld #chkconfig level 3 mysqld

5、on 2、apache 的安装# tar zxvf httpd-2.2.19.tar.gz #cd httpd-2.2.19 #./configure -prefix=/usr/local/apache -enable-module=so & make & make install # /usr/local/apache/bin/httpd -k start #echo /usr/local/apache/bin/httpd -k start /etc/rc.d/rc.local 编辑 httpd.conf 文件配置对 PHP文件的解析#vi /usr/local/apache/conf/ht

6、tpd.conf 添加、修改以下内容LoadModule php5_module modules/libphp5.so AddType application/x-httpd-php .php DirectoryIndex index.html index.php 3、php 的安装# tar zxvf php-5.2.17.tar .gz #cd php-5.2.17 #./configure -prefix=/usr/local/php -with-apxs2=/usr/local/apache/bin/apxs 5 / 13-with-mysql=/usr/local/mysql -en

7、able-sockets & make & make install # cp php.ini-dist /usr/local/php/lib/php/php.ini #vi /usr/local/php/etc/php.ini 4、验证安装验证 apache跟 php 是否工作正常,创建index.php 文件#vi /usr/local/apache/htdocs/index.php 将以下内容写入到index.php 并保存推出 修改完后启动 apache, 在浏览器中输入http:/ 服务器地址 /index.php 出现下图表示工作正常。验证 php 与 mysql 是否工作正常,把

8、里面的内容改为#vi /var/www/html/index.php 修改完后刷新刚刚的页面出现“OK ”字样表示工作正常。至此 LAMP环境已成功搭建CACTI的安装1、安装 rrdtool #tar zxvf rrdtool-1.4.5.tar.gz & cd rrdtool-1.4.5 #./configure -prefix=/usr/local/rrdtool & make & make install 2、安装 net-snmp #tar zxvf net-snmp-5.6.tar.gz & cd net-snmp-5.6 #./configure -prefix=/usr/loc

9、al/net-snmp -with-mysql=/usr/local/mysql/bin/mysql_config & make & make install #提示信息 # default version of-snmp-version(3):3(在这里版本通常有三种形式:1,2c,3)Systemcontact information(配置该设备的联系信息) : (也可以是邮箱地址)System location ( 该系统设备的地理位置 ):shenzhen P .R.C Location to write logfile (日志文件位置 ):/var/log/snmpd.log Loc

10、ation to Write persistent(数据存储目录 ):/var/net-snmp 7 / 133、解压 cacti 包并做好安装前的配置#tar zxvf cacti-0.8.7g.tar .gz & cd cacti-0.8.7g #mv cacti-0.8.7g /usr/local/apache/htdocs/cacti #useradd cacti #passwd cacti 将 cacti 目录权限赋予 cacti 用户和 cacti 组#chown R cacti:cacti /usr/local/apache/htdocs/cacti #crontab u cac

11、ti e 加入以下内容每隔 1 分钟去 php 代理上的数据(取数据的时间可根据个人需求更改)*/1 * * * * /usr/local/php/bin/php /usr/local/apache/htdocs/cacti/poller.php /dev/null 2&1 创建 cacti 数据库#cd /usr/local/apache/htdocs/cacti #/usr/local/mysql/bin/mysql u root p mysql create database cacti; mysql grant all on cacti.* to cactilocalhost iden

12、tified by cacti; mysql flush privileges; mysqlquit #/usr/local/mysql/bin/mysql -u cacti -p cacti use cacti; mysqlshow tables; 数据库创建完毕编辑 cacti 的配置文件 config.php,global.php设置连接数据库的用户名以及密码8 / 13编辑 cacti 的 config.php 文件找到下列参数#vi /usr/local/apache/htdocs/include/config.php$database_type = mysql; $database

13、_default = cacti; $database_hostname = localhost; $database_username = cactiuser; $database_password = cactiuser; $database_port = 3306; 修改为$database_type = mysql; $database_default = cacti; $database_hostname = localhost; $database_username = cacti; $database_password = cacti; $database_port = 3306

14、; 编辑 cacti 的 global.php文件找到下列参数#vi /usr/local/apache/htdocs/include/global.php$database_type = mysql; $database_default = cacti; $database_hostname = localhost; $database_username = cactiuser; $database_password = cactiuser; $database_port = 3306; 修改为$database_type = mysql; $database_default = cacti

15、; $database_hostname = localhost; $database_username = cacti; $database_password = cacti; $database_port = 3306; 4、安装 cacti-spine #tar zxvf cacti-spine-0.8.7g.tar .gz & cd cacti-spine-0.8.7g #./configure -prefix=/usr/local/cacti-spine -with-mysql=/usr/local/mysql -with-snmp=/usr/local/net-snmp & mak

16、e & make install 5、安装 cacti 在 IE中输入 http:/ 服务器地址 /cacti9 / 13这一步非常重要一定要配置好正确的文件路径cacti 才能正常工作,下图提示配置文件不能正常的找到我们可以在linux 中使用 find 命令来查找相应的文件。#find / -name rrdtool 来查找各个文件然后将正确的路径输入到相应的文本框中10 / 13下图是我在 linux 中查找到的配置文件的路径如果你是按照本文档做的路径应该和我的是一样的,输入正确路径后还是提示NOT FOUND 不用管他直接 Finish 11 / 13初始用户密码都是admin 登录之

17、后点击“ Settings”然后打开“ Paths”检查配置文件是否全部正常找到,下图显示OK: FILE FOUND表示配置文件都已工作正常。等几分钟打开“ graphs”如果有图形,那么恭喜你cacti 已正常工作如果没有请检查 cacti 目录下的 rra 目录下是否有生成 .rra 结尾的文件,如果没有一般是权限问题请详细检查目录权限#ls /usr/local/apache/htdocs/cacti/rra12 / 13Nagios的安装1、nagios 的安装建立一个帐号#/usr/sbin/useradd nagios #passwd nagios 创建一个用户组名为nagcmd

18、用于从 Web 接口执行外部命令。将nagios 用户和apache用户都加到这个组中。/usr/sbin/groupadd nagcmd /usr/sbin/usermod -G nagcmd nagios 编译与安装 Nagios #tar zxvf nagios-3.2.3.tar .gz & cd nagios-3.2.3 #./configure -with-command-group=nagcmd #make all #make install #make install-init #make install-config #make install-commandmode 配置

19、web 接口编辑 httpd.conf 文件#vim /usr/local/apache/conf/httpd.conf 在配置文件的最后边添加一下语句ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin Options ExecCGI AllowOverride None Order allow,deny Allow from all AuthName Nagios Access AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user

20、 Alias /nagios /usr/local/nagios/share Options None AllowOverride None Order allow,deny Allow from all 13 / 13AuthName Nagios Access AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user 创建一个 nagiosadmin的用户用于 Nagios的 WEB接口登录。记下你所设置的登录口令,一会儿你会用到它。#/usr/local/apache/bin/h

21、tpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin 设置密码New password: 重启 Apache服务以使设置生效。#/usr/local/apache/bin/httpd -k restart 2、编译并安装Nagios 插件#tar zxvf nagios-plugins-1.4.15.tar.gz & cd nagios-plugins-1.4.15 #./configure -with-nagios-user=nagios -with-nagios-group=nagios #make #make instal

22、l 把 Nagios加入到服务列表中以使之在系统启动时自动启动#chkconfig -add nagios #chkconfig nagios on 验证 Nagios的样例配置文件#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 如果没有报错,可以启动Nagios服务#service nagios start 打开 IE浏览器输入http:/ 服务器地址 /nagios弹出用户密码界面输入刚刚设置好的用户名nagiosadmin 和密码,回车后出现下图表示nagios 已正常安装。恭喜您已经成功安装了cacti与 nagios 。

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号