Upgrading XI from 5.9.3 to 5.10.0

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
User avatar
JohnFLi
Posts: 511
Joined: Mon Jun 17, 2013 3:11 pm

Upgrading XI from 5.9.3 to 5.10.0

Post by JohnFLi »

i figured a normal upgrade of Nagios XI
Followed the manual upgrade https://assets.nagios.com/downloads/nag ... ctions.pdf

zero issue
Nagios XI Upgrade Complete!
---------------------------

You can access the Nagios XI web interface by visiting:
Nagios Core looks fine
Nagios XI, tells me:
Notice: Your Nagios XI server is configured to use PostgreSQL, which is deprecated. Please use /usr/local/nagiosxi/scripts/pg2mysql/convert_nagiosxi_to_mysql.php or reach out to the Support Team for migration assistance.
I run the script stated

Code: Select all

[root@g1vpnag03 nagiosxi]# /usr/local/nagiosxi/scripts/pg2mysql/convert_nagiosxi_to_mysql.php
Dumping to nagiosxi.psql...
Done!
Creating /usr/local/nagiosxi/scripts/pg2mysql/nagiosxi.mysql...
Filesize: 3.0M


Completed!      5807 lines          29 sql chunks

Done!
Creating Nagios XI database...
ERROR 1007 (HY000) at line 4: Can't create database 'nagiosxi'; database exists
PHP Notice:  Array to string conversion in /usr/local/nagiosxi/scripts/pg2mysql/convert_nagiosxi_to_mysql.php on line 41
Array failed!
[root@g1vpnag03 nagiosxi]#



any thoughts?
Everybody is somebody else’s weirdo
muktadey
Posts: 4
Joined: Tue Mar 08, 2022 10:57 am

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by muktadey »

I am facing same issue. I need help as well.
rpike
Posts: 10
Joined: Mon Apr 20, 2015 12:17 pm

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by rpike »

Same issue here.

It looks like the nagiosxi database already exists in MySQL - possibly from an earlier upgrade.
Maybe the generated nagiosxi_create_db.sql script needs to change

Code: Select all

CREATE DATABASE `nagiosxi`;
to:

Code: Select all

CREATE DATABASE IF NOT EXISTS `nagiosxi`;
rpike
Posts: 10
Joined: Mon Apr 20, 2015 12:17 pm

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by rpike »

I think I got mine to work by dropping the already existing MySQL nagiosxi database and user and then running the convert script.

1. Backup whatever is already in MySQL nagiosxi database that is going to be replaced
mysqldump -uroot -ppassword nagiosxi > nagiosxi_schema-$(date +%Y%m%d_%H%M).dmp
2. Stop nagios
systemctl stop nagios.service
3. Drop existing MySQL nagiosxi schema
MariaDB> drop schema nagiosxi;
4. Drop MySQL nagiosxi user
MariaDB> drop user nagiosxi@localhost;
5. Now run the conversion script
./convert_nagiosxi_to_mysql.php
./convert_nagiosxi_to_mysql.php
Dumping to nagiosxi.psql...
Done!
Creating /usr/local/nagiosxi/scripts/pg2mysql/nagiosxi.mysql...
Filesize: 612.5K


Completed! 3163 lines 29 sql chunks

Done!
Creating Nagios XI database...
Done!
Importing PostgreSQL data to MySQL...
Done!
Creating 'nagiosxi' user in MySQL...
Done!
Modifying config.inc.php to use mysql...
Done!
Disabling PostgreSQL, restarting MySQL...Redirecting to /bin/systemctl restart mysqld.service
Failed to restart mysqld.service: Unit not found.
Redirecting to /bin/systemctl stop postgresql.service
Note: Forwarding request to 'systemctl disable postgresql.service'.
Removed symlink /etc/systemd/system/multi-user.target.wants/postgresql.service.
Done!

========
FINISHED
========

All of our migration commands succeeded without any issues.
PostgreSQL is disabled, and MySQL is enabled.
Please try to log into your Nagios XI interface and confirm that it's working.
If you succeed, please reboot this server and verify that the web interface is working after.

If you run into issues, you will need to run the following commands:

mv /usr/local/nagiosxi/html/config.inc.php.backup /usr/local/nagiosxi/html/config.inc.php
chkconfig postgresql on || systemctl enable postgresql
service postgresql start || systemctl start postgresql

If you did roll back, you'll also need to get into contact with the Nagios XI Support team.
In your ticket, please include a zip of this directory:
muktadey
Posts: 4
Joined: Tue Mar 08, 2022 10:57 am

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by muktadey »

Hi, We recently launched new appliance and migrate data from old NagiosXI to New NagiosXI.
After migration I am receiving this notice: Notice: Your Nagios XI server is configured to use PostgreSQL, which is deprecated. Please use /usr/local/nagiosxi/scripts/pg2mysql/convert_nagiosxi_to_mysql.php or reach out to the Support Team for migration assistance.

So, I followed this document: https://support.nagios.com/kb/article/c ... i-560.html

Once I run this cmd I am receiving those errors: mysql -uroot -pnagiosxi nagiosxi --max_allowed_packet=512M --force < nagiosxi.mysql

Would you please suggest me any other solution then can migrate our current database to mysql?

