Host Dependency

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
cornelp
Posts: 10
Joined: Wed Aug 10, 2016 8:59 am

Host Dependency

Post by cornelp »

I have read instructions on how to get host dependency working, but so far I have not been able to have success.
https://assets.nagios.com/downloads/nag ... 1438027273
Here is my setup. I need to make sure that there are no notifications sent if Windows10 device is down, IF MyPC device is up. If MyPC is down, then send out notifications.

Code: Select all

# Define a template for switches that we can reuse
define host{
        name                    generic-switch  ; The name of this host template
        use                     generic-host    ; Inherit default values from the generic-host template
        check_period            24x7            ; By default, switches are monitored round the clock
        check_interval          1               ; Switches are checked every 5 minutes
        retry_interval          1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts      1              ; Check each switch 10 times (max)
        check_command           check-host-alive        ; Default command to check if routers are "alive"
        notification_period     24x7            ; Send notifications at any time
        notification_interval   0              ; Resend notifications every 30 minutes
        notification_options    d,r,u           ; Only send notifications for specific host states
        contact_groups          admins          ; Notifications get sent to the admins by default
        register                0               ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }

define host{
        use             generic-switch          ; Inherit default values from a template
        host_name       MyPC         ; The name we're giving to this switch
        alias           Main Device  ; A longer name associated with the switch
        address         10.2.20.83                ; IP address of the switch
        active_checks_enabled   1
	notification_period	extendhours
        }

define host{
        use             generic-switch          ; Inherit default values from a template
        host_name       Windows10         ; The name we're giving to this switch
        alias           Dependent Device  ; A longer name associated with the switch
        address         10.2.10.166               ; IP address of the switch
        }

define hostdependency{
	host_name			MyPC	
	dependent_host_name		Windows10
	notification_failure_criteria	d,u
	}
Where am I going wrong?
Thanks...
Last edited by rkennedy on Tue Aug 16, 2016 11:35 am, edited 2 times in total.
Reason: Please use [code][/code] tags around long output
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Dependency

Post by scottwilkerson »

If I'm understanding what you described correctly I think you have the hosts backwards in the hostdependency object, try this:

Code: Select all

define hostdependency{
   host_name         Windows10   
   dependent_host_name      MyPC
   notification_failure_criteria   d,u
   }
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
cornelp
Posts: 10
Joined: Wed Aug 10, 2016 8:59 am

Re: Host Dependency

Post by cornelp »

Thank you very much. That did it.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Host Dependency

Post by rkennedy »

Awesome, going to mark this thread as resolved and close it out!
Former Nagios Employee
Locked