×

微信扫一扫,快捷登录!

记录Nagios监控数据的脚本

标签: 记录监控
来自:网络

#!/bin/bash
#PORT=$1   
nagios配置

u=$1
w=$2
c=$3
BC=/usr/bin/bc
GREP=/bin/grep
AWK=/bin/awk
HEAD=/usr/bin/head             开源监控软件
TAIL=/usr/bin/tail
#u='h :8236/nagios_checkpage.ashx?key=SX_MPC'
content=`curl -s $u`
#echo $content
#echo '------------------------------'
eval $(awk -v info="$content" 'BEGIN{split(info,tA,";");printf("n=%s;t=%s;",tA[1],tA[2]);}')
#echo $n $t
#echo '------------------------------'
eval $(awk -v info="$t" 'BEGIN{split(info,tA,":");printf("WAIT=%s",tA[2]);}')        nagios安装
#echo "Wait=" $WAIT
eval $(awk -v info="$n" 'BEGIN{split(info,tA,":");printf("DATANAME=%s",tA[1]);}')
#echo "DATANAME=" $DATANAME   
#echo '------------------------------'
if [ `echo "$WAIT >= $c" |bc` == 1 ] ;then
echo "${DATANAME} CRITICAL - ${DATANAME} Wait=${WAIT} |Wait=${WAIT};${w};${c} all=1;1;1";     
监控软件

exit 2;
elif [ `echo "$WAIT >= $w" |bc` == 1 ] ;then
echo "${DATANAME} WARNING - ${DATANAME} Wait = ${WAIT} |Wait=${WAIT};${w};${c} all=1;1;1";         
nagios实施

exit 1;
elif [ `echo "$WAIT < $w" |bc` == 1 ] ;then
echo "${DATANAME} OK - ${DATANAME} Wait = ${WAIT} |Wait=${WAIT};${w};${c} all=1;1;1";
exit 0;
else
echo "${DATANAME} ERROR - Unable to determine ${DATANAME} data";
exit 3;
fi
echo "Unable to determine data.";         
nagios培训

想做Nagios Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流  QQ群号 476809427




上一篇:nagios脚本监控硬盘故障
下一篇:nagios 监控 mysql的读写比
monicazhang

写了 2297 篇文章,拥有财富 12859,被 21 人关注

您需要登录后才可以回帖 登录 | 立即注册
B Color Link Quote Code Smilies

成为第一个吐槽的人

Powered by IT 运维管理
返回顶部