check_logs.pl question
Andreas Ericsson
ae at op5.se
Fri Nov 11 13:32:46 CET 2005
Mark Limburg wrote:
> 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 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 ..
>
You mean like grep -B 1 -C 3 ? Sound's like a real novelty...
> 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.
>
cron is your friend.
> This would provide a simple and workable addon to check_logs,
Perhaps, but you'd also have to move much of the logic from Nagios into
the plugin which is a very stupid thing to do.
> which I'm sure
> can be used by many on the list :)
>
Possibly. Feel free to send whatever code you hack up and I'll have a
look at it.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
-------------------------------------------------------
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