Bobcares

Host Still Visible After Deletion in Nagios – How to change

by | Apr 24, 2021

Is host Still Visible After Deletion in Nagios? We can help you.

Sometimes, though the host and its services delete successfully from the Core Config Manager it will be seen in the web UI.

As part of our Server Management Services, we assist our customers with several Nagios queries.

Today, let us see how to effectively resolve this error.

 

Host Still Visible After Deletion in Nagios

At times, it is possible to have multiple instances of Nagios running or to have so-called “ghost” hosts or services.

To check those multiple instances of Nagios, we run:

ps -ef | head -1 && ps -ef | grep bin/nagios
UID PID PPID C STIME TTY TIME CMD
nagios 3828 1 0 19:00 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 3830 3828 0 19:00 ? 00:00:00 /usr/local/nagios/bin/nagios –worker /usr/local/nagios/var/rw/nagios.qh
nagios 3831 3828 0 19:00 ? 00:00:00 /usr/local/nagios/bin/nagios –worker /usr/local/nagios/var/rw/nagios.qh
nagios 3832 3828 0 19:00 ? 00:00:00 /usr/local/nagios/bin/nagios –worker /usr/local/nagios/var/rw/nagios.qh
nagios 3833 3828 0 19:00 ? 00:00:00 /usr/local/nagios/bin/nagios –worker /usr/local/nagios/var/rw/nagios.qh
nagios 3834 3828 0 19:00 ? 00:00:00 /usr/local/nagios/bin/nagios –worker /usr/local/nagios/var/rw/nagios.qh
nagios 3835 3828 0 19:00 ? 00:00:00 /usr/local/nagios/bin/nagios –worker /usr/local/nagios/var/rw/nagios.qh
nagios 3840 3828 0 19:00 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root 6050 1785 0 19:05 pts/0 00:00:00 grep bin/nagios

From the output, we can see one “main” process with PID=3828 and no multiple instances of Nagios. The rest are “child” processes that spun from this “parent” (PPID=3828).

In such a case, it is possible that we have “ghost” hosts or services. A config file that for some reason is “left behind” after deleting the host and its services in the Core Config Manager can cause Ghosts.

This problem was more common with older versions of Nagios XI. Our Support Techs suggest it would be a good idea to upgrade to the latest.

 

How to solve this?

Initially, we run the below commands.

RHEL 7|CentOS 7|Debian|Ubuntu 16/18

systemctl stop nagios.service
killall nagios
systemctl start nagios.service

In the case of Ghosts, go to the Core Config Manager > Tools > Config File Management, use Write Configs to manually write out the configuration data to file.

Then use Verify Files to test configuration. If it verifies, go ahead and restart Nagios.

Suppose, we completely delete the host and all of its services in the Core Config Manager and the actual host config file is still there after using the Write Configs button, then go ahead and delete the config file manually.

We can find the files in the following directories:

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

For instance, to delete a “ghost” host, we go to the “hosts” directory:

cd /usr/local/nagios/etc/hosts

Then run the following command to view the configs sorted by modification time:

ls -lt

If we notice a configuration file with an old timestamp, it is possible this is a “ghost” host.

Eventually, to remove the config file, we run:

rm -f <ghost config>

In addition, a much easier way to resolve “ghost” host/services issues is to delete all host/service configuration files and then apply the configuration.

  • Go to the Core Config Manager.
  • Tools > Config File Management.
  • Click on Write Configs and Verify Files to check for config errors.
  • If there are no errors, click on Delete to remove all host and service configuration files.
  • Then, we apply the configuration. The configs will recreate with whatever is in the database.

[Need help with the resolution? We are here for you]

 

Conclusion

In short, we saw the methods our Support Techs employ in order to resolve, Host Still Visible After Deletion in Nagios

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.