cacti添加I/O监控
首先下载snmpdiskio-0.9.6.zip,文件不好找,我已经放在本文章的附件里面。解压snmpdiskio-0.9.6.zip复制partition.xml到cacti/resource/snmp_queries/下面
# cp partition.xml /home/wwwroot/default/cacti/resource/snmp_queries/
分别导入模板文件:
cacti_data_query_snmp_disk_statistics.xml
cacti_graph_template_disk_io_bytessec.xml
http://www.wangjingfeng.com/content/uploadfile/201312/2a8b1387348976.png
http://www.wangjingfeng.com/content/uploadfile/201312/2ce41387348971.png
Cacti has imported the following items:
GPRINT Preset
Normal
Data Input Method
Get SNMP Data (Indexed)
Data Template
Disk - I/O
Graph Template
Disk - I/O (bytes/sec)
在被监控端的/etc/snmp/snmpd.conf结尾添加:
exec .1.3.6.1.4.1.2021.54 hdNum /bin/sh /usr/local/bin/snmpdiskio hdNum
exec .1.3.6.1.4.1.2021.55 hdIndex /bin/sh /usr/local/bin/snmpdiskio hdIndex
exec .1.3.6.1.4.1.2021.56 hdDescr /bin/sh /usr/local/bin/snmpdiskio hdDescr
exec .1.3.6.1.4.1.2021.57 hdInBlocks /bin/sh /usr/local/bin/snmpdiskio hdInBlocks
exec .1.3.6.1.4.1.2021.58 hdOutBlocks /bin/sh /usr/local/bin/snmpdiskio hdOutBlocks
http://www.wangjingfeng.com/content/uploadfile/201312/5b6f1387349146.png
安装snmpdiskio到usr/local/bin下面并且给予执行权限
# install -m 0755 -o root -g root -p -v snmpdiskio /usr/local/bin/
`snmpdiskio’ -> `/usr/local/bin/snmpdiskio’
重启snmpd服务
# service snmpd restart
Stopping snmpd:
Starting snmpd:
查看日志
# pwd
/var/log
# cat messages
如果报错:
Dec 18 14:54:39 node7 snmpd: /etc/snmp/snmpd.conf: line 462: Error: ERROR: This output format has been deprecated - Please use the ’extend’ directive instead
Dec 18 14:54:39 node7 snmpd: /etc/snmp/snmpd.conf: line 463: Error: ERROR: This output format has been deprecated - Please use the ’extend’ directive instead
Dec 18 14:54:39 node7 snmpd: /etc/snmp/snmpd.conf: line 464: Error: ERROR: This output format has been deprecated - Please use the ’extend’ directive instead
Dec 18 14:54:39 node7 snmpd: /etc/snmp/snmpd.conf: line 465: Error: ERROR: This output format has been deprecated - Please use the ’extend’ directive instead
Dec 18 14:54:39 node7 snmpd: /etc/snmp/snmpd.conf: line 466: Error: ERROR: This output format has been deprecated - Please use the ’extend’ directive instead
因为snmp V5版本不支持exec所以要把exec改为extend
extend .1.3.6.1.4.1.2021.54 hdNum /bin/sh /usr/local/bin/snmpdiskio hdNum
extend .1.3.6.1.4.1.2021.55 hdIndex /bin/sh /usr/local/bin/snmpdiskio hdIndex
extend .1.3.6.1.4.1.2021.56 hdDescr /bin/sh /usr/local/bin/snmpdiskio hdDescr
extend .1.3.6.1.4.1.2021.57 hdInBlocks /bin/sh /usr/local/bin/snmpdiskio hdInBlocks
extend .1.3.6.1.4.1.2021.58 hdOutBlocks /bin/sh /usr/local/bin/snmpdiskio hdOutBlocks
测试是否出数据:
# snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.58
UCD-SNMP-MIB::ucdavis.58.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.58.2.1.2.11.104.100.79.117.116.66.108.111.99.107.115 = STRING: "/bin/sh"
UCD-SNMP-MIB::ucdavis.58.2.1.3.11.104.100.79.117.116.66.108.111.99.107.115 = STRING: "/usr/local/bin/snmpdiskio hdOutBlocks"
UCD-SNMP-MIB::ucdavis.58.2.1.4.11.104.100.79.117.116.66.108.111.99.107.115 = ""
UCD-SNMP-MIB::ucdavis.58.2.1.5.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.58.2.1.6.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.58.2.1.7.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.58.2.1.20.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.58.2.1.21.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.58.3.1.1.11.104.100.79.117.116.66.108.111.99.107.115 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.3.1.2.11.104.100.79.117.116.66.108.111.99.107.115 = STRING: "0
完全没有问题,下面就可以在cacti上面添加监控:
http://www.wangjingfeng.com/content/uploadfile/201312/9e251387351090.png
[*] Created graph: 10.1.60.155 - Disk I/O (bytes/sec) - sda
[*] Created graph: 10.1.60.155 - Disk I/O (bytes/sec) - sda1
[*] Created graph: 10.1.60.155 - Disk I/O (bytes/sec) - sda2
http://www.wangjingfeng.com/content/uploadfile/201312/01401387351164.png
snmpdiskio-0.9.6.rar
页:
[1]