在监控主机上配置cacti
1、下载cacti监控mysql的模板:
mysql-cacti-templates-1.1.2.tar.gz
# tar zxvf mysql-cacti-templates-1.1.2.tar.gz # cd mysql-cacti-templates-1.1.2 # cp ss_get_mysql_stats.php /var/lib/cacti/scripts/
2、修改ss_get_mysql_stats.php 文件:
# cd /var/lib/cacti/scripts/ # vim ss_get_mysql_stats.php 修改30、31、34行: 30 $mysql_user = 'cacti'; 31 $mysql_pass = 'cacti'; 34 $cache_dir = '/var/lib/cacti/cache';
3、设置准备监控的数据库的账户相关信息:
# mkdir /var/lib/cacti/cache # chmod 777 -R /var/lib/cacti/cache # chown -R apache.apache /var/lib/cacti/cache