Cacti-监控MySQL
时间:2015-05-11 03:35 来源:linux.it.net.cn 作者:IT
Cacti的安装及配置请看:Cacti–安装及简单监控
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

2、创建监控Mysql需要的账户以及权限
配置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;
3、导入模板
将模板cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml从linux下到本地电脑,登陆web导入:

4、添加mysql监控
在Console选项卡下的左侧菜单栏中选择Devices,选择一个Device或新建一个Device,在Associated Graph Templates中添加要监控的mysql状态:

在Create Graphs for this Host中选中刚才添加的模板,在点击下方create创建图像:

5、最后在左上角的graphs选项卡,查看设备图像,就可以查看到监控的mysql图像:

(责任编辑:IT)
Cacti的安装及配置请看:Cacti–安装及简单监控 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只需要用到两个文件: 修改ss_get_mysql_stats.php 文件: vim /var/www/html/cacti/scripts/ss_get_mysql_stats.php
2、创建监控Mysql需要的账户以及权限 mysql> grant process,super on *.* to 'cactiuser'@'%' identified by 'cactiuser'; mysql> grant all privileges on cacti.* to cactiuser@"%" identified by "cactiuser"; mysql> flush privileges;
3、导入模板
4、添加mysql监控
在Create Graphs for this Host中选中刚才添加的模板,在点击下方create创建图像:
5、最后在左上角的graphs选项卡,查看设备图像,就可以查看到监控的mysql图像: (责任编辑:IT) |