Contact groups throwing error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
tmattingly
Posts: 115
Joined: Thu Oct 23, 2014 12:53 pm

Contact groups throwing error

Post by tmattingly »

I am getting:

Error: Contactgroup 'cerner-admins' is not defined anywhere
Error: Could not add contactgroup 'cerner-admins' to host (config file '/usr/local/nagios/etc/hosts/fai02024.cfg', starting on line 16)

I believe I have cleared all the hosts that had references to this but I continue to get the errors. I followed
https://support.nagios.com/forum/viewto ... =7&t=40472

and updated the servicetemplates and contactgroups file (this is the .old versions) however I am stuck as to why it reports the above.

Per the above article I ran the following command(s) and got:

# grep -R "cerner-admins" /usr/local/nagios/etc/
/usr/local/nagios/etc/servicetemplates.cfg.old: contact_groups cerner-admins
/usr/local/nagios/etc/servicetemplates.cfg.old: contact_groups cerner-admins
/usr/local/nagios/etc/contactgroups.cfg.old: contactgroup_name cerner-admins
[root@fai0nagiosxi etc]# grep "/usr/local/nagios/etc/servers" /usr/local/nagios/etc/nagios.cfg
[root@fai0nagiosxi etc]#

Any thoughts?

Tom Mattingly
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Contact groups throwing error

Post by BanditBBS »

Have you looked in any other config files in /usr/local/nagios/etc/services or /hosts? You could have a ghost configuration file that still has it referenced. You can then safely delete that file and an Apply Configuration will of course rewrite it.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
tmattingly
Posts: 115
Joined: Thu Oct 23, 2014 12:53 pm

Re: Contact groups throwing error

Post by tmattingly »

Thanks for the response.
I tried to search with: grep -rnw "cerner-admins" /usr/local/nagios and grep -rnw "cerner-admins" /hosts

and it found a file with multiple lines in the following and is it safe to delete these?

/usr/local/nagios/var/objects.precache:23890: contact_groups cerner-admins

I also did a higher up ( # grep -rnw "cerner-admins" /usr/local
) search and it found

/usr/local/temp.search:97:nagios/var/objects.cache: contact_groups cerner-admins

It also found but I assume this is more output config generation files and I need not delete these:
/usr/local/temp.search:166:nagiosxi/nom/checkpoints/nagioscore/errors/1589842720.txt:Error: Contactgroup 'cerner-admins' is not defined an ywhere
/usr/local/temp.search:167:nagiosxi/nom/checkpoints/nagioscore/errors/1589842720.txt:Error: Could not add contactgroup 'cerner-admins' to host (config file '/usr/local/nagios/etc/hosts/fai02024.cfg', starting on line 16)
/usr/local/temp.search:168:nagiosxi/nom/checkpoints/nagioscore/errors/1589839802.txt:Error: Contactgroup 'cerner-admins' is not defined an ywhere
/usr/local/temp.search:169:nagiosxi/nom/checkpoints/nagioscore/errors/1589839802.txt:Error: Could not add contactgroup 'cerner-admins' to host (config file '/usr/local/nagios/etc/hosts/fai02021.cfg', starting on line 16)
/usr/local/temp.search:170:nagiosxi/nom/checkpoints/nagioscore/errors/1589843259.txt:Error: Contactgroup 'cerner-admins' is not defined an ywhere
/usr/local/temp.search:171:nagiosxi/nom/checkpoints/nagioscore/errors/1589843259.txt:Error: Could not add contactgroup 'cerner-admins' to host (config file '/usr/local/nagios/etc/hosts/fai02024.cfg', starting on line 16)
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors/1589842720.txt:46:Error: Contactgroup 'cerner-admins' is not defined anywhere
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors/1589842720.txt:47:Error: Could not add contactgroup 'cerner-admins' to host (config file '/usr/local/nagios/etc/hosts/fai02024.cfg', starting on line 16)
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors/1589839802.txt:46:Error: Contactgroup 'cerner-admins' is not defined anywhere
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors/1589839802.txt:47:Error: Could not add contactgroup 'cerner-admins' to host (config file '/usr/local/nagios/etc/hosts/fai02021.cfg', starting on line 16)
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors/1589843259.txt:46:Error: Contactgroup 'cerner-admins' is not defined anywhere
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors/1589843259.txt:47:Error: Could not add contactgroup 'cerner-admins' to host (config file '/usr/local/nagios/etc/hosts/fai02024.cfg', starting on line 16)
[root@fai0nagiosxi /]#

