Page 1 of 1

Dependencies for external scripts

Posted: Thu Jun 15, 2017 10:13 am
by hales8181
I have several services that are external scripts run on a VM. I also am monitoring this VM as a host.

If this VM goes down, currently all of the services that use external scripts on the VM go into a Critical state. Is there a way of setting up a dependency so only the host goes down and not these services (these services are tied to other hosts btw)

Thanks

Re: Dependencies for external scripts

Posted: Thu Jun 15, 2017 10:31 am
by lmiltchev
Can you show us some "example" configs? Do you want nagios to stop notifications, active checks or both on a service if the host is down?

You could probably make these checks dependent on a Ping service, attached to this host. For more information on host/service dependencies, please review our Nagios Core documentation here:
https://assets.nagios.com/downloads/nag ... ncies.html

Also, you could disable service checks if the host is down by defining the following directive in the nagios.cfg:

Code: Select all

host_down_disable_service_checks=1
https://support.nagios.com/kb/article/n ... ncies.html

Re: Dependencies for external scripts

Posted: Thu Jun 15, 2017 10:43 am
by hales8181
This is where it's a bit of a pain, whilst the external scripts are running on this particular host - the services don't actually relate to that host, and to completely other hosts - does that make sense?

Re: Dependencies for external scripts

Posted: Thu Jun 15, 2017 3:36 pm
by tgriep
If host A goes down, a service check for Host B should not go down unless you setup Service Dependencies. Have you setup a Service Dependencies for the services / hosts in question?

Re: Dependencies for external scripts

Posted: Tue Jun 20, 2017 9:48 am
by hales8181
I'll try to explain myself properly:

Host A is a webhost.
Host B is a Windows VM

Host A has 2 services:
Service AA which is a http check
& Service AB which is a powershell script running on Host B which queries a service on Host A and sends the exit code to Nagios.

Service AB is nothing to do with host B in Nagios (it's not associated with host B at all - nor do I want it to be)

My issue is that if there is an issue with host B and the script cannot run, Service AB reports a failure. My preferred behaviour is that if Host B is down then suppress the check until host B is back up.

I've had a bit of a look at dependencies and can't see how to do this at all. Is this possible?

Re: Dependencies for external scripts

Posted: Tue Jun 20, 2017 10:35 am
by lmiltchev
You can still use service dependencies in this case. Set up a ping service on Host B, which runs more frequently than Service AB. Next, make Service AB dependable on the ping service.

Example:

Code: Select all

define servicedependency {
	#	config_name	test
		dependent_host_name           		Host B
		dependent_service_description 		Service AB
		host_name                     		Host B
		service_description           		Ping
		inherits_parent               		0
		execution_failure_criteria    		c,
		notification_failure_criteria 		c,
		dependency_period             		24x7

}
In the example above, "Ping" is a "master" service" (service that is being depended upon), "Service AB" is the "dependent" service. "Service AB" won't be actively checked, and notifications for it won't be sent if the "master" service (Ping) is in CRITICAL state.