Duplicate column name 'api_key' on 5.3.0 upgrade

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
shouloun
Posts: 4
Joined: Thu Sep 22, 2016 3:00 pm

Duplicate column name 'api_key' on 5.3.0 upgrade

Post 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
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Post 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)
/Luke
shouloun
Posts: 4
Joined: Thu Sep 22, 2016 3:00 pm

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Post 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;
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
shouloun
Posts: 4
Joined: Thu Sep 22, 2016 3:00 pm

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Post 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.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Post by dwhitfield »

It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!
shouloun
Posts: 4
Joined: Thu Sep 22, 2016 3:00 pm

Re: Duplicate column name 'api_key' on 5.3.0 upgrade

Post by shouloun »

Sure, please close this thread. Thank you.
Locked