1, http://mysql-cacti-templates.googlecode.com
下载插件
2,拷贝ss_get_mysql_stats.php到cacti的脚本下:(cacti_path/scripts)
我的路径:/usr/share/cacti/site/scripts/
vi ss_get_mysql_stats.php
将用户名密码什么的改了
3,进入cacti页面:http://ip/cacti
import templates : cacti_host_template_x_db_server_ht_0.8.6i.xml
4, Associated Graph Templates .... 为service添加模板
5,进入mysql,为cacti添加权限
grant process,super on *.* to cacti@cacti_server identified by 'cacti_pass';
grant all on *.* to cacti@cacti_server identified by 'cacti_pass';
eg:
grant process,super on *.* to cacti@127.0.0.1 identified by '000000';
grant all on cacti.* to cacti@localhost identified by '000000';
6,vi cacti_path/include/global.php 改。。。。
注:有可能你取不到数据,我总结的:
A,debug一下,rrd文件是否存在,如果不存在,就看有关cacti的属主和权限,90%的可能是这个原因,10%的我还没遇到。。。
比如:cacti_path /usr/share/cacti --安装路径
/var/lib/cacti --rra(rrd) 文件
/var/log/cacti --各种日志文件,如果你在页面上看日志,发现没有,那就是这的问题
B,如果这样还没有取到数据,那就看你的mysql是否正常
telnet sqlserver_ip 3306 --查看服务是否连接
C,如果你是监控别人的机器没有取到数据,那就查看一下被监控的sqlserver:
netstat -ant | grep 3306 --查看是否只能被自己监控
如果是,vi /etc/mysql/my.cnf
将 bind-address = 127.0.0.1注释掉