Page 1 of 2
hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 11:38 am
by ChathamDaleJ
As I remember in core nagios, one can create a hostgroup with all hosts with an asterisk '*'. One can then remove all hosts in a particulare hostgroup.
How do you do this in XI?
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 12:49 pm
by lmiltchev
It should be pretty easy to do this in XI. Go to the CCM->Host Groups. You can add a new hostgroup, i.e. "allhosts", click on "Manage Hosts", select the asterisk ("*") on the bottom of the hosts list, add selected, close, save and apply configuration. If you view the config, it would look like this:
Code: Select all
define hostgroup {
hostgroup_name allhosts
alias allhosts
members *
}
You can verify that all of the hosts are added by opening the "objects.cache" in a text editor, where you should see:
Code: Select all
define hostgroup {
hostgroup_name allhosts
alias allhosts
members hostA,HostB,HostC,...
}
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 2:12 pm
by ChathamDaleJ
Forgive me, I was not specific enough.
In Core, you can in some objects, define the members to be one group minus another group.
In my case, I'm looking for an easy way to group non-windows hosts. I have a windoes hostgroup.
At one time, thought you could do something like:
Code: Select all
define hostgroup {
hostgroup_name not-windows
alias Non Windows Hosts
members *,-windows-group
}
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 2:16 pm
by rkennedy
I think what you're looking for is the
! character, see the link below for more information -
https://assets.nagios.com/downloads/nag ... ricks.html
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 2:32 pm
by ChathamDaleJ
Below is from the core documentation. Importing this does not work.
Static configuration?
There has got to be a way to do this, doesn't there?
Excluding Hosts:
If you want to create identical services escalations for services on numerous hosts or hostgroups, but would like to exclude some hosts from the definition, this can be accomplished by preceding the host or hostgroup with a ! symbol.
Code: Select all
define serviceescalation{
host_name HOST1,HOST2,!HOST3,!HOST4,...,HOSTN
hostgroup_name HOSTGROUP1,HOSTGROUP2,!HOSTGROUP3,!HOSTGROUP4,...,HOSTGROUPN
service_description SOMESERVICE
other escalation directives ...
}
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 2:37 pm
by Box293
It needs to be done differently in XI:
Go to Misc Settings Tab -> Manage Variable Definitions
In "Variable name" enter hostgroup_name
In "Variable value" enter *,!exclude_this_server
Close
Save
Apply Configuration
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 2:44 pm
by ChathamDaleJ
Then in hosgroup use the variable where I'd normaly put *,!...?
Thanks!
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 2:47 pm
by Box293
ChathamDaleJ wrote:Then in hosgroup use the variable where I'd normaly put *,!...?
No, just adding in the variable under Misc Settings tab is all that is required.
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 3:14 pm
by tmcdonald
The reason the static config needs to be used and that the import causes issues is that, to be frank, we don't have the exclusion logic in the CCM. I don't have a great explanation for why not - I asked the developers just now and will update when I get a reply, but at the moment the CCM is not 100% in line with all the options in Core. 98% maybe, but not 100. Part of this is just the nature of propagation - changes in Core need to be done before XI can catch up, so there is a bit of a delay. Granted exclusions have been around for a while, but the roadmap is up to the developers.
Static configs let you still use all the Core configs as-is, but they will not appear in the CCM. This lets you use the exclusions still, but it is a little bit more work.
Re: hostgroup containing * -hostgroup
Posted: Tue Dec 22, 2015 3:26 pm
by ChathamDaleJ
I'm having a hard finding the tab to manage variables.
As for why it isn't done, I'm a pretty heavy scripter and started my life as a software engineer. You get the low hanging, high demand fruit and work with the workarounds. Completely understandable. Not ideal, but, ...
I wrote a Nagios.pm module long ago. It picked apart a configuration file, put comma separated items in an array inside a hash of hashes of hashes and then printed them out to single files. If I find it, I may send it to you. It would do a better job than what you've got.
BTW, I've done the ramdisk thing. We're running on a vmware guest. Not my idea, but I don'g get to spend the $$. At what point do you think we'll start hiving issues? Right now, 819 hosts, 3,335 services. I have not yet defined dependencies, but that is down the road. I was running them every 5 minutes but without the ramdisk we were on the ragged edge of cascade due to I/O waits. Now we're OK. I'll crank it back to 5 minutes. Where do you think with vmware we'll start having issues? The vmware boxes are pretty hefty, not sure what they're running on.