[root@localhost ~]# yum install http* mysql* php* -y安装net-snmp-utils软件包
[root@localhost ~]# yum install net-snmp-utils* net-snmp-* net-snmp-libs* lm_sensors* -y安装rrdtool软件包。
[root@localhost ~]# yum install -y pango* [root@localhost ~]# tar zxf rrdtool-1.4.5.tar.gz [root@localhost ~]# cd rrdtool-1.4.5 [root@localhost rrdtool-1.4.5]# ./configure ―prefix=/usr/local && make && make install部署cacti,设置数据库链接。注意补丁放的目录,例如放在/root目录下
[root@localhost ~]# tar zxf cacti-0.8.7g.tar.gz [root@localhost ~]# mv cacti-0.8.7g/ /var/www/html/cacti [root@localhost ~]# cd /var/www/html/cacti [root@localhost cacti]# patch -p1 -N < ~/data_source_deativate.patch [root@localhost cacti]# patch -p1 -N < ~/graph_list_view.patch [root@localhost cacti]# patch -p1 -N < ~/html_output.patch [root@localhost cacti]# patch -p1 -N < ~/ldap_group_authenication.patch [root@localhost cacti]# patch -p1 -N < ~/ldap_group_authenication.patch [root@localhost ~]# patch -p1 -N < ~/script_server_command_line_parse.patch [root@localhost cacti]# patch -p1 -N < ~/ping.patch
[root@localhost cacti]# patch -p1 -N < ~/poller_interval.patch添加一个用于读写检测数据到用户,runct。并调整子目录rra/和log/
[root@localhost cacti]# useradd runct [root@localhost cacti]# chown -R root.root ./ [root@localhost cacti]# chown -R runct.runct rra/ log/建立数据库,表结构。
[root@localhost cacti]# mysql -uroot mysql > CREATE DATABASE cactidb DEFAULT CHARACTER SET utf8; mysql > GRANT all ON cactidb.* TO ‘cactiuser’@’localhost’ IDENTIFIED BY ‘123456’; mysql > quit;调整cacti配置文件。位于源码目录中到include文件夹下到config.php
[root@localhost cacti]# vim include/config.php$database_type = "mysql"; //数据库类型
[root@localhost cacti]# vim /etc/httpd/conf/httpd.confDocumentRoot "/var/www/html/cacti" //cacti源码作为网站根目录
[root@localhost cacti]# service httpd restart在浏览器上访问本地IP进行安装,默认登录用户密码均为admin
[root@localhost ~]# vim /etc/snmp/snmpd.conf找到并修改:
[root@localhost ~]# service snmpd start
window被控端配置
安装好SNMP服务。然后设置SNMP服务,启动并重新启动。
[root@localhost ~]# su - runct [runct@localhost ~]$ php /var/www/html/cacti/poller.php [runct@localhost ~]$crontab -e*/1 * * * * /usr/bin/php /var/www/html/cacti/poller.php &> /dev/null
[runct@localhost ~]$ exit [root@localhost ~]# service crond start等一会就可以看到结果!!
[root@localhost ~]# tar zxf cacti-plugin-0.8.7g-PA-v2.8.tar.gz [root@localhost ~]# mysql -u cactiuser -p cactidb < cacti-plugin-arch/pa.sql [root@localhost ~]# cd /var/www/html/cacti/ [root@localhost cacti]# patch -p1 -N < ~/cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.8.diff安装monitor、thold插件。
[root@localhost cacti]# cd /var/www/html/cacti/plugins [root@localhost plugins]# tar zxf /root/monitor-0.8.2.tar.gz -C /var/www/html/cacti/plugins/ [root@localhost plugins]# tar zxf /root/setting-0.5.tar.gz -C /var/www/html/cacti/plugins/ [root@localhost plugins]# tar zxf /root/thold-0.4.3.tar.gz -C /var/www/html/cacti/plugins/ [root@localhost plugins]# mysql -u cactiuser -p cactidb < monitor/monitor.sql [root@localhost plugins]# mysql -u cactiuser -p cactidb < thold/thold.sql在web界面上Utilities――>System Utilities,页面中的admin,里面将所有插件勾上。
一旦出发阈值,就会发送邮件警报!!
cacti的图形界面友好,而且数据采集统计精细。但报警功能相对与nagios来说较弱,而且轮巡报警时间为5分钟,若要实时则需要安装新插件,这也是和nagios不可比拟的。虽然nagios本身也是依赖插件,但其报警功能强大,因此工作环境上通常是cacti与nagios整合在一起。