您的位置:首页 > 数据库 > SQL

cacti关于MYSQL的监控

2013-08-19 17:34 225 查看
Cacti监控MYSQL---cacti下mysql插件的安装关于cacti 的安装配置,见之前的博文,本文接上篇cacti 短信报警http://chengchow.blog.51cto.com/1642666/12133671.下载插件到/downloads目录插件见附件2.解压缩Cd /downloadsTar xvf mysql-cacti-templates-1.1.2.tar3.拷贝mysql插件到scripts目录Cd /var/www/localhost/htdocs/cacti/Cp /downloads/mysql-cacti-templates-1.1.2/ss_get_mysql_stats.phpscripts/.4.修改ss_get_mysql_stats.phpVi ss_get_mysql_stats.php
$mysql_user = 'cactiuser';$mysql_pass = 'cactipass';……$cache_dir= '/var/www/localhost/htdocs/cacti/cache';
5.创建cach_dir目录,并赋予最大权限Mkdir cacheChmod 777 –R cacheChown –R cactiuser:cactiuser cache6.赋予cactiuser对数据库的数据采集权限
mysql -uroot -proot
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 129
Server version: 5.1.62-log Gentoo Linux mysql-5.1.62-r1
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> grant process, super, replication client on *.* to 'cactiuser'@'localhost' identified by 'cactipass';
Query OK, 0 rows affected (0.00 sec)
mysql> grant process, super, replication client on *.* to 'cactiuser'@'%' identified by 'cactipass';
Query OK, 0 rows affected (0.00 sec)
mysql> \q
测试:
Mysql –ucactiuser –pcactipass –h localhost
PhpMyadmin下看权限



7.打开IE访问Cacti 网址http://localhost/cacti8.导入mysql监控模板Consoleàimport templatesà浏览, 选择刚才解压文件中的cacti_host_template_x_db_server_ht_0.8.6i.xml,点击import导入

Consoleàgraph templates,我们会看到如下图选项,导入成功。

9.添加一台有Mysql 服务的主机测试,主机需要安装net-snmp服务,添加方法Console à devices àadd 出现如下界面,添加方法和普通主机一样,唯一的区别是Host Template中选择X DB Server HT(不选也行以后再添加,MYSQL监控表格比较多,以后添加比较麻烦),

然后将这台刚才添加的主机添加到graph tree里面,这样我们就可以去看监控图片了时间比较短,只能贴张1小时的图片

10.遇到问题10.1 日志报错
08/19/2013 11:55:05 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"insert into poller_output (local_data_id, rrd_name, time, output) values (7, 'proc', '2013-08-19 23:55:04', '88')'
08/19/2013 11:55:04 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"insert into poller_output (local_data_id, rrd_name, time, output) values (6, 'users', '2013-08-19 23:55:04', '1')'
解决方法:chmod 755 –R log rrachown cactiuser:cactiuser –R log rra不过做完以后日志的purge权限没了10.2日志一堆警告
08/19/2013 11:45:04 PM - CMDPHP: Poller[0] Host[34] Description[MySQLtest01] DS[376] Graphs['MySQLtest01 - InnoDB Buffer Pool Activity'] WARNING: Result from CMD not valid. Partial Result: Can't connect to MyS
08/19/2013 11:45:04 PM - CMDPHP: Poller[0] Host[34] Description[MySQLtest01] DS[381] Graphs['MySQLtest01 - MySQL Sorts'] WARNING: Result from CMD not valid. Partial Result: Can't connect to MyS
其实日志已经说得很明白了,不能连接到MYSQL服务器,可惜我还是找了大半天,原来我的/include/config.inc默认密码是cactiuser,而这里设置的是cactipass,修改一样就可以了

附件:http://down.51cto.com/data/2363358
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql 监控 cacti gentoo