RESTORE: ndo2db is not running but subsystem locked

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
FrancisNagios
Posts: 58
Joined: Tue Apr 09, 2019 6:54 am

RESTORE: ndo2db is not running but subsystem locked

Post by FrancisNagios »

Hi,

It´s wanted to execute the procedure of a Restore on a different server and with another S.O and give error of: ndo2db is not running. (subsystem locked)

The backup of NagiosXI 5.4.13 was successfully performed on a Centos 6.9 server
Restore has been performed on a Redhat 7.6 server previously installed on NagiosXi 5.4.13

a) /usr/local/nagiosxi/scripts/restore_xi.sh
restore_xi.sh.txt
b) wget https://assets.nagios.com/downloads/nag ... _repair.sh (log attached in restore_repair.sh.txt)

c) ./restore_repair.sh (log attached)
restore_repair.sh.txt
Now I show the output of some commands:

root@nagiosxi var]# rm /usr/local/nagios/var/ndo2db.lock
rm: ¿ delete the empty regular file «/usr/local/nagios/var/ndo2db.lock»? (s/n) y

[root@nagiosxi var]# rm /usr/local/nagios/var/ndo2db.lock
rm: it can not be deleted «/usr/local/nagios/var/ndo2db.lock»: The file or directory doesn´t exist

[root@nagiosxi var]# service ndo2db restart
Restarting ndo2db (via systemctl): [ OK ]

[root@nagiosxi var]# service ndo2db status
ndo2db is not running but subsystem locked

[root@nagiosxi subsys]# netstat -apn |grep 5668
tcp6 0 0 ::1:56686 ::1:5432 TIME_WAIT -
tcp6 0 0 ::1:56684 ::1:5432 TIME_WAIT -
tcp6 0 0 ::1:56682 ::1:5432 TIME_WAIT -
tcp6 0 0 ::1:56688 ::1:5432 TIME_WAIT -
tcp6 0 0 ::1:56680 ::1:5432 TIME_WAIT -

[root@nagiosxi subsys]# /etc/init.d/ndo2db status
ndo2db is not running but subsystem locked

[root@nagiosxi subsys]# ps -aef | grep ndo2db
root 23741 16133 0 14:30 pts/0 00:00:00 grep --color=auto ndo2db

[root@nagiosxi subsys]# service ndo2db status
ndo2db is not running but subsystem locked

[root@nagiosxi subsys]# service nagios status
nagios (pid 18732) is running...


Could it be that the Restore procedure has not been performed correctly?
Component status.PNG
Thanks and regards
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by tgriep »

In addition to the lock file, if the ndo.sock file is on the server, it would keep ndo2db from starting.
Run the following as root to delete both files and start ndo2db.

Code: Select all

rm -rf /usr/local/nagios/var/ndo.sock
rm -rf /usr/local/nagios/var/ndo2db.lock
service ndo2db start
Post if this solves the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
FrancisNagios
Posts: 58
Joined: Tue Apr 09, 2019 6:54 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by FrancisNagios »

Hi,

When I execute the procedure you have mentioned, it keeps giving the same error and the file ndo2db.lock is generated again
The ndo.sock file is not found on the server.
Additionally I have executed the command: /usr/local/nagiosxi/scripts/repair_databases.sh with the following result:
….
recovering (with sort) MyISAM-table 'tbl_variabledefinition.MYI'
Data records: 3833
- Fixing index 1
Redirecting to /bin/systemctl start mysqld.service
Failed to start mysqld.service: Unit not found.
/var/lib/mysql/nagios

===============
REPAIR COMPLETE
===============
Restarting ndo2db (via systemctl): [ OK ]
Restarting nagios (via systemctl): [ OK ]

=======================
nagios database repair succeeded
nagiosql database repair succeeded



I execute the command again to start ndo2db without success

[root@nagiosxi-rh nagios]# service ndo2db start
Starting ndo2db (via systemctl): [ OK ]

[root@nagiosxi-rh nagios]# service ndo2db status
ndo2db is not running but subsystem locked

The file /var/log/mysqld.log doesn´t exist

I executed /usr/local/nagiosxi/scripts/repair_databases.sh and the application no longer starts, it gives us the error to redo the command /usr/local/nagiosxi/scripts/repair_databases.sh

I have executed the command: /usr/local/nagiosxi/scripts/restore_xi.sh with the following result different than the first time:
restore.txt
Thanks and regards
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by tgriep »

Do you reinstall Nagios XI on the system after you restored the backup to the Redhat 7 server?
Run that to update the binary files on the new server just in case they were not updated.
https://assets.nagios.com/downloads/nag ... ctions.pdf

The redhat server is running MariaDB and not MYSQL to there are a few changes.

Run this as root to restart the database.

Code: Select all

