Cacti监控MySQL实现过程中碰到的问题解汇总
前言:cacti监控mysql服务器的大概50张graphs都弄出来了,也出图了,当中遇到一些问题,印象比較深刻的记录例如以下:
(一):加入io监控

点击Create Graphs for this Host 进去创建IO的图,结果报错
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.
进入*Turn On Graph Debug Mode模式。报错例如以下:
RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='db-m2-slave-1 - Traffic' \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit='0' \
--vertical-label='bits per second' \
--slope-mode \
--font TITLE:10: \
--font AXIS:7: \
--font LEGEND:8: \
--font UNIT:7: \
CDEF:cdefa='a,8,*' \
AREA:cdefa#00CF00FF:'Inbound' \
GPRINT:cdefa:LAST:' Current\:%8.2lf %s' \
GPRINT:cdefa:AVERAGE:'Average\:%8.2lf %s' \
GPRINT:cdefa:MAX:'Maximum\:%8.2lf %s\n' \
LINE1:cdefa#002A97FF:'Outbound' \
GPRINT:cdefa:LAST:'Current\:%8.2lf %s' \
GPRINT:cdefa:AVERAGE:'Average\:%8.2lf %s' \
GPRINT:cdefa:MAX:'Maximum\:%8.2lf %s\n'
RRDTool Says:
ERROR: invalid rpn expression in: a,8,*,例如以下图所看到的

编辑linux主机下的/etc/snmp/snmpd.conf文件
找到:com2sec notConfigUser default public
改动成:com2sec notConfigUser all public
找到:access notConfigGroup "" any noauth exact systemview none none
改动成:access notConfigGroup "" any noauth exact all none none
找到:#view all included .1 80把该行的#去掉,
找到:#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc 把改行的#去掉,
重起snmpd:/etc/init.d/snmpd restart
(二):MySQL加入主机出不来图
[root@squid-2 test]# service httpd restart
停止 httpd: [确定]
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[确定]
1) 进入配置文件文件夹
cd /etc/httpd/conf/
2)编辑httpd.conf文件。搜索"#ServerName",加入ServerName localhost:80
[root@server conf]# ls
extra httpd.conf magic mime.types original
[root@server conf]# vi httpd.conf
#ServerName www.example.com:80
ServerName localhost:80
3)再又一次启动apache 就可以。
(三):启动报错
[root@squid-2 error]# tail -f /var/log/httpd/error_log
[Sat May 31 22:49:02 2014] [notice] caught SIGTERM, shutting down
[Sat May 31 22:49:02 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Sat May 31 22:49:02 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat May 31 22:49:02 2014] [notice] Digest: generating secret for digest authentication ...
[Sat May 31 22:49:02 2014] [notice] Digest: done
[Sat May 31 22:49:02 2014] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
解决方法:直接关闭SELinux以及防火墙
(四):MySQL监控项出图报错
[Sat May 31 23:20:10 2014] [error] [client 192.168.171.71] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /var/www/html/cacti/lib/adodb/adodb.inc.php on line 833
须要导入cacti.sql文件
mysql -u root -p cacti < /var/www/html/cacti/cacti.sql
(五):SNMP – Interface Statistics报错
创建SNMP – Interface Statistics报错,例如以下:
Created graph: db-m2-slave-2 - Traffic - |query_ifName|
ERROR: no Data Source associated. Check Template
[root@squid-2 html]# snmpwalk -c public -v 2c 10.254.3.73 ifHCInOctets
IF-MIB::ifHCInOctets = No more variables left in this MIB View (It is past the end of the MIB tree)
[root@squid-2 html]#
[root@squid-2 html]# snmpwalk -c public -v 2c 10.254.3.73 if
IF-MIB::ifTable = No Such Object available on this agent at this OID
于是再次改动snmpd.conf,并重新启动snmpd
access notConfigGroup "" any noauth exact systemview none none-->
access notConfigGroup "" any noauth exact all none none
[root@db-m2-slave-2 ~]# service snmpd restart
停止 snmpd: [确定]
正在启动 snmpd: [确定]
[root@db-m2-slave-2 ~]#
[root@squid-2 html]# snmpwalk -c public -v 2c 10.254.3.73 if
IF-MIB::ifTable = No more variables left in this MIB View (It is past the end of the MIB tree)
【】解决
在snmpd.conf配置文件中面,查找下面字段:[/color]
## incl/excl subtree mask
#view all included .1 80
将该行前面的"#"去掉.
之后重新启动snmpd服务解决。
报错(六):
移除出错的图


