Home » Categories » Products » Nagios XI » Troubleshooting » Common Problems

Nagios XI - Host Still Visible After Deletion (Ghost Hosts)

Host Still Visible After Deletion (Ghost Hosts)

You have successfully deleted a host and all of it's services from the Core Config Manager, but you are still seeing it the web UI.

 

 

Possible Causes

It is possible that you have multiple instances of nagios running or you have so called "ghost" hosts or services.

In order to check for multiple instances of nagios, run the following command from the command line:

ps -ef | head -1 && ps -ef | grep bin/nagios

 

You will see something like this:

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

 

In the example above, there are no multiple instances of nagios running as there is only one "main" process with PID=3828 and the rest of them are "child" processes that spun from this "parent" (PPID=3828).

If there are no multiple instances of nagios running on the Nagios XI server it is possible that you have "ghost" hosts or services. Ghosts are caused by a config file that for some reason is "left behind" after deleting the host and its services in the Core Config Manager.

Note: This problem was more common with some of the older versions of Nagios XI. The issue is rarely seen in the newer version of XI, so if you are running an old version of Nagios XI (prior to 2014x), it would be a good idea to upgrade to the latest.

 

 

Possible Solutions

In order to resolve the issue with the multiple instances of nagios, run the following commands in the command line:

 

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

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

 

In case you have a "ghost" issue, go to the Core Config Manager > Tools > Config File Management, use the Write Configs button to manually write out the configuration data to file. Then use the Verify Files button to test configuration. If it verifies, go ahead and restart Nagios.

If by chance the host and all of it's services are completely deleted 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. The files will be located in the following directories:

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

 

Example: to delete a "ghost" host, go to the "hosts" directory:

cd /usr/local/nagios/etc/hosts

Run the following command to view the configs sorted by modification time (the oldest files will be on the bottom):

ls -lt

 

Hint: If you notice a configuration file with an old timestamp (file that is not being updated), it is possible this is a "ghost" host. To remove the config file run:

rm -f <ghost config>

 

Another, much easier way to resolve "ghost" host/services issues is to delete all host/service configuration files and then apply configuration.

  • Go to the Core Config Manager
  • Tools > Config File Management (in older versions of XI it may be under the heading "Write Config FIles")
  • Click on Write Configs and Verify Files to check for config errors
  • If you don't have any errors, click on Delete to remove all host and service configuration files.
  • Next, apply configuration. The configs will be recreated with whatever is in the database.

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/



Special Offer For Knowledgebase Visitors! Get a huge discount on Nagios Log Server by clicking below.

Get 60% Off Nagios Log Server!

Did you know? Nagios provides complete monitoring of: Windows, Linux, UNIX, Servers, Websites, SNMP, DHCP, DNS, Email, Storage, Files, Apache, IIS, EC2, and more!

2 (3)
Article Rating (3 Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Nagios XI - CentOS 6 Installation Problems XI 2011R1.7 2011R1.8
Viewed 5202 times since Tue, Feb 2, 2016
Nagios XI - HTTP 500 Error / PHP Parse error - Unexpected $end
Viewed 6985 times since Mon, Jan 25, 2016
Nagios XI - MRTG Reports SNMP_Session Errors
Viewed 5868 times since Wed, Jul 27, 2016
Nagios XI - Some BPI Checks Show "Unknown BPI Group Index" After Upgrade
Viewed 4578 times since Wed, Sep 18, 2019
Nagios XI - Unable to Delete Host
Viewed 24327 times since Tue, Dec 16, 2014
PHPMailer - Troubleshooting Using Debug Logging
Viewed 37153 times since Tue, Aug 14, 2018
Active Directory / LDAP - Troubleshooting Authentication Integration
Viewed 19774 times since Mon, Jun 26, 2017
Nagios XI - Common Upgrade Failures And Solutions
Viewed 14547 times since Thu, Jun 29, 2017
Nagios XI - Unable To Login Using Two Factor Authentication
Viewed 9223 times since Tue, Apr 10, 2018
Nagios XI - Apply Configuration Fails - Backend login to the Core Configuration failed
Viewed 25750 times since Tue, Aug 2, 2016