nagiosxi SQL constraint error after upgrade to 5.3.1

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mhixson2
Posts: 96
Joined: Wed Jun 24, 2015 3:02 pm

nagiosxi SQL constraint error after upgrade to 5.3.1

Post by mhixson2 »

As the subject states, I'm receiving the error below when trying to save changes to a user's config. It might happen elsewhere too, but this is the only one I've noticed since our upgrade to 5.3.1 yesterday. Out of the 5 boxes I upgraded, only one is throwing this error. I ran the repair_databases.sh script to see if that would help, but it did not. The upgrade procedure was just as outlined in your manual upgrade nagios xi doc: download the latest xi tarball, extract, run the upgrade script.

Have you guys seen this before? I'm not a database guy, so I am definitely not poking around in there by myself. Help is appreciated. Full error text below.

Code: Select all

SQL: SQL Error [nagiosxi] : ERROR: duplicate key value violates unique constraint "xi_usermeta_pkey" SQL: SQL Error [nagiosxi] : ERROR: duplicate key value violates unique constraint "xi_usermeta_pkey" SQL: SQL Error [nagiosxi] : ERROR: duplicate key value violates unique constraint "xi_usermeta_pkey"
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: nagiosxi SQL constraint error after upgrade to 5.3.1

Post by avandemore »

In the directory you ran the upgrade from there should be a file called upgrade.log. Can you upload that please?
Previous Nagios employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: nagiosxi SQL constraint error after upgrade to 5.3.1

Post by lmiltchev »

mhixson2, you can try the following - open "/usr/local/nagiosxi/tools/fix_postgres_sequences.sh" in a text editor, change the shebang from:

Code: Select all

#!/bin/sh
to:

Code: Select all

#!/bin/bash
and this (around line 6):

Code: Select all

php $BASEDIR/import_xiconfig.php > $BASEDIR/config.dat
to this:

Code: Select all

php $BASEDIR/../scripts/import_xiconfig.php > $BASEDIR/config.dat
Run the script:

Code: Select all

cd /usr/local/nagiosxi/tools
./fix_postgres_sequences.sh
Let us know if this helped.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mhixson2
Posts: 96
Joined: Wed Jun 24, 2015 3:02 pm

Re: nagiosxi SQL constraint error after upgrade to 5.3.1

Post by mhixson2 »

Thanks! I'll get back to you in a day or two with the file and an update on whether that worked.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: nagiosxi SQL constraint error after upgrade to 5.3.1

Post by tgriep »

Thanks, keep us in the loop.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mhixson2
Posts: 96
Joined: Wed Jun 24, 2015 3:02 pm

Re: nagiosxi SQL constraint error after upgrade to 5.3.1

Post by mhixson2 »

Very strange... I tried reproducing this issue to confirm I had the correct Nagios box, and to my surprise I cannot duplicate it on any of my servers. I was having issues with API calls being refused as well, which I reported elsewhere, and that too has magically fixed itself. I made no changes aside from monitoring configurations. So weird. Any theories on how something like this could just fix itself? Are there any maintenance or health jobs that run on a schedule that could have helped this?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: nagiosxi SQL constraint error after upgrade to 5.3.1

Post by avandemore »

There are a number of maintenance scripts which run periodically but to the best of my knowledge none of them could account for your observations.
Previous Nagios employee
mhixson2
Posts: 96
Joined: Wed Jun 24, 2015 3:02 pm

Re: nagiosxi SQL constraint error after upgrade to 5.3.1

Post by mhixson2 »

Issue hasn't returned. I guess this is good to be locked.
Thanks for your help.
Locked