标签:
[root@localhost ~]# yum install -y epel-release[root@localhost ~]# [root@localhost ~]# yum install -y httpd php php-mysql mysql mysql-server mysql-devel php-gd libjpeg libjpeg-devel libpng libpng-devel //安装lamp [root@localhost ~]# yum install -y cacti net-snmp net-snmp-utils rrdtool [root@localhost ~]# /etc/init.d/mysqld start [root@localhost ~]# /etc/init.d/httpd start [root@localhost ~]# /etc/init.d/snmpd start [root@localhost ~]# vim /etc/httpd/conf.d/cacti.conf //修改 ... ... Deny from all //change to --> Allow from all [root@localhost ~]# /etc/init.d/httpd restart [root@localhost ~]# mysql -uroot ... ... mysql> create database cacti; mysql> grant all on cacti.* to ‘cacti‘@‘127.0.0.1‘ identified by ‘cacti‘; mysql> quit Bye [root@localhost ~]# mysql -uroot cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql [root@localhost ~]# 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页面执行 [root@cacti ~]# /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 [root@cacti ~]# crontab -e # 让命令每5分钟执行一次 */5 * * * * /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
//点击 Graphs--> Default Tree --> Host Localhost
已经有图有数据了!!
// 在需要被监控的客户端执行 [root@localhost ~]# yum install -y net-snmp [root@localhost ~]# 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 ... [root@localhost ~]# service snmpd start
开始添加被监控主机的信息,填写完毕,点击Create
创建完毕,看是否通信正常,创建完主机,创建要监控的项目点击 Create Graphs for this Host
根据需要,去选择要监控的项目
如果没有出现可被监控的项目,可点击上面的run...再回到这个页面
监控项目添加完毕,将主机添加到监控主干线上,点击左侧Graph Trees
点击Add,添加被监控的主机
类型选择Host,再选择要添加的主机
添加完毕,点击Save
//到Linux界面再配置 [root@cacti ~]# /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 //再将页面刷新
标签:
原文地址:http://www.cnblogs.com/frankielf0921/p/5401235.html