Page 1 of 1

Nagios XI Database Issue?

Posted: Wed Dec 11, 2019 12:14 pm
by emartine
On our DR server I attempted to do an upgrade via the GUI and completely forgot about it. The following week we noticed the webpage was unavailable and was sporting a database repair message

###############
Database Error
A database connection error has been detected, please follow the repair prompt below. If the issue persists, please contact Nagios support.

Run the following from the CLI as root to attempt to repair the DB:

/usr/local/nagiosxi/scripts/repair_databases.sh
###############

To be clear
Connecting to https://<server> works fine
Connecting to https://<server>/nagiosxi/ shows the error above.

I ran the database repair and it eventually succeeded but the /nagiosxi/ page is still showing the repair database error.

I then attempted to run the upgrade manually and received the following error below... any advice on how to move forward with this?


# sh ./upgrade.sh
Removing the old /tmp/nagiosxi directory, and xi-* tarball
Downloading latest Nagios XI release
--2019-12-11 11:06:22-- https://assets.nagios.com/downloads/nag ... est.tar.gz
Resolving assets.nagios.com... 72.14.181.71, 2600:3c00::f03c:91ff:fedf:b821
Connecting to assets.nagios.com|72.14.181.71|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 64673753 (62M) [application/x-gzip]
Saving to: “/tmp/xi-latest.tar.gz”

100%[=================================================================================>] 64,673,753 41.7M/s in 1.5s

2019-12-11 11:06:23 (41.7 MB/s) - “/tmp/xi-latest.tar.gz” saved [64673753/64673753]

Running upgrade
Nagios XI Upgrade Log
==========================
DATE: Wed Dec 11 11:06:26 CST 2019

DISTRO INFO:
RedHatEnterpriseServer
6.10
x86_64


Archive: sourceguardian/ixed4.lin.x86-64.zip
inflating: /usr/lib64/php/modules/ixed.5.3.lin
Sourceguardian extension found for PHP version 5.3
Sourceguardian extension already in php.ini
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
PHP Warning: pg_pconnect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432? in /tmp/nagiosxi/nagiosxi/basedir/html/db/adodb/drivers/adodb-postgres64.inc.php on line 717
PHP Fatal error: Uncaught exception 'Exception' with message 'A database connection error has been detected, please follow the repair prompt below. If the issue persists, please contact Nagios support.' in /tmp/nagiosxi/nagiosxi/basedir/html/includes/db.inc.php:321
Stack trace:
#0 /tmp/nagiosxi/verify-prereqs.php(0): db_connect('nagiosxi')
#1 /tmp/nagiosxi/verify-prereqs.php(2): sg_load('52C4625F2EA3770...')
#2 {main}
thrown in /tmp/nagiosxi/nagiosxi/basedir/html/includes/db.inc.php on line 321

Re: Nagios XI Database Issue?

Posted: Wed Dec 11, 2019 5:04 pm
by cdienger
The postgres service doesn't appear to be running. Run the following to vacuum and restart it:

Code: Select all

echo "vacuum;vacuum analyze;vacuum full;"|psql nagiosxi postgres

Re: Nagios XI Database Issue?

Posted: Thu Dec 12, 2019 4:20 pm
by emartine
I tried your command but it gave me an error. I looked into postgres running and sure enough it wasn't. I reoboted the box for good measure and sure enough Nagiosxi came up ok. I attempted the upgrade at the command line which was successful I can login and see 5.6.9 at the bottom of the screen but now I get a different error.


Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 491

Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 491

I'll upload a screenshot.

Re: Nagios XI Database Issue?

Posted: Thu Dec 12, 2019 4:21 pm
by emartine
Attached

Re: Nagios XI Database Issue?

Posted: Thu Dec 12, 2019 4:27 pm
by cdienger
The nagiosim component is old and can be removed:

Code: Select all

rm -rf /usr/local/nagiosxi/html/includes/components/nagiosim

Re: Nagios XI Database Issue?

Posted: Fri Dec 13, 2019 5:33 pm
by emartine
Why would that still be there? Did the upgrade fail?

Re: Nagios XI Database Issue?

Posted: Fri Dec 13, 2019 5:44 pm
by cdienger
No, it's just an old component that remains just to cause minor confusion it seems. It's safe to remove and doesn't indicate any sort of real failure.

Re: Nagios XI Database Issue?

Posted: Tue Dec 17, 2019 3:07 pm
by emartine
Thank you. This resolved it on both my test and DR servers. I will schedule the production server update as soon as I can get a window for updates.

Re: Nagios XI Database Issue?

Posted: Tue Dec 17, 2019 3:30 pm
by lmiltchev
@emartine, is it safe to lock this thread and mark it as resolved?