Page 1 of 1

Do not notify on services if host is down (alert grouping)

Posted: Thu Mar 16, 2017 9:08 am
by bartek_zgo
Moderator Edit: This thread has been split from another - https://support.nagios.com/forum/viewto ... 20&t=27796
In the future, please create a new thread and link to the old one instead of adding on.


Hi,
I have read that changing check intervals, number of retry nagios will not send notifications for services when host is down. But I wold like to STOP any service check when host is down. I have following scenario. We have a lot computing machines (about 100). But when we do not use them, they go to suspend mode. So when host is down (suspended, do not reply for ping) I do not want to perform any check on that machine. I know that I can check host every minute and services every 5, by this is not a nice solution. I want to check some critical services each minute, but only when host is up.

Re: Do not notify on services if host is down (alert groupin

Posted: Thu Mar 16, 2017 9:54 am
by eloyd
Assuming your host check is a ping, make a service check ping as well and then make all your service checks dependent upon the ping service check returning OK.

Re: Do not notify on services if host is down (alert groupin

Posted: Thu Mar 16, 2017 1:12 pm
by dwhitfield
@eloyd is correct. Did you have any questions about his suggestion?

Re: Do not notify on services if host is down (alert groupin

Posted: Thu Mar 16, 2017 4:05 pm
by Box293
host_down_disable_service_checks=1 is a global version of this.

https://support.nagios.com/kb/article.p ... tegory=164

This works in Nagios Core or Nagios XI.

Re: Do not notify on services if host is down (alert groupin

Posted: Wed Mar 22, 2017 8:23 am
by bartek_zgo
I'm very sorry for delay. Eloyd's solution is working. But I have a question. I have 3 services that will depend on ping. So I have to create 3 servicedependency definitions. Do I have to repeat this for each host? So 100 host, 3 services and I will finish with 300 servicedependency definitions? Is it possible to create some smart servicedependency that some service will depend on ping on THE SAME host?

Re: Do not notify on services if host is down (alert groupin

Posted: Wed Mar 22, 2017 4:28 pm
by ssax
Yes, you would need to repeat it for each host, it's best to follow box293's recommendation above so you don't need to change anything else.

Thank you

Re: Do not notify on services if host is down (alert groupin

Posted: Thu Mar 08, 2018 11:40 pm
by krutaw
bartek_zgo wrote:I'm very sorry for delay. Eloyd's solution is working. But I have a question. I have 3 services that will depend on ping. So I have to create 3 servicedependency definitions. Do I have to repeat this for each host? So 100 host, 3 services and I will finish with 300 servicedependency definitions? Is it possible to create some smart servicedependency that some service will depend on ping on THE SAME host?
There's another way to approach this. Instead, you could customize the plugin that performs the check for the ping on the host so that it first verifies that the port being checked is available (5666 for NRPE and 12489 for NSClient - defaults.) This would allow you to watch for the host to be down, and disable the service checks (assuming you've made the necessary changes in nagios.cfg to disable service checks if the host is down.)

Re: Do not notify on services if host is down (alert groupin

Posted: Fri Mar 09, 2018 10:12 am
by scottwilkerson
thanks @krutaw!

Re: Do not notify on services if host is down (alert groupin

Posted: Sun Mar 11, 2018 5:22 pm
by Box293
Also wanted to point out that you can create same host service dependencies as per the documentation:

https://assets.nagios.com/downloads/nag ... ricks.html
Same Host Dependencies Using Wildcard

When you have an agent like NCPA you can use the agent_version check SERVICE1 as the master service. A wildcard can then be used for the dependent_service_description so that all services on that host depend on the status of SERVICE1. Finally you exlcude SERVICE1 in dependent_service_description as it cannot depend on itself.

Code: Select all

define servicedependency 
    host_name                         HOST1,HOST2,HOST3,...,HOSTN
    service_description               SERVICE1
    dependent_service_description     *,!SERVICE1
    other dependency directives ...
}