Page 1 of 1

Duplicate column name 'api_key' on 5.3.0 upgrade

Posted: Wed Oct 05, 2016 10:19 am
by shouloun
We installed the Nagios XI 5.2.9 manually on a new VM with Red Hat Enterprise Linux Server release 7.2 and it was working OK.
We saw the new package 5.3.0 & tried to upgrade it, but the error below occurred at the end:
......
Done!
Dashlets installed/updated OK
ERROR 1060 (42S21) at line 5: Duplicate column name 'api_key'

The web UI is still working and stating that we are still at v5.2.9. I have no idea where to start to fix it.

Thanks,

Steve Ho

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Posted: Wed Oct 05, 2016 1:50 pm
by lgroschen
Did you by chance upgrade more than once or was this the first shot at an upgrade?

It looks like the database part of the upgrade threw the error. I would bet in the upgrade script between 809 and 825 somewhere where the nagiosql or mysql schema updates are being applied. (eg: nagiosxi/nagiosxi-db/mods/mysql/schema_01.sql) Did you change the database at all by chance?

Also if you could, please attach your install.log so we can take a peek. (redacted for privacy)

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Posted: Wed Oct 05, 2016 2:39 pm
by shouloun
First, thanks for the quick reply to my post.

The first time I ran the upgrade, the error below occurred:
Dashlets installed/updated OK
Attempting to read global hard/soft nofile limits failed. Check /etc/security/limits.conf and try again!

Our Unix admin helped to modified the /etc/security/limits.conf and I tried again. This time it pass the previous error, I got the api_key error. Then, I tried again from the Web console & got the same error.

I'm new to Nagios, so let me know where to find the install.log. Plus, in the
/tmp/nagiosxi/nagiosxi/nagiosxi-db/mods/mysql/schema_01.sql, the only line I can find with the "api_key" is the line below:
ALTER TABLE xi_users ADD COLUMN api_key varchar(128) NULL;

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Posted: Wed Oct 05, 2016 3:04 pm
by jomann
It looks like, according to the first error you posted, you've already made it past the MySQL additions - meaning you've already applied those upgrades. You can comment out lines 820-828 in the upgrade script and then re-run the upgrade. If you still have problems with limits, you can comment out that portion of the upgrade also on line 834. The limit changes are not required for your upgrade to be successful.

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Posted: Wed Oct 05, 2016 3:42 pm
by shouloun
Jomann,

Your recommendation is right on the spot. I comment out the line 820-828 and 834, then run the upgrade again. It worked with 2 warnings:
Total Warnings: 2
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check
RET: 0
Warning: nagios.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Fixing php-mcrypt bug...
PHP Notice: Use of undefined constant CURL_SSLVERSION_TLSv1_2 - assumed 'CURL_SSLVERSION_TLSv1_2' in /usr/local/nagiosxi/html/includes/utilsx.inc.php on line 180

Nagios XI Upgrade Complete!

After that, I also ran the 'systemctl daemon-reload' to reload units.

Thank you both for the great support today.

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Posted: Wed Oct 05, 2016 3:57 pm
by dwhitfield
It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Posted: Thu Oct 06, 2016 2:02 pm
by shouloun
Sure, please close this thread. Thank you.