I´ve been trying to run a simple plugin to run this bash program that read a text file and return the lines with “ERROR” word:
MSJ="OK no errors in logfile"
while $WORD != “end” ]
WORD=$(head -$I $DATEI | tail -1)
if $WORD != “ERROR” ]; then
else ERR=`expr $ERR + 1` MSJ="Errors in logfile: $ERR errors" STATE=2 fi I=`expr $I + 1` done
echo $MSJ $STATE
It works if I run it from de command line but it´s not giving me the right result when it´s run by nagios.
Thanks in advance!