进去Consoleà Graph Management àHost(选择出错的主机地址)—>Search(搜索报错的keywordUsed Space)。就会找到报错不出错的Graph Title栏目,勾选右側的全选框,点击Gobutton删除掉这些无效的图就可以。例如以下图所看到的:

然后在新出来的提示界面,点击Continuebutton。删除。

(七):Memory Free值为nan

分析:memery free 无数据,原因: rrdtool 的内存上限为10G。
[root@squid-2 local]# find / -name *mem*.rrd
/var/www/html/cacti/rra/db-m2-slave-1_mem_buffers_189.rrd
/var/www/html/cacti/rra/db-master-2_mem_free_156.rrd
/var/www/html/cacti/rra/db-m2-slave-1_lock_system_memory_20.rrd
/var/www/html/cacti/rra/db-m2-slave-2_total_mem_alloc_74.rrd
/var/www/html/cacti/rra/db-m2-slave-1_total_mem_alloc_23.rrd
/var/www/html/cacti/rra/db-m2-slave-2_lock_system_memory_71.rrd
/var/www/html/cacti/rra/localhost_mem_swap_4.rrd
/var/www/html/cacti/rra/db-master-2_total_mem_alloc_117.rrd
/var/www/html/cacti/rra/db-master-2_mem_cache_155.rrd
/var/www/html/cacti/rra/db-master-2_mem_buffers_154.rrd
/var/www/html/cacti/rra/db-m2-slave-1_mem_free_191.rrd
/var/www/html/cacti/rra/localhost_mem_buffers_3.rrd
/var/www/html/cacti/rra/db-m2-slave-2_mem_free_164.rrd
/var/www/html/cacti/rra/db-m2-slave-2_mem_buffers_162.rrd
/var/www/html/cacti/rra/db-m2-slave-1_mem_buffers_54.rrd
/var/www/html/cacti/rra/db-m2-slave-1_mem_swap_55.rrd
/var/www/html/cacti/rra/db-master-2_lock_system_memory_114.rrd
/var/www/html/cacti/rra/db-m2-slave-2_mem_cache_163.rrd
/var/www/html/cacti/rra/db-m2-slave-1_mem_cache_190.rrd
/var/www/html/cacti/rra/db-master-2_mem_free_146.rrd
[root@squid-2 local]#
[root@squid-2 local]# rrdtool info /var/www/html/cacti/rra/db-m2-slave-1_mem_free_191.rrd |grep mem_free
filename = "/var/www/html/cacti/rra/db-m2-slave-1_mem_free_191.rrd"
ds[mem_free].type = "GAUGE"
ds[mem_free].minimal_heartbeat = 120
ds[mem_free].min = 0.0000000000e+00
ds[mem_free].max = 1.0000000000e+07
ds[mem_free].last_ds = "34166500"
ds[mem_free].value = NaN
ds[mem_free].unknown_sec = 2
[root@squid-2 local]#
注:ds[mem_free].max = 1.0000000000e+07 数据的最大值设置为10G
查看rrdtool怎样进行改动。运行—help查看:
[root@squid-2 local]# rrdtool --help
RRDtool 1.3.8 Copyright 1997-2009 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Aug 21 2010 10:57:18
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, graphv, dump, restore,
last, lastupdate, first, info, fetch, tune,
resize, xport
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
[root@squid-2 local]#
採用tune命令參数进行改动:
[root@squid-2 rra]# rrdtool tune *_mem_free_*.rrd mem_free:100000000
DS[mem_free] typ: GAUGE hbt: 120 min: 0.0000 max: 10000000.0000
[root@squid-2 rra]#
有提示信息,表名tune失败,原来少了个-a參数。又一次改动例如以下:
[root@squid-2 rra]# rrdtool tune *_mem_cache_*.rrd -a mem_cache:3000000000
[root@squid-2 rra]# rrdtool tune *_mem_free_*.rrd -a mem_free:3000000000
[root@squid-2 rra]# rrdtool tune *_mem_buffers_*.rrd -a mem_buffers:3000000000
[root@squid-2 rra]#
这里发现rrdtool运行之后。仅仅有一个host主机的的nan变成数字。其它主机的都没有变, 之所以如此是由于rrdtool tune * -a …命令仅仅有一个.rrd文件起作用。其余的须要自己手动再一次次运行rrdtool tune命令。
为了简化操作。特意写了一个ssh脚本例如以下:
vim /root/rrdtool_increate_mem.sh
cd /var/www/html/cacti/rra
ls *_mem_free_*.rrd -1 >a_mem_free.txt
for i in `cat a_mem_free.txt`
do
rrdtool tune $i -a mem_free:300000000;
done; ls *_mem_cache_*.rrd -1 >a_mem_cache.txt
for i in `cat a_mem_cache.txt`
do
rrdtool tune $i -a mem_cache:300000000;
done; ls *_mem_buffers_*.rrd -1 >a_mem_buffers.txt
for i in `cat a_mem_buffers.txt`
do
rrdtool tune $i -a mem_buffers:300000000;
done;
直接sh /root/rrdtool_increate_mem.sh就可以。
【补充】
调试cacti的graph,过程例如以下:
(1) Console ,再进入Graph Manager ,再进入,选择对于的Host,搜索Memory,选中你要的图,点击链接。比方我这里是Memory Usage,例如以下图所看到的:

