Hello,
I have the latest version of nagios monitoring around 1300 network devices.
I'd like to setup parent / child relationships for each of these devices.
The only way I can see to do this is to add the parent under each host definition, which is pretty cumbersome.
I was hoping I could create some hosts groups and add the parent to the host group, but this doesn't seem to be supported.
Is there another way to do this easily?
Quick way to create create parent / childs
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Quick way to create create parent / childs
The purpose of hostgroups is not to generate like configurations for multiple hosts (or anything else) - they are used for creating groups of hosts that share like services and connecting them together.
What you're trying to achieve is done so using templates. Assign the same template to all of your hosts at whatever level and slam the parent definition in there. Note templates stack so you can actually just have a template that looks like this:
What you're trying to achieve is done so using templates. Assign the same template to all of your hosts at whatever level and slam the parent definition in there. Note templates stack so you can actually just have a template that looks like this:
Code: Select all
define host {
name hosts-that-have-somehost-as-their-parent
parents somehost
register 0
}Re: Quick way to create create parent / childs
Thanks
Could I use a regex in that section so I don't have to list out a few hundred different hosts?
Could I use a regex in that section so I don't have to list out a few hundred different hosts?
Re: Quick way to create create parent / childs
Check out https://assets.nagios.com/downloads/nag ... ricks.html
Also, you may not need to do anything. If those hosts all have the same template, then you could just add the parent to their existing template line:
In other words, create a template called hosts-that-have-somehost-as-their-parent as @jdalrymple suggested, then find all your hosts and find all the "use" lines in those hosts, and just add ", hosts-that-have-somehost-as-their-parent" to the end of the line. You can use multiple templates.
Also, you may not need to do anything. If those hosts all have the same template, then you could just add the parent to their existing template line:
In other words, create a template called hosts-that-have-somehost-as-their-parent as @jdalrymple suggested, then find all your hosts and find all the "use" lines in those hosts, and just add ", hosts-that-have-somehost-as-their-parent" to the end of the line. You can use multiple templates.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Quick way to create create parent / childs
Former Nagios Employee.
me.
me.