使用cacti监控mysql status

下载包并取出ss_get_mysql_stats.php 文件
wget http://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.7.tar.gz
tar zxvf better-cacti-templates-1.1.7.tar.gz
cd better-cacti-templates-1.1.7/scripts/
cp ss_get_mysql_stats.php /opt/htdocs/www/cacti/scripts/
cd !$
chown www:website ss_get_mysql_stats.php
chmod 0775 ss_get_mysql_stats.php
vi ss_get_mysql_stats.php
修改 ss_get_mysql_stats.php 中mysql配置
$mysql_user = ‘cacti’;
$mysql_pass = ‘cacti’;
$cache_dir = “/opt/htdocs/www/cacti/cache/”;
创建缓存目录
cd ..
mkdir cache
chown www:website cache
chmod 0775 cache
mysql 创建用户cacti
给予process 权限,如果要监控InnoDB状态,还必须有”SUPER”权限
CREATE USER ‘cacti’@’192.168.0.1’ IDENTIFIED BY ‘***’;
GRANT PROCESS ON * . * TO ‘cacti’@’192.168.0.1’ IDENTIFIED BY ‘***’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
在cacti管理界面Import Templates导入
cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.7.xml
添加图表
New Graphs 选择已有Devices在Associated Graph Templates中添加
X MySQL Connections GT
然后点击Create按钮
过几分钟就可以看到图表

发表评论

电子邮件地址不会被公开。 必填项已用*标注