Page 1 of 1

Host Dependency

Posted: Fri Aug 12, 2016 10:30 am
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...

Re: Host Dependency

Posted: Fri Aug 12, 2016 2:12 pm
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
   }

Re: Host Dependency

Posted: Tue Aug 16, 2016 10:31 am
by cornelp
Thank you very much. That did it.

Re: Host Dependency

Posted: Tue Aug 16, 2016 11:34 am
by rkennedy
Awesome, going to mark this thread as resolved and close it out!