Nagios – ndo2db not running

Nagios – ndo2db not running

Your Nagios server was shutoff unexpectedly and now you see the “database backend” with a red exclamation in the web GUI. The only thing you can do is try to start the process, but it comes back with ndo2db is not running.

ndo2db not running database backend not running

Fortunately, the fix is pretty simple. Feel free to copy/paste the commands to avoid typos. Just make sure you omit the ‘#’ on each command otherwise the command won’t run. Assuming you have already tried restarting the ndo2db service, go to the command-line and verify it is not running.

# service ndo2db status
ndo2db is not running

Still on the command-line, stop the nagios service so you don’t mess anything else up in the process.

# service nagios stop

Run the ‘ls’ command and you should see something similar to what is below (minus the dates of course).

# ls -l /usr/local/nagios/var/ndo*
-rw-r--r-- 1 nagios nagios 0 Oct 18 09:02 /usr/local/nagios/var/ndo2db.debug
-rw-r--r-- 1 nagios nagios 6 Oct 23 10:13 /usr/local/nagios/var/ndo2db.lock
-rw-r--r-- 1 nagios nagios 0 Nov 12 12:43 /usr/local/nagios/var/ndomod.tmp
srwxr-xr-x 1 nagios nagios 0 Oct 23 10:13 /usr/local/nagios/var/ndo.sock

Now rename/move the two files using the commands below.

# mv /usr/local/nagios/var/ndo2db.lock /usr/local/nagios/var/ndo2db.lock.bak
# mv /usr/local/nagios/var/ndo.sock /usr/local/nagios/var/ndo.sock.bak

Now, just restart your nagios service and ndo2db service using the commands below.

# service nagios start
# service ndo2db start

Run the service status command to verify it is now running. You should see the red exclamation change in the web status as well. Voila!

# service ndo2db status
ndo2db (pid 3047) is running...

31 thoughts on “Nagios – ndo2db not running

  1. Hello,

    after migration the nagios server from Citrix Xen to ESXi I used this post for reparing the database. Thanks a lot for usefull and simple solution.

    Great!!

  2. Thank you so much! Wasted hours trying various commands etc. at the terminal to no avail, but this just fixed the problem straight away. You’re a legend!!

  3. This is fantastic. It really work for me. Thank you.
    However, I will like to know the cause of it, so that I can know how to manage it.

    1. Excellent! I prefer to fix root causes as well. This issue happened to me twice and both times it was the result of an improper shutdown (failed battery backup). I’m sure this exists for other scenarios, but locks are almost the result of a resource being unavailable when the system attempts to write/access it. If you are on physical hardware, I would suggest checking your drives/RAID. Though less likely, I would also check if the system is/was under heavy load at any point. Hope that helps!

      1. Hello Dallas,
        Thank you for the feedback. I actually thought I have responded long time ago.
        The issue is related to the improper shutdown of the host server.
        Trust you are keeping safe.
        Best regards.

  4. I’m a linux noob for the most part. What was the cause? Mine is working by renaming. I guess deleting those two files would have had the same results. Does something just get corrupt to cause that.

    1. Yes, renaming or deleting the files would has the same effect here. This issue happened to me twice and both times it was the result of an improper shutdown (failed battery backup and failed power). I’m sure this exists for other scenarios, but locks are almost the result of a resource being unavailable when the system attempts to write/access it. If you are on physical hardware, I would suggest checking your drives/RAID. Though less likely, I would also check if the system is/was under heavy load at any point. Hope that helps!

  5. I understand better now. I’m using a trial of XI within a VM on a desktop with no UPS. The lock file makes since. Thank you for sharing.

Leave a Reply

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