(2) 再 点击Memory Usage链接进去,点击右上角的Debug模式:

(3) 就会看到例如以下的debug界面。能够慢慢来观察RRDTool Command命令,为何是-nan值。

(八):双网卡 Traffic 网卡流量问题
例如以下图。em1和em2所有指向一个ip地址,仅仅是em1不生效。em2生效了,可是ip地址在em1上,没有显示在em2一栏。

所以,在graph图上,就没有数据。全为-nan-值,例如以下所看到的:

在cacti服务器上面运行check:
[root@squid-2 rra]# snmpwalk -v 2c -c public 10.254.3.72 IF-MIB::ifDescr
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: em1
IF-MIB::ifDescr.3 = STRING: em2
IF-MIB::ifDescr.4 = STRING: em3
IF-MIB::ifDescr.5 = STRING: em4
[root@squid-2 rra]#
确实有4个网卡信息记录。这些都没事,正常。经过细致排查发现主要原因在下拉选框里面要选择Interface – Traffic (bits/sec),不要选择Interface – Traffic (bytes/sec),例如以下图所看到的:

当选择了Interface – Traffic (bits/sec)之后graph就会出数据,有效果图了。

(九):InnoDB Active/Locked Transactions
RRDTool Says:
ERROR: opening '/var/www/html/cacti/rra/db-m1-slave-1_locked_transactions_215.rrd': No such file or directory
原因是mysql服务器上的让cacti訪问的mysql数据库账号没有创建。创建mysql账号好,问题解决。
(十):Tomcat - Connection Rate
RRDTool Says:
ERROR: invalid y-grid format
依次进入Console -->Graph templates->Tomcat - Connection Rate->Unit Grid Value (--unit/--y-grid)
默认的值为1 改成为0就可以。
Cacti监控MySQL实现过程中碰到的问题解汇总的更多相关文章
- mysql使用过程中碰到的问题
start job failed to start mysql ubuntu 原因时我将var整个目录的组权限设置为www-data了, 试了网上的办法都不行(有个妥协方法是重新安装, 但很不好), ...
- Cacti监控mysql数据库服务器实现过程
Cacti监控mysql数据库服务器实现过程 2014-05-29 0个评论 来源:Cacti监控mysql数据库服务器实现过程 收藏 我要投稿 1 先在cacti服务器端安 ...
- cacti监控mysql
cacti监控mysql 2013-09-25 16:21:43 分类: LINUX 原文地址:cacti监控mysql 作者:baochenggood cacti监控mysql 1 下载cacti监 ...
- mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决
mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决 最近新装好的my ...
- mysql 安装过程中的错误:my-template.ini could not be processed and written to XXX\my.ini.Error code-1
安装mysql的过程中,在最后配置mysql时,提示错误:Configuration file tmeplate E:\编程\MySQL\my-template.ini could not be pr ...
- RVM的安装和使用过程中碰到的问题
Ruby Version Manager简称RVM,是一款非常好用的ruby版本管理以及安装工具. 关于rvm的安装,可以参考以下文章: use rvm install and manage ruby ...
- Mysql安装过程中出现apply security settings错误的解决方法
在学习Mysql的过程中,首先要安装Mysql.然而在第一遍安装过程中难免会出现安装错误的时候,当卸载后第二次安装(或者第三次甚至更多次)的时候,往往在安装最后一步会出现apply security ...
- MySQL安装过程中对The error code is 2203的解决方案
MySQL安装过程中对The error code is 2203的解决方案 1.问题描述 Windows系统安装MySQL遇到The error code is 2203.,具体描述如下 The i ...
- 【RAC】 RAC For W2K8R2 安装--安装过程中碰到的问题(九)
[RAC] RAC For W2K8R2 安装--安装过程中碰到的问题(九) 一.1 BLOG文档结构图 一.2 前言部分 一.2.1 导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也 ...
随机推荐
- SD 一轮集训 day4 圣城鼠
非常强的构造题. 很显然的是我们要构造一个类似菊花图的东西,因为这样的话两点之间路径的点数会非常少,很容易满足第二个条件. 但是因为直接菊花图的话会不满足第一个条件,,,所以我们可以构造一个类菊花图. ...
- 【Java】【高精度】【递推】UVA - 11375 - Matches
d[i+c[j]]+=d[i](c[j]是拼成j所需的火柴数) d[0]=1: 别忘了不能有前导零,所以当i为零时,不要尝试去拼成零.反而应该在n>=6时,最后给答案加1(单独拼出0). imp ...
- 【线段树+离散化】POJ2528-Mayor's posters
[题目大意] 在墙上贴海报,问最后能看到几张海报? [注意点] 1.首先要注意这是段线段树,而非点线段树.读题的时候注意观察图.来看discuss区下面这组数据: 3 5 6 4 5 6 8 上面数据 ...
- Linux关于终端的基本概念汇总(tty/pty)(转)
在Linux系统的设备特殊文件目录/dev/下,终端特殊设备文件一般有以下几种: 1.串行端口终端(/dev/ttySn) 串行端口终端(Serial Port Terminal)是使用计算机串行端口 ...
- WPF的UI虚拟化
许多时候,我们的界面上会呈现大量的数据,如包含数千条记录的表格或包含数百张照片的相册.由于呈现UI是一件开销比较大的动作,一次性呈现数百张照片就目前的电脑性能来说是需要占用大量内存和时间的.因此需要对 ...
- 【mybatis】mybatis自定义动态字段查询,mybatis实现动态字段查询,如果某个条件为null,则不查询某个字段,否则就查询某个字段
mybatis实现动态字段查询,如果某个条件为null,则不查询某个字段,否则就查询某个字段 先看一下 怎么实现动态的自定义字段查询: 例如: 而field 就是数据表中的某一个字段 String f ...
- 【spring boot】spring boot @ConditionalOnxxx相关注解总结
参考地址:https://blog.csdn.net/win7system/article/details/54377471 使用场景:在自动解析封装配置文件中的配置完成自动注入spring的时候 例 ...
- 突破,Objective-C开发速学手册
<突破,Objective-C开发速学手册> 基本信息 作者: 傅志辉 出版社:电子工业出版社 ISBN:9787121207426 上架时间:2013-7-12 出版日期:2013 年8 ...
- iview2.x版本升级3.x版本icon修改清单
当前公司使用有一个旧项目的前端组件库是iview2.x,入职以来维护该项目过程中碰到2.x版本无数的坑. 最近需求不多,闲来无事把2.x升级到3.x版本了. 新版本除了网上轻易可查到的button组件 ...
- word-wrap,word-break,white-space,text-overflow的区别和用法
在div中,文本布局经常出现,换行混乱的情况. 问题表现:1.如果是全英文字符串,中间不包含任何符号(包括空格),不自动换行. 2.中英文混写,则在英文字符串的开始处换行(英文长 ...