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 ..

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 :)

Reply via email to