1、监控脚本下载及配置
wget http://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz
tar zxvf better-cacti-templates-1.1.8.tar.gz
cd better-cacti-templates-1.1.8
cp scripts/ss_get_mysql_stats.php /var/www/html/cacti/scripts/
监控mysql只需要用到两个文件:
模板文件:./templates/cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml
插件:./scriptsss_get_mysql_stats.php
修改ss_get_mysql_stats.php 文件:
vim /var/www/html/cacti/scripts/ss_get_mysql_stats.php
配置MySQL服务器,让cacti所在机器能够访问MySQL服务器的状态信息,必须拥有”process”权限。如果要监控InnoDB状态,还必须有”SUPER”权限。
mysql> grant process,super on *.* to 'cactiuser'@'%' identified by 'cactiuser'; mysql> grant all privileges on cacti.* to cactiuser@"%" identified by "cactiuser"; mysql> flush privileges;