操作介绍如下:
http://foreveryan.blog.51cto.com/3508502/775558
安装如下:
英文地址:http://www.cyberciti.biz/faq/fedora-rhel-install-cacti-monitoring-rrd-software/
1:安装关联软件
yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd
yum源更换:http://www.cnblogs.com/tommyli/p/3179753.html
yum源的epel:https://fedoraproject.org/wiki/EPEL/zh-cn
yum命令:http://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/
2:配置mysql
mysqladmin -u root password NEWPASSWORD
如何更改mysql的root密码:http://www.cyberciti.biz/faq/mysql-change-root-password/
3:创建cacti数据库
mysql -u root -p -e 'create database cacti'
创建账户{u:cacti p:zYn95ph43zYtq}
mysql -u root -p GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'zYn95ph43zYtq'; FLUSH privileges; q
4:安装snmpd
yum install net-snmp-utils php-snmp net-snmp-libs
修改snmpd的配置
vi /etc/snmp/snmpd.conf
添加如下选项
com2sec local localhost public group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local view all included .1 80 access MyRWGroup "" any noauth exact all all none syslocation Unknown (edit /etc/snmp/snmpd.conf) syscontact Root (configure /etc/snmp/snmp.local.conf) pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
开启snmpd服务
/etc/init.d/snmpd start
chkconfig snmpd on
确认下服务运行
snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
可能的输出
IP-MIB::ipAdEntIfIndex.10.10.29.68 = INTEGER: 2 IP-MIB::ipAdEntIfIndex.67.yy.zz.eee = INTEGER: 3 IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
5:安装cactl{yum要epel支持,见小节1,否则找不到这个安装包}
yum install cacti
初始化cactl数据库
rpm -ql cacti | grep cacti.sql
可能的输出
/usr/share/doc/cacti-0.8.7d/cacti.sql
初始化(版本可能和我的不一样)
mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.7d/cacti.sql
修改cacti数据库配置
vi /etc/cacti/db.php
替换
$database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "zYn95ph43zYtq"; $database_port = "3306";
修改httpd的配置
vi /etc/httpd/conf.d/cacti.conf
替换
Alias /cacti /usr/share/cacti <Directory /usr/share/cacti/> Order Deny,Allow Deny from all Allow from 10.0.0.0/8 </Directory>
启动httpd服务
service httpd restart
创建cacti cronjob
vi /etc/cron.d/cacti
去掉第一行的注释
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
浏览cacti
http://your.server.ip.address/cacti/
第一次强制修改密码的,初始账号和密码都是admin
6:如何创建snmp数据采集源
1:点击Devices 2:选择Localhost 3:选定SNMP(下面可选snmp的版本)
4:save
7:如何创建snmp图
1:Click on "Create Graphs for this Host" link on top right side. 2:Select SNMP - Interface Statistics 3:Select a graph type (such as In/Out bytes with total bandwidth) 4:Finally, click on Create button.
8:模版地址
http://www.percona.com/downloads/percona-monitoring-plugins/1.0.3/