[[email protected] ~]# yum install -y epel-release[[email protected] ~]# [[email protected] ~]# yum install -y httpd php php-mysql mysql mysql-server mysql-devel php-gd libjpeg libjpeg-devel libpng libpng-devel //安装lamp [[email protected] ~]# yum install -y cacti net-snmp net-snmp-utils rrdtool [[email protected] ~]# /etc/init.d/mysqld start [[email protected] ~]# /etc/init.d/httpd start [[email protected] ~]# /etc/init.d/snmpd start [[email protected] ~]# vim /etc/httpd/conf.d/cacti.conf //修改 ... ... Deny from all //change to --> Allow from all [[email protected] ~]# /etc/init.d/httpd restart [[email protected] ~]# mysql -uroot ... ... mysql> create database cacti; mysql> grant all on cacti.* to ‘cacti‘@‘127.0.0.1‘ identified by ‘cacti‘; mysql> quit Bye [[email protected] ~]# mysql -uroot cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql [[email protected] ~]# vim /usr/share/cacti/include/config.php //according to the following to change $database_type = "mysql"; $database_default = "cacti"; $database_name = "cacti"; $database_hostname = "127.0.0.1"; $database_username = "cacti"; $database_password = "cacti"; $database_port = "3306"; $database_ssl = false;
web访问cacti并安装
//http://ip/cacti/ --> next --> next --> Finish
//回到Linux页面执行 [[email protected] ~]# /usr/bin/php /usr/share/cacti/poller.php OK u:0.00 s:0.00 r:0.00 OK u:0.00 s:0.00 r:0.01 OK u:0.00 s:0.00 r:0.03 OK u:0.00 s:0.00 r:0.05 OK u:0.00 s:0.00 r:0.08 06/13/2015 09:59:49 PM - SYSTEM STATS: Time:0.1974 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5 [[email protected] ~]# crontab -e # 让命令每5分钟执行一次 */5 * * * * /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
//点击 Graphs--> Default Tree --> Host Localhost 已经有图有数据了!!
// 在需要被监控的客户端执行 [[email protected] ~]# yum install -y net-snmp [[email protected] ~]# vim /etc/snmp/snmpd.conf //ADD //syslocation --> 本机ip syscontact --> 管理员邮箱 ... ... #syslocation Unknown (edit /etc/snmp/snmpd.conf) syslocation 192.168.1.118 syscontact Root 1212@1212.com ... [[email protected] ~]# service snmpd start
开始添加被监控主机的信息,填写完毕,点击Create
创建完毕,看是否通信正常,创建完主机,创建要监控的项目点击 Create Graphs for this Host
根据需要,去选择要监控的项目
如果没有出现可被监控的项目,可点击上面的run...再回到这个页面
监控项目添加完毕,将主机添加到监控主干线上,点击左侧Graph Trees
点击Add,添加被监控的主机
类型选择Host,再选择要添加的主机
添加完毕,点击Save
//到Linux界面再配置 [[email protected] ~]# /usr/bin/php /usr/share/cacti/poller.php --force OK u:0.00 s:0.00 r:0.00 OK u:0.00 s:0.00 r:0.01 OK u:0.00 s:0.00 r:0.03 OK u:0.00 s:0.00 r:0.05 OK u:0.00 s:0.00 r:0.08 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.09 OK u:0.00 s:0.00 r:0.10 //再将页面刷新
时间: 2024-10-25 18:06:25