TMP="/tmp/logiis.tmp" STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKOWN=3 PID=0 WARN=50 CRIT=100 PID=`ps -ef |grep "Unavailable -w" |grep -v grep |awk '{ print $2 }' |head -n 1` if [ $# -gt 1 ]; then WARN=$1 CRIT=$2 fi if [ "$3" == "true" ]; then set -x fi #Verifica se o Varnishlog esta executando if [ -n "$PID" ]; then cnterros=`strings /tmp/logiis.tmp | wc -l` #Zero o arquivo mas continua rodando o varnishlog `> $TMP` else printf "UNKOWN - Varnishlog"$PID" nao encontrado.Executando varnishlog command" `nohup varnishlog -I Unavailable -w "$TMP" >& /dev/null &` exit $STATE_UNKOWN fi if [ "$cnterros" -ge "$CRIT" ] ; then printf "CRTICAL - Existem $cnterros erros no IIS|IIS_Erros=$cnterros,$WARN,$CRIT" exit $STATE_CRITICAL elif [ "$cnterros" -ge "$WARN" ] ; then printf "WARNING - Existem $cnterros erros no IIS|IIS_Erros=$cnterros,$WARN,$CRIT" exit $STATE_WARNING elif [ "$cnterros" -le "$WARN" ]; then printf "OK - Existem $cnterros erros no backend de IIS|IIS_Erros=$cnterros,$WARN,$CRIT" exit $STATE_OK fi