As a another thought I rename objects.precache to objects.precache.old and reran the apply configuration I get the same message.

Tom
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Contact groups throwing error

Post by BanditBBS »

Hey Tom,

Sorry, I should have been more clear(was woken up for an emergency) the 2 full paths I meant were:

/usr/local/nagios/etc/services/
/usr/local/nagios/etc/hosts/

But your grep of /usr/local/nagios would have included both. However, now that I re-read your original post, delete this file: /usr/local/nagios/etc/hosts/fai02024.cfg and try the apply again. It seems to be that file causing the problem.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Contact groups throwing error

Post by dchurch »

You're using Nagios XI to apply config and this error comes up?

When you apply config, all those files in /usr/local/nagios/etc are deleted and re-created from the Nagios XI database.

Try running this command:

Code: Select all

find /usr/local/nagios/etc/ -type f -name '*.old' -delete
Then re-run apply configuration.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
tmattingly
Posts: 115
Joined: Thu Oct 23, 2014 12:53 pm

Re: Contact groups throwing error

Post by tmattingly »

Thanks for your suggestion but I'm still getting the same error.

Tom
tmattingly
Posts: 115
Joined: Thu Oct 23, 2014 12:53 pm

Re: Contact groups throwing error

Post by tmattingly »

Sorry I saw your two other comments. Yes, this is Nagios XI 5.6.14 and Nagios could not find the file /usr/local/nagios/etc/hosts/fai02024.cfg

Tom
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Contact groups throwing error

Post by dchurch »

If you PM me a system profile I can diagnose further. Get one by going to Admin (top menu) => System Profile (in the left menu), then clicking the blue button.

If you're unable to generate the the profile through the web interface, please try generating it from the command line by running these commands as root:

Code: Select all

rm -rf /usr/local/nagiosxi/var/components/profile*
/usr/local/nagiosxi/scripts/components/getprofile.sh SUPPORT
Then send me the resulting /usr/local/nagiosxi/var/components/profile.zip file.
If the profile script fails, please include the ENTIRE output.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Contact groups throwing error

Post by dchurch »

I was able to get your config to verify by deactivating the service citrix-ima-svc. But that was using Nagios XI 5.8.2.

Prior to Nagios XI 5.7.2, host and service names were case-sensitive in a few places. The best advice I can give is to make sure they're consistently-capitalized throughout the CCM. E.g. Make it either "myhost" or "MyHost" everywhere, never both forms.

The missing fai02024.cfg file is due to the host named fai02024 being deactivated. Go to the CCM's Host List and re-activate it or that cfg file will not show up when the config files are written.

There was also a host in the host list that had no name. This constitutes an error and you should delete this host or give it a name.

Diagnosing you can do for further issues

Instead of using Apply Config, if you go to to Config (top menu) -> Core Config Manager => Config File Management (left menu), then running Delete, Write, then Verify often will reveal more problems with better error messages. This is tremendously helpful when diagnosing config problems. (This is actually the process that the "Apply Config" button does under the hood.)

My advice is to make one little change at a time, then verify the configs each time to see if it caused any errors. If it causes an error, you'll have an exact idea how to fix it.

Also, if you go to Core Config Manager => Configuration Snapshots, you should be able to see a list of configs and when the last known good configuration was successfully applied. This is a tremendous help to "backing out" a bad config.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
tmattingly
Posts: 115
Joined: Thu Oct 23, 2014 12:53 pm

Re: Contact groups throwing error

Post by tmattingly »

Dchurch,

Success!!! I re-enabled fai02024 then I was able to disable citrix-ima-svc (couldn't see it before re-enable fai0204, then I deleted the blank host.

I want to say thank you. I am always careful to verify changes but I had one of my coworkers add in a bunch of hosts for ping tests and that apparently blew it up. To make matters worse I tried to roll back in the snapshots and even going back to the oldest didn't work. My last hope was to put it up on the support forum.

I also want to really say THANK YOU for the different way of looking at the apply configuration as I didn't know. I see a bunch of stuff that I can clean up one by one that I've never seen before. But apply configuration is working and I hope to upgrade to the latest Nagios but haven't been able to.

Tom
Locked