Acquiring data from a log

C. Bensend benny at bennyvision.com
Mon Sep 20 15:12:58 CEST 2010


> I need to acquire data from a log, parse if and, if a particular condition
> is
> met, notify the problem, otherwise just have on nagios the condition. I.e.
> if
> number of record (parsed from log) exceeds 1000, trigger an email,
> otherwise
> just have on nagios web page "Processed 123 records"
>
> I have written a script that extracts and parse the data, so I can do
> inside
> it

Wow.  Check out Consul Labs' check_logfiles plugin.  Don't re-invent
the wheel if you can avoid it.

> if [ $RESULT = 0 ]
> 	then
> 		echo "No records processed"
> 	        exit 0
> elif [ $RESULT -gt $THRESOLD ]
> 	then
> 		echo "CRITICAL: $RESULT records processed"
> 		exit 2
> else
> 		echo "NORMAL: $RESULT records processed"
> 	        exit 0
> fi
>
> where RESULT is the result of the computation and $THRESOLD is passed on
> command line.
>
> I have the following questions:
>
> 1) How can I see whether the command is run?
> 2) How can I see which results are passed to nagios?
> 3) How can I pass both exit values and the string echoed?

#3:

echo "This is output that will show up in the Nagios web UI"
exit 3

Benny


-- 
"Because you have arms like noodles, while I am vigorous and
burly."                               -- Hodgins, "Bones"



------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
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