目前最好用的监控mysql InnoDB 数据库的方法之一
http://code.google.com/p/mysql-cacti-templates/
wget http://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.7.tar.gz

tar -xzf better-cacti-templates-1.1.7.tar.gz -C /usr/local/src
cd /usr/local/src/better-cacti-templates-1.1.7
cp scripts/ss_get_mysql_stats.php /usr/local/www/html/cacti/scripts

cd /usr/local/www/html/cacti/scripts
vim ss_get_mysql_stats.php
$mysql_user = 'cacti';
$mysql_pass = 'cacti';
$mysql_port = 3306;

设置准备监控的数据库的账户相关信息
创建监控Mysql需要的账户以及权限
配置MySQL服务器,让cacti所在机器能够访问MySQL服务器的状态信息,必须拥有”process”权限。如果要监控InnoDB状态,还必须有”SUPER”权限。
grant process,super on *.* to 'cacti'@'%' identified by 'cacti';
flush privileges;
帐号测试:
cd /usr/local/www/html/cacti/scripts
php -q ./ss_get_mysql_stats.php –host 10.88.1.134 –items cv,cx,cy,cz –user cacti –pass cacti –port 3306

模板导入(Import Templates)
在cacti管理界面导入模板cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.7.xml。
Now import the template files through your web browser. In the Cacti web interface's Console tab, click on the Import Templates  link in the left sidebar. Browse to the directory containing the unpacked templates, select the XML file for the templates you're installing, and submit the form. In our example, the file will be named something like cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.7.xml.
Data Input Method
[success] X Get MySQL Stats/MyISAM Indexes IM [update]
Data Template
[success] X MyISAM Indexes DT [update]
Graph Template
[success] X InnoDB Buffer Pool GT [update]
Host Template
[success] X MySQL Server HT [update]

添加设备
创建Graph。在Console选项卡下的左侧菜单栏中选择Devices,为要监控的主机新建一个Devices或选择已有Devices。在 Associated Graph Templates中添加想要监控MySQL状态的Graph Templates(如X MySQL Connections GT模板)。并点击最上面的Create Graphs for this Host链接,在Graph Templates的选择框中选择X MySQL Connections GT,然后点击Create按钮。然后Create Graphs for this Host。

参考:
http://faemalia.net/mysqlUtils/

http://forums.cacti.net/about6108.html

原创文章,转载请注明: 转载自素食勤俭敬老孝慈

本文链接地址: cacti监控(monitor)mysql InnoDB 数据库

文章的脚注信息由WordPress的wp-posturl插件自动生成

Tags: ,

876 views

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">