I'm in the process of designing a new nagios installation and hostgroups are the current topic of discussion. I would like to be able to target hosts by the hostgroups they are in, but I don't think nagios works the way I want it to. I'm hoping someone can give me some ideas to work around this, or think about it differently.
Based on the host definitions below, I know how to apply a service to each hostgroup. If I want to apply a service to all webservers, that is straightforward. Same thing if I want to target a location or OS platform.
So here is my question. Is there a way to target webservers running on Windows? or Windows servers at location1? I don't see any obvious way to do this, but it would make managing hostgroups easier.
Thanks in advance for any help on this.
define host{
host_name serverA
hostgroups windows,location1,webserver
define host{
host_name serverB
hostgroups windows,location1,webserver
define host{
host_name serverC
hostgroups windows,location2,webserver
define host{
host_name serverD
hostgroups linux,location1,webserver
Apply service only if host is member of two hostgroups
-
mrpaulmanley
- Posts: 2
- Joined: Fri Jan 13, 2012 3:50 pm
Re: Apply service only if host is member of two hostgroups
Unfortunately not, Nagios doesn't have much in the way of logic based (AND, OR, NOT, IF) config and lets face it that would probably create an overt amount of complexity. So you are usually stuck doing hostgroups in the fashion of webservers-windows, webservers-linux, etc.
What you can do however in some instances is to nest hostgroups (make a hostgroup the member of another hostgroup) which may help improve the inheritance flow and lower the amount of necessary config (location > windows > windows-webserver > host).
What you can do however in some instances is to nest hostgroups (make a hostgroup the member of another hostgroup) which may help improve the inheritance flow and lower the amount of necessary config (location > windows > windows-webserver > host).