Email Alert detail



The email alert I got from nagios is not telling me which service/s not working. It will just appear like the following
It didn’t really tells me what service goes wrong. Is there a way to have Nagios alert include what’s wrong on the service when it sends out alerts?

***** Nagios *****
Notification Type: PROBLEM
State: UP
Info: PING OK - Packet loss = 0%, RTA = 0.14 ms
Date/Time: Tue Mar 18 15:24:09 PST 2008

Also, is it possible to grab the service detail along with the email? For example, if I got an alert that says System Load is critical, can I modify it to include a ps aux status on the email so I can see right on the email what process causing the problems?

Thanks a bunch.



Find commands.cfg on you Nagios machine, there you can find definitions of commands which send alerts.

Macro commands are optional and configurable, so you can get the output in a way you want. Check macro commands here:


Thanks, but I checked the setting on Commands.cfg and the setting looks right to me, and here is how they looks like.
I notice, no matter what service went down, it always shows me State: UP and Info: PING OK
wander if anybody can help me with that.

‘notify-host-by-email’ command definition

define command{
command_name notify-host-by-email
command_line /usr/bin/printf “%b” “***** Nagios ***\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s " $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$

‘notify-service-by-email’ command definition

define command{
command_name notify-service-by-email
command_line /usr/bin/printf “%b” “***** Nagios ***\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s " $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$




The problem you’ve provided in first post is a problem about your host, not the service. Check your contact definitions and see which command is defined for service_notification_commands. Maybe you’ve accidently put notify-host-by-email instead of notify-service-by-email. It looks like that.

Another thing. Why does it send notification when everything seems OK. Check the check_ping command definition in your check_ping.cfg file and see how the warning and critical thresholds are set.


ah…that resolve my problems. I put notify-host-by-email on all the notification options. THANKS!

One other thing is, my company wants me to setup Nagios that can capture the process when its fail and send a log to the email. For example, lets say one day the Load is reached critical level and Nagios alerted me while I am having diner out side. But it gets back to nomal before I finish my diner. so during that time, I really have no idea what cause the load went up. Is there anyway that I can have Nagios to do a “ps -lef” and send the result to me right at the moment when the load level reached critical?



You can do that with event handlers: … dlers.html

Write a script that would do a ps -lef and pipe the output to /usr/bin/mail -a "From: -s “ps -lef output”