Page 1 of 1
nagiosxi SQL constraint error after upgrade to 5.3.1
Posted: Tue Nov 01, 2016 12:54 pm
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"
Re: nagiosxi SQL constraint error after upgrade to 5.3.1
Posted: Tue Nov 01, 2016 4:34 pm
by avandemore
In the directory you ran the upgrade from there should be a file called upgrade.log. Can you upload that please?
Re: nagiosxi SQL constraint error after upgrade to 5.3.1
Posted: Tue Nov 01, 2016 4:51 pm
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:
to:
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.
Re: nagiosxi SQL constraint error after upgrade to 5.3.1
Posted: Wed Nov 02, 2016 1:28 pm
by mhixson2
Thanks! I'll get back to you in a day or two with the file and an update on whether that worked.
Re: nagiosxi SQL constraint error after upgrade to 5.3.1
Posted: Wed Nov 02, 2016 1:32 pm
by tgriep
Thanks, keep us in the loop.
Re: nagiosxi SQL constraint error after upgrade to 5.3.1
Posted: Tue Nov 08, 2016 11:23 am
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?
Re: nagiosxi SQL constraint error after upgrade to 5.3.1
Posted: Tue Nov 08, 2016 11:45 am
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.
Re: nagiosxi SQL constraint error after upgrade to 5.3.1
Posted: Thu Nov 10, 2016 10:38 am
by mhixson2
Issue hasn't returned. I guess this is good to be locked.
Thanks for your help.