<br><font size=2 face="sans-serif">I've been testing Nagios and I've found a few issues with the "check_log" plugin:</font>
<br>
<br><font size=2 face="sans-serif">1. On log switches, it flags an error if there were any messages in the previous log; it doesn't differentiate between errors which have appeared and errors which have gone.  This can be fixed by changing the line:</font>
<br><font size=2 face="sans-serif">count=`$GREP -c "$query" $tempdiff`</font>
<br><font size=2 face="sans-serif">to</font>
<br><font size=2 face="sans-serif">count=`$GREP -c "^>.*$query" $tempdiff`</font>
<br>
<br><font size=2 face="sans-serif">2. The 'tail' command relies on GNU tail; Solaris (and other Unix) tail versions don't have long command options.  Fix is to change:</font>
<br><font size=2 face="sans-serif">lastentry=`$GREP "$query" $tempdiff | $TAIL --lines=1`</font>
<br><font size=2 face="sans-serif">to</font>
<br><font size=2 face="sans-serif">lastentry=`$GREP "^>.*$query" $tempdiff | $TAIL -1`</font>
<br><font size=2 face="sans-serif">Note that we also incorporate the grep change here.</font>
<br>
<br><font size=2 face="sans-serif">3. PATH is set to "", but the chmod isn't given a full path; change:</font>
<br><font size=2 face="sans-serif">chmod 600 $tempdiff</font>
<br><font size=2 face="sans-serif">to</font>
<br><font size=2 face="sans-serif">/bin/chmod 600 $tempdiff</font>
<br>
<br><font size=2 face="sans-serif">A diff of all these changes is:</font>
<br><font size=2 face="sans-serif"># diff check_log.bak check_log</font>
<br><font size=2 face="sans-serif">192c192</font>
<br><font size=2 face="sans-serif"><     chmod 600 $tempdiff</font>
<br><font size=2 face="sans-serif">---</font>
<br><font size=2 face="sans-serif">>     /bin/chmod 600 $tempdiff</font>
<br><font size=2 face="sans-serif">198c198</font>
<br><font size=2 face="sans-serif">< count=`$GREP -c "$query" $tempdiff`</font>
<br><font size=2 face="sans-serif">---</font>
<br><font size=2 face="sans-serif">> count=`$GREP -c "^>.*$query" $tempdiff`</font>
<br><font size=2 face="sans-serif">201c201</font>
<br><font size=2 face="sans-serif">< lastentry=`$GREP "$query" $tempdiff | $TAIL --lines=1`</font>
<br><font size=2 face="sans-serif">---</font>
<br><font size=2 face="sans-serif">> lastentry=`$GREP "^>.*$query" $tempdiff | $TAIL -1`</font>
<br>
<br><font size=2 face="sans-serif">Hope these changes prove useful.</font>
<br>
<br><font size=2 face="sans-serif">John Riddoch</font>