Page 1 of 1

Created Host Groups But Getting Configuration Error

Posted: Fri Mar 11, 2011 9:16 am
by Ben.Patrick
Looking for some pointers in the right direction please.

I've been creating a batch of meaningful host groups so that I can group relevant hosts together for reporting purposes.

After spending the time typing all the groups into the Nagios XI interface, when I try to apply configuration it fails. The Log shows this message
Error: Could not expand members specified in hostgroup (config file '/usr/local/nagios/etc/hostgroups.cfg', starting on line 216)
I have looked into the /usr/local/nagios/etc/hostgroups.cfg file and it only shows the hostgroups from the current active config in NagiosXI and not the version in the Core.

Could it be that Nagios is limited by size of field or certain characters in the field? A sample hostgroup name is:
Production - Plant Equipment - Threading Line
I also have hostgroups embedded in other hostgroups to form a tree of about three levels.

Any help would be appreciated, thanks in advance.

Ben

Re: Created Host Groups But Getting Configuration Error

Posted: Fri Mar 11, 2011 7:56 pm
by admin
Hi Ben -

In order to see the offending statements, you'd have to go to the admin section of the XI interface and select the "Config snapshots" option. The latest error snapshot will contain the config file with the problems.

If Nagios XI detects a config problem when you try to restart it, it rolls back to the last known good config files. That's why you don't see it in the current file.

Re: Created Host Groups But Getting Configuration Error

Posted: Sat Mar 12, 2011 8:27 am
by Ben.Patrick
Thanks for the reply. Went through the snapshot and it was erroring out anytime I had a hostgroup with hostgroup members. Removed all the hostgroup members and the snapshot successfully applied.

I've now gone back in to add the hostgroup members and it still errors out. The message is:
Error: Could not expand members specified in hostgroup (config file '/usr/local/nagios/etc/hostgroups.cfg', starting on line 54)
Line 54 contains the following string:
define hostgroup {
hostgroup_name Location - Bellshill - Plant - Coat And Mark
alias Location - Bellshill - Plant - Coat And Mark
hostgroup_members Production - Plant Equipment - Coat And Mark
}
The hostgroup member is contained in the file at lines 130-133.

Any help would be greatly appreciated.

Re: Created Host Groups But Getting Configuration Error

Posted: Mon Mar 14, 2011 4:36 am
by Box293
From what I understand, a hostgroup can have no members.

However if that hostgroup is a member of another group then it must contain members (otherwise you get the errors you experienced).

Re: Created Host Groups But Getting Configuration Error

Posted: Mon Mar 14, 2011 6:22 am
by Ben.Patrick
Ah gotcha. Thanks Box 293, I'll try populating the Hostgroups with hosts and see how that goes. I was just trying to get the structure sorted out before putting the hosts in the groups. Will give it a try and let you know. Thanks, Ben

Re: Created Host Groups But Getting Configuration Error

Posted: Mon Mar 14, 2011 8:37 am
by Ben.Patrick
Just to confirm that it worked. I added a host into the embedded host group. Saved config. Then embedded the hostgroup within the parent hostgroup and saved config.

All works 100%. Thanks very much.

Re: Created Host Groups But Getting Configuration Error

Posted: Mon Mar 14, 2011 9:59 am
by rdedon
Thanks for the update and feel free to post here again if you have any questions or issues. :-)