yyyll 发表于 2013-8-20 08:48:21

cacti关于MYSQL的监控

关于cacti 的安装配置,见之前的博文,本文接上篇cacti 短信报警http://chengchow.blog./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 -prootWelcome to the MySQL monitor.Commands end with ; or g.Your MySQL connection id is 129Server version: 5.1.62-log Gentoo Linux mysql-5.1.62-r1Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.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 localhostPhpMyadmin下看权限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 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 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 rra
chown cactiuser:cactiuser –R log rra
不过做完以后日志的purge权限没了
10.2日志一堆警告
08/19/2013 11:45:04 PM - CMDPHP: Poller Host Description DS 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 Host Description DS Graphs['MySQLtest01 - MySQL Sorts'] WARNING: Result from CMD not valid. Partial Result: Can't connect to MyS
其实日志已经说得很明白了,不能连接到MYSQL服务器,可惜我还是找了大半天,原来我的/include/config.inc默认密码是cactiuser,而这里设置的是cactipass,修改一样就可以了

狼狼 发表于 2013-8-20 16:07:02

解释就系掩饰,掩饰等于无出色,无出色不如回家休息!!!

xy123321 发表于 2013-8-20 20:01:37

床上运动也可以减肥的,你们都不知道吗?

baiyunjn 发表于 2013-8-21 00:20:23

找不到恐龙,就用蜥蜴顶

xingyu655 发表于 2013-8-21 15:36:22

沙发!沙发!

lxy777 发表于 2013-8-21 23:02:55

所有刻骨铭心的爱都灵魂游离于床上的瞬间!

狂欢‰一夜 发表于 2013-8-22 02:42:09

天塌下来你顶着,我垫着!
页: [1]
查看完整版本: cacti关于MYSQL的监控