Page 1 of 1
Removing an asset from Noagios Core monitoring..Issues
Posted: Mon Nov 18, 2019 9:48 am
by jmr1070
I have recently taken support of our Nagios Core and we monitor several types of devices. I have a server that was taken out of production and shut down. Nagios now shows it as red and I need to remove it from being monitored. I see it and have removed it from the following cfg files. HOST.CFG, HOSTGROUPS.CFG, SERVICES.CFG AND WINDOWS.CFG. I have remove server from each one at a time and I have removed the server from all at once before restarting. I get error messages every time and it never gets removed from monitoring. As I have no documentation I am needing the proper way to completely remove a server from Nagios? Thanks
Re: Removing an asset from Noagios Core monitoring..Issues
Posted: Mon Nov 18, 2019 10:21 am
by lmiltchev
After you removed the entry from the config files, did you restart nagios, so that changes can take effect? I would recommend verifying configuration first:
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Note: Change the path to the binary or config file if it is different on your system.
If you don't see any config errors, restart nagios:
Let us know if this helped.
Re: Removing an asset from Noagios Core monitoring..Issues
Posted: Mon Nov 18, 2019 11:11 am
by jmr1070
After I remove all instances of the server from each of the 4 sperate cfg files I do a restart. This is when I receive an error and nagios goes offline.Here is the error I received.
Error: Could not find any host matching '(server name)' (config file '/etc/nagios/objects/hostgroups.cfg', starting on line 6)
Error: Could not expand members specified in hostgroup (config file '/etc/nagios/objects/hostgroups.cfg', starting on line 6
There is no reference to the server in the hostgroup or any other of the cfg files. Added question....The server was taken offline before being removed from Nagios, is that an issue? Also, is there an order to remove from each cfg or can they be removed at once?
Re: Removing an asset from Noagios Core monitoring..Issues
Posted: Mon Nov 18, 2019 11:22 am
by lmiltchev
Did you forget to remove the host from the hostgroup? What do you have on (around) line 6 in /etc/nagios/objects/hostgroups.cfg? You need to make all of the changes, verify configuration, and ONLY if there are no config errors, restart nagios. It doesn't matter if your server (the host) is UP or DOWN.
Re: Removing an asset from Noagios Core monitoring..Issues
Posted: Mon Nov 18, 2019 11:59 am
by jmr1070
I removed all instances of the host(server) from the hostgroup, host, service and windows cfg files. Still received the error on restart. You mentioned testing to verify the cfg before restarting? What is the best way to do that? I typically make a copy of the good cfg, make changes and do a restart of Nagios service. If I can test each file before restarting that would help.
Re: Removing an asset from Noagios Core monitoring..Issues
Posted: Mon Nov 18, 2019 12:14 pm
by lmiltchev
You mentioned testing to verify the cfg before restarting?
You need to run:
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are config errors, you have to fix them first. Nagios cannot start/restart with a broken configs.