Bug in restore_xi.sh

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
jpm
Posts: 1
Joined: Thu Sep 10, 2020 11:34 am

Bug in restore_xi.sh

Post by jpm »

I am currently working on migrating from a CentOS 6 server to a new CentOS 7. When I run the restore_xi.sh script on the new server, get the error "/usr/local/nagiosxi/scripts/restore_xi.sh: line 388: DROP TABLE IF ExiSTS nagiosxi;: No such file or directory", due to an incorrect line in the script. This only matters if you're using a postgresql database, which we are. The offending line reads: mysql -h "$nagiosql_dbserver" --port="$nagiosql_dbport" -u root --password=$mysqlpass < "DROP TABLE IF ExiSTS nagiosxi;" which is looking for a file named "DROP TABLE IF ExiSTS nagiosxi;" (and incorrectly references table nagiosxi instead of database nagiosxi). The line should read

Code: Select all

mysql -h "$nagiosql_dbserver" --port="$nagiosql_dbport" -u root --password=$mysqlpass <<< "DROP DATABASE IF ExiSTS nagiosxi;"
or

Code: Select all

echo "DROP DATABASE IF ExiSTS nagiosxi;" | mysql -h "$nagiosql_dbserver" --port="$nagiosql_dbport" -u root --password=$mysqlpass
The backup restored correctly other than that, but it did cause some confusion when attempting to migrate the postgresql DB over to mariadb, since the nagiosxi database wasn't deleted properly during the restore. Just wanted to make sure the team was aware
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Bug in restore_xi.sh

Post by dchurch »

Thank you. This is a very old bug you have found, dating back to 2015.

I've got a patch submitted. To anyone having issues with this, the above solution should work for workarounds.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.