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.
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...

Dallas Haselhorst has worked as an IT and information security consultant for over 20 years. During that time, he has owned his own businesses and worked with companies in numerous industries. Dallas holds several industry certifications and when not working or tinkering in tech, he may be found attempting to mold his daughters into card carrying nerds and organizing BSidesKC.
31 thoughts on “Nagios – ndo2db not running”
Thank you!!
Wasted an hour searching, this solution took my pain away in a moment.
Fantastic! Happy to hear it helped and thank you for the feedback!
Thanks, it´s very useful for my servers, this works for Nagios Core too.
Excellent! Thanks for the feedback!
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!!
Excellent! Thanks for the feedback and congrats on the migration!
Thanks Dallas
No problem!
Thank You,it worked
Life-Saver 🙂
Thanks alot. I have resolved the issues with above steps.
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!!
Excellent! I love hearing it helped you out and thanks for the feedback!
Great ! Thank you very much.
No problem! Thanks for the feedback!
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.
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!
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.
We almost restored a server before finding your post. Thank you!!!!
Fantastic! So happy to hear that!
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.
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!
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.
Excellent! No problem!
thanks alott man
you are a life saver
You’re very welcome!
Wow….! Solved the problem in the min.
Thank you for this.
Awesome! Thanks for the feedback!
Muchas gracias !! Es una solucion efectiva
De nada 😉
Thank you so much. It really solved my issue.