Why reinvent the weel. There are many plug-in that adrress this need . Personally I use check_logfiles http://www.consol.com/opensource/nagios/check-logfiles without any problem.
there are many examples in that website that can help you Best regards Dr Marouane HIMDI Ingénieur R&D/R&D Engineer KEREVAL 4, rue Hélène Boucher Z.A. Bellevue 35235 Thorigné Fouillard Tel : +33 (0)2 23 20 36 64 <http://www.kereval.com/> http://www.kereval.com P Pensez à l'environnement: n'imprimez ce message et ses pièces jointes que si nécessaire ! _____ De : Gary Every [mailto:gev...@gmail.com] Envoyé : vendredi 17 avril 2009 17:00 À : kaouther mechri Cc : Nagios-users@lists.sourceforge.net Objet : Re: [Nagios-users] parsing log files on remote hosts #!/bin/bash LOGFILE="/tmp/logfile" WORD="word_to_find" GREP=/bin/grep found=`$GREP -i $WORD $LOGFILE` if [ -z $found ] ## $found is zero bytes then ok=1 RETSTRING=0 ## To be used for the exit code LINE="No instances found" else ok=0 RETSTRING=1 LINE=$found fi echo $LINE exit $RETSTRING ## End of snippet On Fri, Apr 17, 2009 at 7:35 AM, kaouther mechri <kmec...@gmail.com> wrote: Hello All, I am seraching a way to parse some application log files on remote hosts and grep for specific words, I need to add this as a nagios check. Can anyone help me kind regards kaouther ---------------------------------------------------------------------------- -- Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null -- Gary Every "Pay it Forward!"
<<image001.gif>>
------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null