记录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,tA);}')
#echo $n $t
#echo '------------------------------'
eval $(awk -v info="$t" 'BEGIN{split(info,tA,":");printf("WAIT=%s",tA);}') nagios安装
#echo "Wait=" $WAIT
eval $(awk -v info="$n" 'BEGIN{split(info,tA,":");printf("DATANAME=%s",tA);}')
#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
页:
[1]