Removing an asset from Noagios Core monitoring..Issues

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jmr1070
Posts: 3
Joined: Mon Nov 18, 2019 9:39 am

Removing an asset from Noagios Core monitoring..Issues

Post 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
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Removing an asset from Noagios Core monitoring..Issues

Post 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:

Code: Select all

service nagios restart
Let us know if this helped.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jmr1070
Posts: 3
Joined: Mon Nov 18, 2019 9:39 am

Re: Removing an asset from Noagios Core monitoring..Issues

Post 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?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Removing an asset from Noagios Core monitoring..Issues

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jmr1070
Posts: 3
Joined: Mon Nov 18, 2019 9:39 am

Re: Removing an asset from Noagios Core monitoring..Issues

Post 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.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Removing an asset from Noagios Core monitoring..Issues

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked