分类: 系统运维
2011-10-25 18:11:38
############################################################################################
# 插件说明见:
# 此文作者contact:
# 该文只是插件提供者README的锦上添花作。- -!
# 请尊重插件开发者与此文作者^_^#
############################################################################################
# wget -P /tmp/
# cd /tmp/
# tar xzvf cacti-iostat-1.5.tar.gz
# cd /tmp/
# cd cacti-iostat-1.5/
# cp scripts/iostat.pl /usr/local/bin/
# chmod +x /usr/local/bin/iostat.pl
在cacti所在机器导入cacti-iostat-1.5.tar.gz里的模板,如果导入失败,直接执行以下即可:
# cp/tmp/cacti-iostat-1.5/snmp_queries/linux/iostat.xml /usr/local/apache2/htdocs/cacti2/resource/snmp_queries/
# chown cacti.cacti/usr/local/apache2/htdocs/cacti2/resource/snmp_queries/iostat.xml
# echo '#!/bin/sh' >/export/scripts/iostat.sh
# echo "cd /tmp && iostat -xkd30 2 | sed 's/,/\./g' > io.tmp && mv io.tmp iostat.cache">> /export/scripts/iostat.sh
# chmod +x !$
# /bin/sh -x !$
Crontab加入定时:
*/2 * * * * /bin/sh /export/scripts/iostat.sh
# echo "pass .1.3.6.1.3.1 /usr/bin/perl/usr/local/bin/iostat.pl" >> /usr/local/snmp/snmpd.conf
要监控的分区:
# mount | awk '/sd.[0-9]/ && $0 !~/boot/ {print "disk "$3}'
disk /
disk /usr
把结果追加到/usr/local/snmp/snmpd.conf最后
重启snmpd
# pgrep snmpd | xargs kill &&/usr/local/snmp/sbin/snmpd -C -c /usr/local/snmp/snmpd.conf && ps -ef |grep snmp
此时可以发现data query方式里多了些选项:
Console -> Devices -> Associated DataQueries
添加你喜欢的吧- -!
通常我只看utilisation
此时如果你要冲咖啡啥的,去冲一下,要去小便的,也去撒一下,总之,先干别的事情吧- -!
时间过了几分钟。。。
在cacti所在机器:
# snmpwalk -v1 -c xxxxxx 192.168.0.7 .1.3.6.1.3.1.2
SNMPv2-SMI::experimental.1.2.1 = STRING:"sda"
SNMPv2-SMI::experimental.1.2.2 = STRING:"sda1"
SNMPv2-SMI::experimental.1.2.3 = STRING:"sda2"
SNMPv2-SMI::experimental.1.2.4 = STRING:"sda3"
SNMPv2-SMI::experimental.1.2.5 = STRING:"sda4"
SNMPv2-SMI::experimental.1.2.6 = STRING:"sda5"
SNMPv2-SMI::experimental.1.2.7 = STRING:"sdb"
SNMPv2-SMI::experimental.1.2.8 = STRING:"sdb1"
如果你的iostat.xml这个模板导入失败的话,会有这么漂亮的后果,让你不知所措:
Console -> Devices -> (Verbose Query)-> iostat - Utilisation
老老实实返回前面用cp导入模板吧
你又得去撒尿- -!
哦也,出东西了。
当然这里的”Status”是有东西滴:
GraphTrees -> 对应自定义的host
此时你恨不得有三个鼠标来勾(几个分区同一块硬盘的就算了吧,别贪过瘾)- -!
此时你可能有个小小的愿望:给我二十个手,二十个鼠标吧- -!
Console -> Graph Trees ->对应自定义的host
添加吧。。。
看看成果:
(41.8 KB, 下载次数: 0)
681.16 KB
本文DOC以及插件
robinzhao5182012-03-08 16:16:47
# snmpwalk -v 2c 192.168.0.23 -c public .1.3.6.1.3.1
SNMPv2-SMI::experimental.1.1.1 = INTEGER: 1
SNMPv2-SMI::experimental.1.1.2 = INTEGER: 2
SNMPv2-SMI::experimental.1.1.3 = INTEGER: 3
SNMPv2-SMI::experimental.1.1.4 = INTEGER: 4
SNMPv2-SMI::experimental.1.1.5 = INTEGER: 5
SNMPv2-SMI::experimental.1.2.1 = STRING: "sda"
SNMPv2-SMI::experimental.1.2.2 = STRING: "sda1"
SNMPv2-SMI::experimental.1.2.3 = STRING: "sda2"