一、搭建Cacti
1. 安装epel扩展源:yum install -y epel-release
2. 安装lamp环境:yum install -y httpd php php-mysql mysql mysql-server mysql-devel php-gd libjpeg libjpeg-devel libpng libpng-devel
3. 安装cacti及依赖包:yum install -y cacti net-snmp net-snmp-utils rrdtool
4. 创建cacti日志:mkdir /var/log/cacti ; chmod 777 /var/log/cacti ; touch /usr/share/cacti/log/cacti.log
5. 更改数据存放目录权限:chmod 777 /var/lib/cacti/rra
6. 关联数据库相关操作
导入初始数据到cacti库:mysql cacti </usr/share/doc/cacti-0.8.8h/cacti.sql
7. 启动Apache:sed -i 's/#ServerName www.example.com:80/ServerName www.example.com:80/' /etc/httpd/conf/httpd.conf ; /etc/init.d/httpd start
8. 编辑snmp服务配置文件:vim /etc/snmp/snmpd.conf (红色为更改后)
9. 启动snmp服务:/etc/init.d/snmpd start
10. 编辑cacti配置文件:vim /usr/share/cacti/include/config.php (红色为修改后)
11. 编辑php配置文件,添加时区:vim /etc/php.ini
11. 编辑:vim /etc/httpd/conf/httpd.conf,添加如下规则
<Directory /usr/share/cacti/>
Order Deny,Allow
Allow from all
</Directory>
重启Apache:/etc/init.d/httpd restart
12. 关闭防火墙和SELinux:setenforce 0 ; iptables -F
13. 访问cacti:150.242.59.29/cacti
二、添加 Advance Ping 模块
1. 下载ss_fping.php脚本并放到/usr/share/cacti/scripts目录下:http://forums.cacti.net/download/file.php?id=3435&sid=02ab30ff1e848c79f3e76f04a2396fc1
2. 下载ping模块:http://forums.cacti.net/download/file.php?id=3436&sid=02ab30ff1e848c79f3e76f04a2396fc1
3. 导入ping模块(记得先解压)
4. 添加对一个主机的监控,这里我以北京电信为主
//一般配置完 Advance Ping 模块后5分钟才出图,所以配置完不出图请客官稍等5分钟