Problem with service notifications

Hi-

I’ve got a test installation of Nagios set up and it’s pretty simple. It’s only monitoring a single service on a single host. It uses the contact group defined in the service block and the contact group has only a single contact.

The contact is set up to notify-by-email and host-notify-by-email, and the email address for the contact is set.

All is well. However, when I take the service down to test what happens, I only get a host notification, not a service notification.

Here are the config blocks that are interesting:

define service{
use generic-service ; Name of service template to use

host_name			testuser2
service_description		TEST_SVC
is_volatile			0
check_period			24x7
max_check_attempts		3
normal_check_interval		1
retry_check_interval		1
contact_groups			test-admins
notification_interval		120
notification_period		24x7
notification_options		c,r,w,u
check_command			check_rate!5282!Orders!-16!-22!0!0
}

define contactgroup{
contactgroup_name test-admins
alias Test Administrators
members nagios
}

define contact {
contact_name nagios
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email [email protected]
pager [email protected]
}

define command{
command_name notify-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: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /usr/bin/mail -s " $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}

define command{
command_name host-notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time: $DATETIME$\n” | /usr/bin/mail -s “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$
}

Here’s the nagios.log:

[1106704236] HOST ALERT: testuser2;DOWN;HARD;10;/sbin/ping6 -n -c 1 17.207.12.114
[1106767596] HOST NOTIFICATION: nagios;testuser2;DOWN;host-notify-by-email;/sbin/ping6 -n -c 1 17.207.12.114
[1106767626] SERVICE ALERT: testuser2;TEST_SVC;CRITICAL;HARD;1;CRITICAL - Count: 0, AVG: 0, ROC: 0%

I get notified for the host being down, but not for the service being down. Weird.
This is Nagios 1.2 running on Mac OS X.

Anyone have any ideas?
Edited ]

So, it turns out that nagios does not send service notifications if your host is down. Now, why was my host down? I had a check-host-alive associated with the host entry that uses check_ping, but when I took my service down, it started failing. The reason is that check_ping was using /sbin/ping6 instead of /sbin/ping. Maybe it’s just because it’s the Mac. So, I had to add a “-4” argument to check_ping. Now, the real question is: Why wasn’t my host down when the service was up if it was using ping6? Something to ponder. My guess is that if any service is up, then it doesn’t check the host being down. sigh

Correct, there is no point to checking a host, if the service that it runs on is “ok”. In a large setup of nagios, you would be spammed if nagios didn’t use a little logic about what to notify you about. If you set it up right, the only think you will get notified about is the broken equipment/service and not the unreachable, etc.

I’m having the same probllem.first i set nagios to check localhost and a host that is not present all all(for testing of course).then i got host down notification.Then i set nagios to check only on localhost but i’ve added a service that confirmly will be down(that is udp) because i don’t connect to a networ.In the web interface, i got that service critical but nagios don’t send any notification.The setting are all correct according to the documentation.It seems that nagios only send notification on host but not service

If you did NOT get a service down notification, then it’s because of this:
nagios.sourceforge.net/docs/1_0/ … tion_notes

Please read that url, and you will understand why you HAVE TO, do the following.
Go to the service detail in the nagios cgi webpage and toggle the notification enable/disable for THAT SERVICE. It doesn’t matter WHAT it says right now. We need you to TOGGLE it, Now, down the service and up the service and you should be notified, depending of course on how you have your contact/service setup. i.e. u, r, w, c