Nagios XI Database Issue?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Nagios XI Database Issue?

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Nagios XI Database Issue?

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Database Issue?

Post 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.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Database Issue?

Post by emartine »

Attached
You do not have the required permissions to view the files attached to this post.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Nagios XI Database Issue?

Post by cdienger »

The nagiosim component is old and can be removed:

Code: Select all

rm -rf /usr/local/nagiosxi/html/includes/components/nagiosim
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Database Issue?

Post by emartine »

Why would that still be there? Did the upgrade fail?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Nagios XI Database Issue?

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Nagios XI Database Issue?

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios XI Database Issue?

Post by lmiltchev »

@emartine, is it safe to lock this thread and mark it as resolved?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked