09/29/13

cacti利用snmpdiskio监控服务器磁盘

1.把snmpdiskio文件上传到被监控服务器的/usr/local/bin目录下;
2.把解压之后文件夹下的 partition.xml上传到cacti监控服务器的/xxx/cacti/resource/snmp_queries/目录下。
3、导入2个模板:
cacti_graph_template_disk_io_bytessec.xml
cacti_data_query_snmp_disk_statistics.xml
4、修改snmp配置文件/etc/snmp/snmpd.conf
#———————————————————————————-

extend .1.3.6.1.4.1.2021.81 hdNum /bin/sh /usr/local/bin/snmpdiskio hdNum
extend .1.3.6.1.4.1.2021.82 hdIndex /bin/sh /usr/local/bin/snmpdiskio hdIndex
extend .1.3.6.1.4.1.2021.83 hdDescr /bin/sh /usr/local/bin/snmpdiskio hdDescr
extend .1.3.6.1.4.1.2021.84 hdInBlocks /bin/sh /usr/local/bin/snmpdiskio hdInBlocks
extend .1.3.6.1.4.1.2021.85 hdOutBlocks /bin/sh /usr/local/bin/snmpdiskio hdOutBlocks

#———————————————————————————-
5、重启snmpd服务
/etc/init.d/snmpd restart
6、在cacti监控主机上测试
yum install -y net-snmp-utils*
[root@xxx ~]# snmpwalk -v 2c -c xxx xxx.xxx.xxx.xxx .1.3.6.1.4.1.2021.85

UCD-SNMP-MIB::ucdavis.85.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.85.2.1.2.11.104.100.79.117.116.66.108.111.99.107.115 = STRING: “/bin/sh”
UCD-SNMP-MIB::ucdavis.85.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.85.2.1.4.11.104.100.79.117.116.66.108.111.99.107.115 = “”
UCD-SNMP-MIB::ucdavis.85.2.1.5.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.85.2.1.6.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.85.2.1.7.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.85.2.1.20.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.85.2.1.21.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.85.3.1.1.11.104.100.79.117.116.66.108.111.99.107.115 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.3.1.2.11.104.100.79.117.116.66.108.111.99.107.115 = STRING: “0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
200379951104
7030989824
146694144
193201644544″
UCD-SNMP-MIB::ucdavis.85.3.1.3.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 28
UCD-SNMP-MIB::ucdavis.85.3.1.4.11.104.100.79.117.116.66.108.111.99.107.115 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.1 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.2 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.3 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.4 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.5 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.6 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.7 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.8 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.9 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.10 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.11 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.12 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.13 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.14 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.15 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.16 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.17 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.18 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.19 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.20 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.21 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.22 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.23 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.24 = STRING: “0″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.25 = STRING: “200379951104″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.26 = STRING: “7030989824″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.27 = STRING: “146694144″
UCD-SNMP-MIB::ucdavis.85.4.1.2.11.104.100.79.117.116.66.108.111.99.107.115.28 = STRING: “193201644544″
看到以上内容说配置成功.

7、Cacti模版配置
a、编辑某个主机
https://monitor.phpdba.com/cacti/host.php?action=edit&id=xx
在Associated Data Queries选择SNMP-Disk Statistics点击 Add 添加
最后点击 Save 保存完成。
8、为主机创建Graphs
https://monitor.phpdba.com/cacti/graphs_new.php?host_id=xx
Data Query [SNMP - Disk Statistics] 勾选需要监控的磁盘
最后点击Create,创建完成。

9、snmpdiskio下载

snmpdiskio_v2