Service Notification Sent before Host is checked

Nagios checks a service, it turns out that its down so it sends a notification and after it has sent the notification, it checks the host and realizes that the host is down as well.

How do I get Nagios wait to send the service notification until after it checks the host. If they host is down, don’t bother sending the service notification but it the host is up, then send it.

Here is a quick shot of my log that gives a good example of the problem I am having:

[1272636844] SERVICE ALERT: TestHost;PING;CRITICAL;HARD;1;PING CRITICAL - Packet loss = 100%
[1272636844] SERVICE NOTIFICATION: pcsupport;TestHost;PING;CRITICAL;notify-service-by-email;PING CRITICAL - Packet loss = 100%
[1272636857] HOST ALERT: TestHost;DOWN;HARD;1;CRITICAL - Host Unreachable (10.2.1.57)
[1272636857] HOST NOTIFICATION: pcsupport;TestHost;DOWN;notify-host-by-email;CRITICAL - Host Unreachable (10.2.1.57)

what MAX_CHECK_ATTEMPTS are you using on the service?

max_check_attempts is set to 1

Is that what is causing it to send out the service notification before checking the host?

i’m not sure… setting it to 1 you are telling nagios to send a notification as soon as a service check fails…

try setting it to 2 or 3 and see what happens. check retry_interval too… i don’t know how much it takes to schedule the host check. :slight_smile:

Thanks for the help, I made the change and will see if it makes a difference.

let us know if it fixes :slight_smile:

That seem to have fixed it. Thanks for the advice.

I guess I made the assumption that it wouldn’t send the notification until the host was check, not realizing that as soon as the state is determined hard, it would send the notification.

happy the issue was resolved :slight_smile:

Thanks for the update.