Page 1 of 2

Upgrade to NDO3

Posted: Mon Feb 17, 2025 1:15 pm
by steph007
Hi,

I'm want to upgrade to NDO3 on my test system before doing it in production, but not sure about the process of doing it.
The procudure "Upgrading to NDO 3 after having been downgraded in newer versions of Nagios XI" describe here seems not to be totally complete:
https://support.nagios.com/kb/article/u ... i-885.html

1) Do I really need to install NDO3 part? Should not be already there? should I not just need to change the nagios.cfg file to point to NDO3? I can see the ndo file that it's related to NDO3 to my understanding:
root@plgesmon03[/tmp/nagiosxi]# ls -ltr /usr/local/nagios/bin/ndo.so /usr/local/nagios/etc/ndo.cfg
-rwxrwxr-- 1 nagios nagios 1036208 Feb 5 13:48 /usr/local/nagios/bin/ndo.so
-rw-rw-r-- 1 apache nagios 733 Feb 5 13:55 /usr/local/nagios/etc/ndo.cfg

2) What I do with NDO2 process /usr/local/nagios/bin/ndo2db?

On my test system:
Red Hat Enterprise Linux release 8.10 (Ootpa)
Nagios XI 2024R1.3.4
NDO2DB 2.1.4

Re: Upgrade to NDO3

Posted: Mon Feb 17, 2025 3:56 pm
by DoubleDoubleA
Hi @steph007,

Thanks for your question.

You should be good to go with simply changing over nagios.cfg to point to ndo3 and restarting the nagios process.

You should be able to kill the NDO2 process once nagios is restarted.

Aaron

Re: Upgrade to NDO3

Posted: Mon Feb 17, 2025 4:54 pm
by steph007
Does not work.
I can see all services and all hosts in Operations Center , but I cannot clic on a service to get the detail and on the host directly, I don't see any services.

