Discussion:
[Nagios-users] changing the email message notification content
Jonathan Murray
2013-09-24 20:06:28 UTC
Permalink
I have a user that's asked that when the check_proc notification emails
get sent, that they include the output of ps (or something)

Can someone give me an example of how they've solved this, or an idea on
how you might solve it?

thank you
--
Jonathan Murray x 2877
linux generalist
Woods Hole Oceanographic Institution
Justin Pryzby
2013-09-25 00:51:22 UTC
Permalink
Post by Jonathan Murray
I have a user that's asked that when the check_proc notification emails
get sent, that they include the output of ps (or something)
Can someone give me an example of how they've solved this, or an idea on
how you might solve it?
I have a wrapper around check_procs on some machines, which uses
multi-line output (actually, mine is currently using peformance
output, which is probably wrong).

Something like:
ret=0
check_procs || ret=$?;
ps -eo comm |sort |uniq -c |sort -nr
exit $ret

You can put that in nrpe directly or with a wrapper script.

That shows up in the cgi and in logs, which is nice on its own.

I think you'll likely have to modify your notify command to use
$LONGSERVICEOUTPUT$, and perhaps upgrade NRPE to support long output.

I wouldn't recommend using long output in any command that also sends
text messages.

Another way to implement it is with event handlers; that would send a
separate email (in addition to the notification).

Justin

Loading...