check_logs.pl question
Marc Powell
marc at ena.com
Fri Nov 11 05:15:09 CET 2005
> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Mark Limburg
> Sent: Thursday, November 10, 2005 7:01 PM
> To: Nagios-users at lists.sourceforge.net
> Subject: Re: [Nagios-users] check_logs.pl question
>
> Okay, next plan.
>
> BoxA runs Nag .. BoxB run NRPE and does a check_logs .. is there a way
for
> me to execute a shell script on BoxB if check_logs is triggered into
> warning?
>
> http://sysunconfig.net/unixtips/wgrep.txt
> <http://sysunconfig.net/unixtips/wgrep.txt> is a damn fine tool which
> will allow me to grab the lines I want as well as lines above and
below
> those found in the regex.
>
>
> the way I have wgrep working, it returns 8 lines per match .. a
divider,
> one line above the regex, the regex line, and three lines after it ..
>
> if the check_logs.pl triggers, it returns the number of matches found
in
> the logfile .. lets say it 4 matches ..
>
> what I want to do, is to be able to use tail -l (8 * number of matches
> found) so it only outputs the faults found ..
>
> then, send an email from the script which sends this output
>
> so what i need, is a method to trap the number of fails from
check_logs.pl
> ... and pass this to a script that can wgrep and send the output to an
> email address.
>
> This would provide a simple and workable addon to check_logs, which
I'm
> sure can be used by many on the list :)
You could modify check_logs or you could use an event handler. An event
handler will be called when the service changes state and you can pass
it the plugin output. Use that to get the number of lines then have your
event handler ssh or whatever to your remote host and grab the info out
of the log file that you need and e-mails is. There's a good example in
the docs that you can use as a starting point.
--
Marc
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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