hostgroup containing * -hostgroup

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
ChathamDaleJ
Posts: 55
Joined: Tue Jul 02, 2013 10:44 am

hostgroup containing * -hostgroup

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: hostgroup containing * -hostgroup

Post 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,...
	}
Be sure to check out our Knowledgebase for helpful articles and solutions!
ChathamDaleJ
Posts: 55
Joined: Tue Jul 02, 2013 10:44 am

Re: hostgroup containing * -hostgroup

Post 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
   }
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: hostgroup containing * -hostgroup

Post 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
Former Nagios Employee
ChathamDaleJ
Posts: 55
Joined: Tue Jul 02, 2013 10:44 am

Re: hostgroup containing * -hostgroup

Post 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 ...
		}
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: hostgroup containing * -hostgroup

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ChathamDaleJ
Posts: 55
Joined: Tue Jul 02, 2013 10:44 am

Re: hostgroup containing * -hostgroup

Post by ChathamDaleJ »

Then in hosgroup use the variable where I'd normaly put *,!...?

Thanks!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: hostgroup containing * -hostgroup

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: hostgroup containing * -hostgroup

Post 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.
Former Nagios employee
ChathamDaleJ
Posts: 55
Joined: Tue Jul 02, 2013 10:44 am

Re: hostgroup containing * -hostgroup

Post 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.
Locked