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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
bartek_zgo
Posts: 5
Joined: Thu Mar 16, 2017 4:41 am

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

Post 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.
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

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

Post 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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

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

Post by dwhitfield »

@eloyd is correct. Did you have any questions about his suggestion?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bartek_zgo
Posts: 5
Joined: Thu Mar 16, 2017 4:41 am

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

Post 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?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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
krutaw
Posts: 60
Joined: Wed Jul 31, 2013 6:30 pm

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

Post 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.)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post by scottwilkerson »

thanks @krutaw!
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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 ...
}
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked