首页 > 代码库 > 单用check_snmp_storage.pl监控服务器空间脚本

单用check_snmp_storage.pl监控服务器空间脚本


单用check_snmp_storage.pl监控服务器空间脚本


下载check_snmp_storage.pl


http://nagios-snmp.cvs.sourceforge.net/viewvc/nagios-snmp/plugins



说明:


被监控端需安装snmpd




脚本1:


#!/bin/bash


Date=`date +%m%d%y`



Server="10.0.1.2 10.0.1.3 10.0.1.4"


for Server in $Server


do


Space=`/usr/local/bin/check_snmp_storage.pl -H $Server -C public -m /home -w 80% -c 90% | awk -F[:" "]+ ‘{print $4}‘`

Space2=`/usr/local/bin/check_snmp_storage.pl -H $Server -C public -m /home -w 80% -c 90% | awk -F[:" "]+ ‘{print $2}‘`


if [ $Space = "WARNING" ] || [ $Space = "CRITICAL" ]

then

touch /log/Size/Home/$Server.log

echo "$Server size status $Space" > /log/Size/Home/$Server.log

echo "$Server use size $Space2" >> /log/Size/Home/$Server.log

/usr/bin/mail -s "$Server size status" zhi.yang@ming.com < /log/Size/Home/$Server.log

fi

done



注:脚本1是按服务器分别发邮件报警



脚本2:


#!/bin/bash


Date=`date +%m%d%y`



Server="10.0.1.2 10.0.1.3 10.0.1.4"


for Server in $Server


do


Home3=`/usr/local/icinga/libexec/check_snmp_storage.pl -H $Server -C public -m /home -w 80% -c 90%`


touch /log/Size/Home/$Date.log

echo "$Server size status $Home3" >> /log/Size/Home/$Date.log

done

/usr/bin/mail -s "Android home size status" zhi.yang@ming.com < /log/Size/Home/$Date.log

/bin/rm /log/Size/Home/$Date.log



注:脚本2是发1个邮件全部列出




本文出自 “linux” 博客,谢绝转载!

单用check_snmp_storage.pl监控服务器空间脚本