cacti  监控主机安装

[root@localhost ~]# yum install -y epel-release ; yum install -y httpd php php-mysql mysql mysql-server mysql-devel php-gd libjpeg libjpeg-devel libpng libpng-devel ; yum install -y cacti net-snmp net-snmp-utils rrdtool

[root@localhost ~]# vi /etc/httpd/conf.d/cacti.conf

大概22行的位置,把"Deny from all" 改为  "Allow from all"

[root@localhost ~]# /etc/init.d/mysqld restart ; /etc/init.d/httpd restart ; /etc/init.d/snmpd restart

[root@localhost ~]# mysql -uroot  -e "create database cacti" ; mysql -uroot -e "grant all on cacti.* to 'cacti'@'127.0.0.1' identified by 'cacti';" ; mysql -uroot cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql

[root@localhost ~]# vi /usr/share/cacti/include/config.php

# 大概26-32行,修改内容如下

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "127.0.0.1";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

$database_ssl = false;


web操作,访问http://192.168.10.29/cacti/,点两下“next”和一次”Finish“ 即可。输入默认用户名admin密码admin 登录,第一次登陆必须重新设置新的密码


[root@localhost ~]# vi /etc/php.ini

date.timezone = 'Asia/Chongqing'

[root@localhost ~]# /usr/bin/php /usr/share/cacti/poller.php

[root@localhost ~]# crontab -e

*/5 * * * *  /usr/bin/php /usr/share/cacti/poller.php


cacti  添加客户端(被监控主机)

[root@localhost ~]# yum install -y net-snmp

[root@localhost ~]# vi /etc/snmp/snmpd.conf

syslocation Unknown (edit /etc/snmp/snmpd.conf)

syscontact Root (configure /etc/snmp/snmp.local.conf)

# 修改为

syslocation 10.39

syscontact Root [email protected]

# 另还有两处需要修改

access notConfigGroup "" any noauth exact all none none

view all included .1 80

[root@localhost ~]# /etc/init.d/snmpd start


到cacti主机用 web登陆cacti后台,看图操作

图一、

cacti 监控_第1张图片


图二、

cacti 监控_第2张图片

图三、

cacti 监控_第3张图片

图四、

cacti 监控_第4张图片

图五、

cacti 监控_第5张图片

图六、

cacti 监控_第6张图片

图七、

cacti 监控_第7张图片

图八、

cacti 监控_第8张图片


到监控主机上使用命令强制刷新

[root@localhost ~]# /usr/bin/php /usr/share/cacti/poller.php --force


至此监控搭建完毕