In the error log, this is what I have:
[1739829153] Nagios 4.5.3 starting... (PID=1836206)
[1739829153] Local time is Mon Feb 17 16:52:33 EST 2025
[1739829153] LOG VERSION: 2.0
[1739829153] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1739829153] qh: core query handler registered
[1739829153] qh: echo service query handler registered
[1739829153] qh: help for the query handler registered
[1739829153] wproc: Successfully registered manager as @wproc with query handler
[1739829153] wproc: Registry request: name=Core Worker 1836209;pid=1836209
[1739829153] wproc: Registry request: name=Core Worker 1836208;pid=1836208
[1739829153] wproc: Registry request: name=Core Worker 1836211;pid=1836211
[1739829153] wproc: Registry request: name=Core Worker 1836213;pid=1836213
[1739829153] wproc: Registry request: name=Core Worker 1836210;pid=1836210
[1739829153] wproc: Registry request: name=Core Worker 1836212;pid=1836212
[1739829153] NDO-3: NDO 3.1.1 (c) Copyright 2009-2024 Nagios - Nagios Core Development Team
[1739829153] NDO-3: Callbacks registered
[1739829153] NDO-3: Callbacks registered
[1739829153] Event broker module '/usr/local/nagios/bin/ndo.so' initialized successfully.
[1739829153] NDO-3: query(TRUNCATE TABLE nagios_timeperiod_exceptions) failed with rc (1), mysql (1146: Table 'nagios.nagios_timeperiod_exceptions' doesn't exist)
[1739829153] NDO-3: query(TRUNCATE TABLE nagios_timeperiod_exception_timeranges) failed with rc (1), mysql (1146: Table 'nagios.nagios_timeperiod_exception_timeranges' doesn't exist)
[1739829153] NDO-3: query(TRUNCATE TABLE nagios_timeperiod_exclusions) failed with rc (1), mysql (1146: Table 'nagios.nagios_timeperiod_exclusions' doesn't exist)
[1739829153] NDO-3: Started timed_event thread
[1739829153] NDO-3: Started host_check thread
[1739829153] NDO-3: Started service_check thread
[1739829153] NDO-3: Started comment thread
[1739829153] NDO-3: Started flapping thread
[1739829153] NDO-3: Started host_status thread
[1739829153] NDO-3: Started contact_status thread
[1739829153] NDO-3: Started acknowledgement thread
[1739829153] NDO-3: Started statechange thread
[1739829153] NDO-3: Started service_status thread
[1739829153] NDO-3: Started notification thread
[1739829153] NDO-3: Started downtime thread
[1739829153] NDO-3: Started event_handler thread
[1739829153] Successfully launched command file worker with pid 1836248
[1739829153] NDO-3: ndo_return = 1 (Table 'nagios.nagios_timeperiod_exceptions' doesn't exist)
[1739829153] NDO-3: ndo_write_timeperiod_exceptions(ndo-startup.c:771): Unable to prepare statement
[1739829153] NDO-3: ndo_return = 1 (Table 'nagios.nagios_timeperiod_exclusions' doesn't exist)
[1739829153] NDO-3: ndo_write_timeperiod_exclusions(ndo-startup.c:683): Unable to prepare statement
[1739829153] NDO-3: ndo_return = 1 (Unknown column 'retain_status_information' in 'field list')
[1739829153] NDO-3: ndo_write_contacts(ndo-startup.c:972): Unable to prepare statement
[1739829153] NDO-3: ndo_write_contacts() failed. Disabling NDO.
[1739829153] NDO-3: NDO startup thread failed at ndo_write_object_config() - disabling NDO.
[1739829153] NDO-3: Ended contact_status thread

Re: Upgrade to NDO3

Posted: Mon Feb 17, 2025 5:19 pm
by gwesterman
If you didn't already, try running the full list of commands in the doc you referenced. Your database may be missing some tables set up by the install (among other things).

Thank you!

Re: Upgrade to NDO3

Posted: Mon Feb 17, 2025 5:53 pm
by steph007
In the doc I referred, I don't see any tables creation documentation.

Re: Upgrade to NDO3

Posted: Wed Feb 19, 2025 8:49 pm
by steph007
Someone can give a hand for this?

Re: Upgrade to NDO3

Posted: Thu Feb 20, 2025 10:39 am
by tgriep
To update the missing tables manually to see if it works, run this as root on the XI server and it needs to be able to access the internet.

Code: Select all

cd /tmp
rm -rf nagiosxi xi*.tar.gz
wget https://assets.nagios.com/downloads/nagiosxi/2024/xi-2024R1.3.4.tar.gz
tar xzf xi-2024R1.3.4.tar.gz
cd /tmp/nagiosxi/subcomponents/ndo
tar xvfz ndo-3.1.1.tar.gz
Stop the nagios process

Code: Select all

systemctl stop nagios
Run this script to get the MYSQL database passwords

Code: Select all

/usr/local/nagiosxi/scripts/get_mysql_passwords.sh
Use the MySQL root password: in place of the xxxxxxxxxxxxxx in the next commands

Code: Select all

mysql -u root -pxxxxxxxxxxxxxx nagios </tmp/nagiosxi/subcomponents/ndo/ndo-3.1.1/db/upgrade-from-3.0.7.sql
echo 'truncate nagios_hoststatus; truncate nagios_hosts; truncate nagios_services; truncate nagios_servicestatus; truncate nagios_servicechecks; truncate nagios_hostchecks; truncate nagios_downtimehistory; truncate nagios_commenthistory;' | mysql -u root -pxxxxxxxxxxxxx nagios
echo "truncate table xi_events; truncate table xi_meta; truncate table xi_eventqueue;" | mysql -u root -pxxxxxxxxxxxxx nagiosxi
mysqlcheck -f -r -u root -pxxxxxxxxxxxxx --all-databases --use-frm |grep -vwE "note"
Start the nagios process

Code: Select all

systemctl start nagios
Check the /usr/local/nagios/var/nagios.log for any NDO-3: query and if none are found, check the statuses in the XI interface to see if they are updating.

If so, then you are good to go.

Re: Upgrade to NDO3

Posted: Thu Feb 20, 2025 3:43 pm
by steph007
Thank you!

On my test system, it seems has done the job. No error into the nagios.log about "Table... doesn't exist" and look good when navigating with the console (to see Services, Hosts and Scheduled Downtime).

I would like to do the same on my production Nagios XI, but I would like to be sure what has been done to fix the problem. Not sure about the command with "truncate". Can it affect the prod?

In prod I'm still in Nagios XI 2024R1.1.5 because I wait to fix the issues with NDO before upgrading. The solution propose for Nagios XI 2024R1.3.4 will work? Of course, I suspect that I need to replace the package for "wget https://assets.nagios.com/downloads/nag ... 1.5.tar.gz"

Re: Upgrade to NDO3

Posted: Thu Feb 20, 2025 5:40 pm
by tgriep
The truncate's only remove temporary data that will get recreated when the services are started after the repair so it is safe to run them on the prod server.

I have updated the command for XI 2024R1.1.5 and they are below all in one code block.

Code: Select all

cd /tmp
rm -rf nagiosxi xi*.tar.gz
wget https://assets.nagios.com/downloads/nagiosxi/2024/xi-2024R1.1.5.tar.gz
tar xzf xi-2024R1.1.5.tar.gz
cd /tmp/nagiosxi/subcomponents/ndo
tar xvfz ndo-3.1.0.tar.gz
systemctl stop nagios
Run this script to get the MYSQL database passwords

Code: Select all

/usr/local/nagiosxi/scripts/get_mysql_passwords.sh
Use the MySQL root password: in place of the xxxxxxxxxxxxxx in the next commands

Code: Select all

mysql -u root -pxxxxxxxxxxxxxx nagios </tmp/nagiosxi/subcomponents/ndo/ndo-3.1.0/db/upgrade-from-3.0.7.sql
echo 'truncate nagios_hoststatus; truncate nagios_hosts; truncate nagios_services; truncate nagios_servicestatus; truncate nagios_servicechecks; truncate nagios_hostchecks; truncate nagios_downtimehistory; truncate nagios_commenthistory;' | mysql -u root -pxxxxxxxxxxxxx nagios
echo "truncate table xi_events; truncate table xi_meta; truncate table xi_eventqueue;" | mysql -u root -pxxxxxxxxxxxxx nagiosxi
mysqlcheck -f -r -u root -pxxxxxxxxxxxxx --all-databases --use-frm |grep -vwE "note"

systemctl start nagios
The NDO package is a different version so I updated that for you.

Thank You.

Re: Upgrade to NDO3

Posted: Fri Feb 21, 2025 10:40 am
by steph007
I did that in prod thanks.

When start back Nagios, I got this. Looking good to me:
[Fri Feb 21 10:35:05 2025] NDO-3: NDO 3.1.0 (c) Copyright 2009-2023 Nagios - Nagios Core Development Team
[Fri Feb 21 10:36:55 2025] NDO-3: Callbacks registered
[Fri Feb 21 10:36:55 2025] NDO-3: Callbacks registered
[Fri Feb 21 10:36:55 2025] Event broker module '/usr/local/nagios/bin/ndo.so' initialized successfully.
[Fri Feb 21 10:36:55 2025] NDO-3: Started timed_event thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started event_handler thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started host_check thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started comment thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started service_check thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started downtime thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started flapping thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started host_status thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started service_status thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started statechange thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started contact_status thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started acknowledgement thread
[Fri Feb 21 10:36:55 2025] NDO-3: Started notification thread

But, one minute later I got this. Not sure if it's normal or not. Does not look good to me!
[Fri Feb 21 10:36:56 2025] NDO-3: Ended contact_status thread
[Fri Feb 21 10:36:58 2025] NDO-3: Ended host_check thread
[Fri Feb 21 10:36:59 2025] NDO-3: Ended host_status thread
[Fri Feb 21 10:37:22 2025] NDO-3: Ended statechange thread
[Fri Feb 21 10:37:22 2025] NDO-3: Ended acknowledgement thread
[Fri Feb 21 10:37:22 2025] NDO-3: Ended service_check thread
[Fri Feb 21 10:37:22 2025] NDO-3: Ended event_handler thread
[Fri Feb 21 10:37:22 2025] NDO-3: Ended flapping thread
[Fri Feb 21 10:37:22 2025] NDO-3: Ended notification thread
[Fri Feb 21 10:37:23 2025] NDO-3: Ended downtime thread
[Fri Feb 21 10:37:23 2025] NDO-3: Ended comment thread
[Fri Feb 21 10:37:23 2025] NDO-3: Ended timed_event thread
[Fri Feb 21 10:37:31 2025] NDO-3: Ended service_status thread