Home

zhangyiqun

Thoughts, stories and ideas.

Notes Blog Archives About
02 Aug 2009

cacti监控错误解决

cacti搭建好后不久,收集了一些数据发现所有服务器分区一样,硬盘大小一样。(我以为活见鬼了)

debug出如下信息

/usr/bin/rrdtool create \

/usr/local/cacti/rra/bbs00_hdd_free_151.rrd \

–step 300 \

DS:hdd_free:GAUGE:600:0:U \

DS:hdd_used:GAUGE:600:0:U \

RRA:AVERAGE:0.5:1:600 \

RRA:AVERAGE:0.5:6:700 \

RRA:AVERAGE:0.5:24:775 \

RRA:AVERAGE:0.5:288:797 \

RRA:MAX:0.5:1:600 \

RRA:MAX:0.5:6:700 \

RRA:MAX:0.5:24:775 \

RRA:MAX:0.5:288:797 \

/usr/bin/rrdtool create \

/usr/local/cacti/rra/db00_hdd_free_160.rrd \

–step 300 \

DS:hdd_free:GAUGE:600:0:U \

DS:hdd_used:GAUGE:600:0:U \

RRA:AVERAGE:0.5:1:600 \

RRA:AVERAGE:0.5:6:700 \

RRA:AVERAGE:0.5:24:775 \

RRA:AVERAGE:0.5:288:797 \

RRA:MAX:0.5:1:600 \

RRA:MAX:0.5:6:700 \

RRA:MAX:0.5:24:775 \

RRA:MAX:0.5:288:797 \

可能是使用了错误的模板导致,于是将模板换为ucd/net SNMP host 。此时无法获取硬盘状态信息,错误提示如下

  • Running data query [2].
  • Found type = ‘3’ [snmp query].
  • Found data query XML file at ‘/usr/local/cacti/resource/snmp_queries/net-snmp_disk.xml’
  • XML file parsed ok.
  • Executing SNMP walk for list of indexes @ ‘.1.3.6.1.4.1.2021.9.1.1’
  • No SNMP data returned
  • Found data query XML file at ‘/usr/local/cacti/resource/snmp_queries/net-snmp_disk.xml’
  • Found data query XML file at ‘/usr/local/cacti/resource/snmp_queries/net-snmp_disk.xml’
  • Found data query XML file at ‘/usr/local/cacti/resource/snmp_queries/net-snmp_disk.xml’

怀疑是snmp配置问题,于是手动测试分区 snmpwalk -v 1 -c public 192.168.0.32 dsktable ,执行后无任何反应。看了一些资料,发现此问题需要修改snmp配置文件解决。snmpd.conf(/etc/snmp/snmpd.conf)中加入 disk / (比如我们监视根分区)。

因为我要管理的服务器较多,所以写此脚本快速将分区加入

mount grep sd awk ‘{print “disk “$3}’»/etc/snmp/snmpd.conf && service snmpd restart

后来管理中发现这个命令不是特别严谨于是改成

mount egrep ‘*sd.[0-9]’ awk ‘{print “disk “$3}’»/etc/snmp/snmpd.conf && service snmpd restart

OVER

Notes Blog Archives About