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

Discuss new project and feature ideas here.
See labs.nagios.com for new projects under development.

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

Postby bartek_zgo » Thu Mar 16, 2017 9:08 am

Moderator Edit: This thread has been split from another - viewtopic.php?f=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.
bartek_zgo
 
Posts: 5
Joined: Thu Mar 16, 2017 4:41 am

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

Postby eloyd » Thu Mar 16, 2017 9:54 am

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

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

Postby dwhitfield » Thu Mar 16, 2017 1:12 pm

@eloyd is correct. Did you have any questions about his suggestion?
dwhitfield
Former Nagios Staff
 
Posts: 4569
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN

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

Postby Box293 » Thu Mar 16, 2017 4:05 pm

host_down_disable_service_checks=1 is a global version of this.

https://support.nagios.com/kb/article.php?id=505&show_category=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.

ALL of my Projects on the Nagios Exchange

Check out my Nagios website
User avatar
Box293
Too Basu
 
Posts: 4764
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia

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

Postby bartek_zgo » Wed Mar 22, 2017 8:23 am

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?
bartek_zgo
 
Posts: 5
Joined: Thu Mar 16, 2017 4:41 am

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

Postby ssax » Wed Mar 22, 2017 4:28 pm

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
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
ssax
Dreams In Code
 
Posts: 3379
Joined: Wed Feb 11, 2015 12:54 pm

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

Postby krutaw » Thu Mar 08, 2018 11:40 pm

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

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

Postby scottwilkerson » Fri Mar 09, 2018 10:12 am

thanks @krutaw!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12331
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

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

Postby Box293 » Sun Mar 11, 2018 5:22 pm

Also wanted to point out that you can create same host service dependencies as per the documentation:

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objecttricks.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.

ALL of my Projects on the Nagios Exchange

Check out my Nagios website
User avatar
Box293
Too Basu
 
Posts: 4764
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia


Return to Nagios Ideas

Who is online

Users browsing this forum: No registered users and 2 guests