#!/bin/bash#port=$1u=$1w=$2c=$3bc=/usr/bin/bcgrep=/bin/grepawk=/bin/awkhead=/usr/bin/headtail=/usr/bin/tail#u= ' Http://219.148.23.137: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, ":");p rintf ("wait=%s", Ta[2]);} ') #echo "wait=" $WAITeval $ (awk -v info= "$n" ' Begin{split (Info,ta, ":");p rintf (" dataname=%s ", ta[1]);} ') #echo "dataname=" $DATANAME #echo '------------------------------' if [ ' echo "$ wait >= $c "&NBSP;|BC == 1 ] ;thenecho " ${dataname} critical - ${dataname} wait=${wait} | Wait=${wait};${w};${c} all=1;1;1 ";exit 2;elif [ ' echo " $WAIT >= $w "&NBSP;|BC ' == 1 ] ;thenecho " ${dataname} warning - ${dataname} wait = ${wait} | Wait=${wait};${w};${c} all=1;1;1 ";exit 1;elif [ ' echo " $WAIT < $w " |BC ' == 1 ] ;thenecho ' ${dataname} ok - ${dataname} wait = ${wait} | Wait=${wait};${w};${c} all=1;1;1 ";exit 0;elseecho " ${dataname} error - unable to determine ${dataname} data ";exit 3;fiecho " Unable to determine data. ";
The Nagios monitoring data script is recorded.