mysql -uroot -pnagiosxi nagiosxi --max_allowed _packet=512M --force < nagiosxi.mysql
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1146 (42S02) at line 8: Table 'nagiosxi.public.xi_auditlog' doesn't exist
ERROR 1146 (42S02) at line 337: Table 'nagiosxi.public.xi_auth_tokens' doesn't e xist
ERROR 1146 (42S02) at line 399: Table 'nagiosxi.public.xi_cmp_nagiosbpi_backups' doesn't exist
ERROR 1146 (42S02) at line 402: Table 'nagiosxi.public.xi_commands' doesn't exis t
ERROR 1146 (42S02) at line 449: Table 'nagiosxi.public.xi_events' doesn't exist
ERROR 1146 (42S02) at line 1450: Table 'nagiosxi.public.xi_events' doesn't exist
ERROR 1146 (42S02) at line 2451: Table 'nagiosxi.public.xi_events' doesn't exist
ERROR 1146 (42S02) at line 2670: Table 'nagiosxi.public.xi_meta' doesn't exist
ERROR 1146 (42S02) at line 3671: Table 'nagiosxi.public.xi_meta' doesn't exist
ERROR 1146 (42S02) at line 4672: Table 'nagiosxi.public.xi_meta' doesn't exist
ERROR 1146 (42S02) at line 4939: Table 'nagiosxi.public.xi_mibs' doesn't exist
ERROR 1146 (42S02) at line 5008: Table 'nagiosxi.public.xi_options' doesn't exis t
ERROR 1146 (42S02) at line 5086: Table 'nagiosxi.public.xi_sysstat' doesn't exis t
ERROR 1146 (42S02) at line 5105: Table 'nagiosxi.public.xi_usermeta' doesn't exi st
ERROR 1146 (42S02) at line 5236: Table 'nagiosxi.public.xi_users' doesn't exist
Misa9x
Posts: 2
Joined: Sun May 28, 2023 10:41 pm

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by Misa9x »

JohnFLi wrote: Wed May 17, 2023 8:52 am i figured a normal upgrade of Nagios XI
Followed the manual upgrade https://assets.nagios.com/downloads/nag ... ctions.pdf bitlife

zero issue
Nagios XI Upgrade Complete!
---------------------------

You can access the Nagios XI web interface by visiting:
Nagios Core looks fine
Nagios XI, tells me:
Notice: Your Nagios XI server is configured to use PostgreSQL, which is deprecated. Please use /usr/local/nagiosxi/scripts/pg2mysql/convert_nagiosxi_to_mysql.php or reach out to the Support Team for migration assistance.
I run the script stated

Code: Select all

[root@g1vpnag03 nagiosxi]# /usr/local/nagiosxi/scripts/pg2mysql/convert_nagiosxi_to_mysql.php
Dumping to nagiosxi.psql...
Done!
Creating /usr/local/nagiosxi/scripts/pg2mysql/nagiosxi.mysql...
Filesize: 3.0M


Completed!      5807 lines          29 sql chunks

Done!
Creating Nagios XI database...
ERROR 1007 (HY000) at line 4: Can't create database 'nagiosxi'; database exists
PHP Notice:  Array to string conversion in /usr/local/nagiosxi/scripts/pg2mysql/convert_nagiosxi_to_mysql.php on line 41
Array failed!
[root@g1vpnag03 nagiosxi]#



any thoughts?
Confirm whether the 'nagiosxi' database already exists in your MySQL server. You can use a MySQL client such as the command-line tool or a GUI application to connect to your MySQL server and check the list of databases. If the 'nagiosxi' database exists, you may need to remove it before running the conversion script again. However, exercise caution as removing the existing database will result in data loss.
User avatar
JohnFLi
Posts: 511
Joined: Mon Jun 17, 2013 3:11 pm

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by JohnFLi »

I've been away from teh office for awhile.....

I think I will give rPikes solution an option and see what happens.
I have nagios on vmware, so taking a snapshot and restore only takes a few min if bad things happen
Everybody is somebody else’s weirdo
User avatar
JohnFLi
Posts: 511
Joined: Mon Jun 17, 2013 3:11 pm

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by JohnFLi »

I tried some suggestions here, and it didn't pan out.

It appears I was still on teh postgress DB.

here is what I did:

1> https://support.nagios.com/kb/article/c ... i-560.html
2> did normal manual upgrade https://assets.nagios.com/downloads/nag ... ctions.pdf

after that, rebooting and it no longer says I need to upgrade the database and i'm now at 5.10
Everybody is somebody else’s weirdo
muktadey
Posts: 4
Joined: Tue Mar 08, 2022 10:57 am

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by muktadey »

Hello,

I tried all of the solution that suggested.
I need assistance to migrate PostgreSQL To Mysql.
User avatar
JohnFLi
Posts: 511
Joined: Mon Jun 17, 2013 3:11 pm

Re: Upgrading XI from 5.9.3 to 5.10.0

Post by JohnFLi »

Not going to lie....I blindly followed https://support.nagios.com/kb/article/c ... i-560.html (due to having a snapshot so the only thing at risk was my time)

One thing I did run into
Set MySQL User Permissions
These two commands will create the user called nagiosxi with the password of n@gweb (the default password for an XI install) and apply the permissions. Execute the following commands:

mysql -u root -pnagiosxi -e "CREATE USER 'nagiosxi'@'localhost' IDENTIFIED BY 'n@gweb';"
mysql -u root -pnagiosxi -e "GRANT ALL ON nagiosxi.* TO 'nagiosxi'@'localhost'; FLUSH PRIVILEGES;"
I got an error on the first line due to that account already existed..... I just did the next line and it worked well so I continued that steps
Everybody is somebody else’s weirdo
Post Reply