I know Nagios can monitor and alert on the content within a log file, but does anyone know of a plug-in, or other tool, that will monitor a log file for a particular string and then send the entire line in an email message where that match occured?
feedback
|
|
The stock check_log plugins is sort of... miserable; it uses 'diff' and processes the entire log, every time you run it, so it doesn't scale well. At all. ConSol Labs maintains an excellent log checking plugin that does exactly what you want: http://exchange.nagios.org/directory/Plugins/Log-Files/check_logfiles/details It is listed on Nagios Exchange, but here is the direct link to the English version: http://labs.consol.de/lang/en/nagios/check_logfiles/ You have to run this through NRPE, or check_via_ssh (+ ssh keys), obviously. | |||
|
feedback
|
|
@af-at-work: There is a tool for this: "Tenshi is a log monitoring program, designed to watch one or more log files for lines matching user defined regular expressions and report on the matches. The regular expressions are assigned to queues which have an alert interval and a list of mail recipients." | |||
|
feedback
|
|
If you can read the log file with a bash (or perl or python or etc.) script and search for the string (grep), sure. The script needs to set a non-zero return code and return the string. The script can reside on the server in question, and nagios can use the check_by_ssh command to run the script on the server. | |||
|
feedback
|
|
Why even involve Nagios in such a situation? This seems like over complication. Why not just go to the server, write a small shell script to do what you want, execute it via a cron job. The scripting MUST contain in either case the logic to send email out. | |||||||||
feedback
|