parsing log files on remote hosts

Gary Every gevery at gmail.com
Fri Apr 17 16:59:30 CEST 2009


#!/bin/bashLOGFILE="/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 <kmechri at 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 at 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!"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090417/0c55d913/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at 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


More information about the Users mailing list