systemctl restart mariadb
Then run this to get the last 200 lines of the MariaDB database log and post the output here. Note the location.
tail -200 /var/log/mariadb/mariadb.log

When you ran the restore on the backup file, it seems to be corrupt so try and create a new backup file and restore that to the server.

It does seem to be a SQL database issue with the new server and you may have to rebuild the server as scratch, reinstall a clean version of XI and then do a restore.
Be sure to check out our Knowledgebase for helpful articles and solutions!
FrancisNagios
Posts: 58
Joined: Tue Apr 09, 2019 6:54 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by FrancisNagios »

Hi,

I did again the configuration backup in NagiosCentos and I did the Restore again in NagiosRedHat with the command:

Code: Select all

/usr/local/nagiosxi/scripts/restore_xi.sh
RESTORE1.txt
and I executed the command:

Code: Select all

wget https://assets.nagios.com/downloads/nagiosxi/scripts/restore_repair.sh
chmod +x restore_repair.sh
./restore_repair.sh
I executed the command unsuccessfully

Code: Select all

systemctl restart mariadb
I attach the record (200 last lines) of the MariaDB database.
RESTORE2.txt
In NagiosRedHat I see that alerts arrive in Reports and Event log and Notifications but it does not update anything else like the Service Status and Hosts Status (It keeps the last thing that was in NagiosCentos after the Backup

On the other hand, would there be any possibility of only migrating the configuration without migrating the Database even if the History of alerts is lost ...?

I tried to take the last Snapshots of NagiosCentos to NagiosRedHat, but it gives as a result (This snaphot doesn't exist) even having the permissions of the file well and in the correct route. I do not know if this operation is allowed.

[root@nagiosxi- archives]# ll /usr/local/nagiosxi/nom/checkpoints/nagioscore/archives/
-rw-r--r--. 1 nagios users 190440 may 31 10:29 CONFIG_CENTOS.1559288259.tar.gz
-rw-r--r--. 1 nagios users 52156 may 31 10:29 CONFIG_CENTOS.1559288259.txt

Thanks and regards
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by tgriep »

This document describes how to migrate and import Nagios Core configuration files into Nagios® XI™.
https://assets.nagios.com/downloads/nag ... nto_XI.pdf

The instructions should work as well when migrating the config files from an XI server to another XI server.

On the new server, can you run the following command which will show the contents of the backup file so we can see what is causing the "Not found in file" error?

Code: Select all

tar tvfz /store/backups/nagiosxi/Backup_NagiosCentos_31_05_19.1559289305.tar.gz
Could you post your Nagios XI System Profile from the Redhat server so we can review it?
To get your system profile. Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Save the profile.zip file and upload it to the forum post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
FrancisNagios
Posts: 58
Joined: Tue Apr 09, 2019 6:54 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by FrancisNagios »

Hi,

Thanks for the information and quick response.

Tomorrow I´ll respond with the output of the tar command and System Profile.

I have a question, if I do the migration using the document Importing-Core-Configuration-Files-Into-Nagios-XI.pdf, what do I have to take into account to complete the complete migration?
  • a) Copy the Commands (usr / local / nagios / libexec) from one server to another. do not? Although I understand that some commands to change the S.O not work and have to readjust
    b) Review the entire "Admin" module to match it in both NagiosXI
    c) Installation and configuration of components such as VMware
    d) ¿?
Thanks and regards
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by tgriep »

Take a look at the top of page 4, it has a picture showing the order if which files to import. The first entry shows that you need to import the commands in to XI.
That will only do the command definitions and not the plugins themselves. Any plugins that were added to the existing system and the required packages, will have to be installed on the new server.
Be sure to check out our Knowledgebase for helpful articles and solutions!
FrancisNagios
Posts: 58
Joined: Tue Apr 09, 2019 6:54 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by FrancisNagios »

Hi,

This is the result of the command: tar tvfz /store/backups/nagiosxi/Backup_NagiosCentos_31_05_19.1559289305.tar.gz
tar_tvfz_backup.txt


This is profile.zip file


On the other hand, regarding the plugins (command), would not it be enough to copy it from the / usr / local / nagios / libexec / directory of the NAgiosXICentos to the NAgiosXIR?

Thanks and regards
You do not have the required permissions to view the files attached to this post.
Last edited by FrancisNagios on Tue Jun 18, 2019 9:49 am, edited 1 time in total.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: RESTORE: ndo2db is not running but subsystem locked

Post by tgriep »

About the plugins, as long as they are not plugins that have to be compiled, you can copy them over.
You can copy Perl, Python, Bash scripts, etc.. but is they require other modules / applications, they will have to be installed as well.

I took a look at the profile and found may errors and I suggest recreating the Redhat server from scratch if you want to try and do the restore again.
What I feel it causing the issue is that the server has selinux enabled and that caused the restore to fail. If you create a new system, disable selinux.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked