码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-12-22 19:54:28      阅读:191      评论:0      收藏:0      [点我收藏+]

标签: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监控服务器空间脚本

标签:check_snmp_storage.pl

原文地址:http://yangzhiming.blog.51cto.com/4849999/1592544

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!