Refer to parent in host checks

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
zuzzy
Posts: 7
Joined: Sun Apr 29, 2012 6:07 am

Refer to parent in host checks

Post by zuzzy »

I am trying to write checks that refer to a parent. In its most simplistic form, that would mean a check where the host pings its parent

The reason I want to find an 'easy' way to do this is that I would only have to define a host as a child of a parent and the checks would "update". And more importantly, if I change the parent of a host to another one, it would start pinging that parent instead

I actually want to extend this in the end for more complex checks as well, such as I want to make a command based on check_by_ssh that would connect to the parent and probe the host (as the host is not directly reachable, and moves between various sites - aka parent firewalls), if anyone has a better way that would do as well! So in the end if that host moves to another site I just update it's parent and the probes now go via the new parent not the old one

Thanks
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Refer to parent in host checks

Post by agriffin »

I'm not aware of any way to do this the way you describe. This is what DNS is for. If I were you I'd set up a DNS server and update the IP addresses there when a host moves.
zuzzy
Posts: 7
Joined: Sun Apr 29, 2012 6:07 am

Re: Refer to parent in host checks

Post by zuzzy »

The problem for me is that the parent changes quite often - we have temporary sites where, for example, ten switches are behind a firewall, and using check_by_ssh to the firewall I am checking they are reachable behind the firewall. Next week they are behind a different firewall. I didnt want to change the checks, just the defined parent of those ten devices and all the checks seamlessly update themselves.
Thx, --Chris
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Refer to parent in host checks

Post by agriffin »

I'm not sure I fully understand your situation, but it might be easier to set up passive checks so that your hosts are sending check results out of the firewall rather than you trying to get through the firewall and updating IP addresses all the time.
zuzzy
Posts: 7
Joined: Sun Apr 29, 2012 6:07 am

Re: Refer to parent in host checks

Post by zuzzy »

Yeah, that's what I thought too. Easier said than done on a switch though, or a wireless AP, except for maybe snmp traps. These kind of have to be actively polled :(
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Refer to parent in host checks

Post by agriffin »

You could try defining these addresses in custom macros and reference those in your checks.
Locked