Page 1 of 1

Could not find any hostgroup (but not specified)

Posted: Mon Feb 23, 2015 9:48 am
by smcguire
So I ran into a peculiar problem with Nagios XI the past few days. I've had several instances of XI picking up hostgroups that no longer exist in config files (neither in hostgroup configurations, nor hosts themselves). I've verified that the host, hostgroups the host uses, and services are not set to use the hostgroup, but CCM is still picking it up. Example:

Error: Could not find any hostgroup matching '04. group' (config file '/usr/local/nagios/etc/services/service_8089.cfg', starting on line 16)

Tried setting service to inactive in CCM, and hostgroup does not show up in configuration.
Setting it to active, then removing all hostgroups doesn't fix it.
Removing the service config in CCM doesn't fix it.
Restarting Nagios/Nagiosxi will apply other outstanding configs, but not fix this issue.
No configuration has been modified manually outside of CCM.
Server restart does not fix issue.

[root@nagios-xi-2 etc]# pwd
/usr/local/nagios/etc
[root@nagios-xi-2 etc]# find . -type f | xargs grep '04. group'
[root@nagios-xi-2 etc]#
[root@nagios-xi-2 services]# ls -l /usr/local/nagios/etc/services/service_8089.cfg
ls: cannot access /usr/local/nagios/etc/services/service_8089.cfg: No such file or directory

How do I prevent this/fix this?

Re: Could not find any hostgroup (but not specified)

Posted: Mon Feb 23, 2015 5:04 pm
by jdalrymple
Hi smcquire,

Can you roll back to a snapshot old enough that the errors go away? If so we'd probably love to take a look at both configs in case there is a bug that needs to be squashed.

Re: Could not find any hostgroup (but not specified)

Posted: Mon Feb 23, 2015 7:44 pm
by smcguire
At this time I probably will not be able to roll back as there have been some extensive monitoring changes that have been implemented for new hosts we've brought online. I have to see if we can duplicate this config to our lab setup to replicate problem. I did however extract the last "good" snapshot, and the first bad one when we started encountering problems. I did a recursive ls and diff'ed all the files between both snapshots, and the only change was the hostgroup line of one service:

diff working.out notworking.out
301c301
< 1737,service_8089.cfg
---
> 1745,service_8089.cfg


diff nagios_working/local/nagios/etc/services/service_8089.cfg nagios_not_working/local/nagios/etc/services/service_8089.cfg

< # Created by: Nagios Core Config Manager 2.3.2
< # Date: 2015-02-19 06:31:03
---
> # Created by: Nagios Core Config Manager 2.3.1
> # Date: 2015-02-13 01:16:43
19c19
< hostgroup_name 02. group,03. group,06. group
---
> hostgroup_name 02. group,03. group,04. group,06. group

04. group not being marked as active at the time of addition.

Re: Could not find any hostgroup (but not specified)

Posted: Mon Feb 23, 2015 9:13 pm
by Box293
Try these steps:

Go into CCM
Tools > Write Config Files

Click the Delete button
It will say "Successfully deleted all Host / Service Config Files"

If there is no delete button, these two commands do the same as the delete button:
rm -f /usr/local/nagios/etc/hosts/*.*
rm -f /usr/local/nagios/etc/services/*.*

Click the Write Button
It will show an output of all the files it creates
Click the Verify button
The output should end with "Total Errors: 0"

Do you get 0 errors?

If you don't please go and resolve the highlighted problem and then perform the steps above again.
Usually I like to disable the object it is complaining about and then repeat the steps above until I get 0 errors. Then I can look into what is actually wrong.

If you don't have any errors what happens when you Apply Config?
Quick Tools > Apply Configuration
Click the Apply Configuration button

Another thing to look at, try running the database repair script:

Code: Select all

/usr/local/nagiosxi/scripts/repair_databases.sh
What version of XI do you have?