所需软件:此软件网上并不是太好找,建议大家好好收藏
snmpdiskio-0.9.6.zip
下载点http://www.colderboy.com/wp-content/uploads/2011/08/snmpdiskio.rar
1.把解压之后文件夹下的snmpdiskio文件上传到被监控服务器的/usr/local/bin目录下;
由于9.4太老不支持2.6内核,需要修改, 这里下载的包我已经更新过已经支持2.6内核.
2.把解压之后文件夹下的 partition.xml上传到cacti监控服务器的
/www/cacti/resource/snmp_queries/目录下,这里我的CACTI的
目录文件为以上,大家可以根据实际情况修改。
且分别导入2个模板:
cacti_graph_template_disk_io_bytessec.xml
cacti_data_query_snmp_disk_statistics.xml
3修改snmp配置文件/etc/snmp/snmpd.conf
#----------------------------------------------------------------------------------
com2sec local
localhost public
com2sec local
监控IP 地址
public
com2sec mynetwork NETWORK/24
COMMUNITY
group MyRWGroup v1
local
group MyRWGroup v2c
local
group MyRWGroup usm
local
group MyROGroup v1
mynetwork
group MyROGroup v2c
mynetwork
group MyROGroup usm
mynetwork
view all
included .1 80
access MyROGroup ""
any noauth exact all none none
access MyRWGroup ""
any noauth exact all all none
syslocation etiantian.org
proc mountd
proc ntalkd 4
proc sendmail 10 1
proc httpd
10 1
exec echotest /bin/echo hello world
exec disk_used_shell
/bin/sh /root/current_disk_used.sh
exec httpd_proc
/bin/sh /root/current_httpd_proc.sh
disk /
10000
disk /boot
10000
load 12 14 14
#以下五行是我添加的内容
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
#----------------------------------------------------------------------------------
4重启snmpd服务
/etc/init.d/snmpd restart
五:在cacti监控主机上测试
yum install -y net-snmp-utils*
[root@mail ~]# snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.58
UCD-SNMP-MIB::ucdavis.58.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.58.2.1 = STRING: "hdOutBlocks"
UCD-SNMP-MIB::ucdavis.58.3.1 = STRING: "/bin/sh /usr/local/bin/snmpdiskio hdOutBlocks"
UCD-SNMP-MIB::ucdavis.58.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.58.101.1 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.2 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.3 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.4 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.5 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.6 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.7 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.8 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.9 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.10 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.11 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.12 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.13 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.14 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.15 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.16 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.17 = STRING: "641941504"
UCD-SNMP-MIB::ucdavis.58.101.18 = STRING: "701440"
UCD-SNMP-MIB::ucdavis.58.101.19 = STRING: "224997888"
UCD-SNMP-MIB::ucdavis.58.101.20 = STRING: "297335296"
UCD-SNMP-MIB::ucdavis.58.101.21 = STRING: "2048"
UCD-SNMP-MIB::ucdavis.58.101.22 = STRING: "66200576"
UCD-SNMP-MIB::ucdavis.58.101.23 = STRING: "659456"
UCD-SNMP-MIB::ucdavis.58.101.24 = STRING: "51835904"
UCD-SNMP-MIB::ucdavis.58.101.25 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.101.26 = STRING: "0"
UCD-SNMP-MIB::ucdavis.58.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.58.103.1 = ""
看到以上内容说配置成功.
5.CACTI模版配置,这里有点小难度,需要特别注意
找到Templates-->Host Templates-->找到又上方的Add添加一个主机模版
点开add之后输入创建的主机模版的名字例如:LINUX-disk-io点击create 进入下一步配置
在Associated Graph Templates选择Disk-I/O (bytes/sec)点击Add添加
在Associated Data Queries选择SNMP-Disk Statistics点击 Add 添加
最后点击 Save 保存完成。
6.为主机创建Graphs
Devices --> 选择 一个主机 --> Host Template 选择刚刚创建的linux-disk-io 点击保存
点击上方的 *Create Graphs for this Host在下面就能看到Data Query [SNMP - Disk Statistics]
这样列表,列表内显示你硬盘的信息。选择你需要监控的磁盘点击创建完成。