DB Connect Error [nagiosxi]: Database connection failed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
gaurav
Posts: 2
Joined: Wed Oct 13, 2010 7:53 am

DB Connect Error [nagiosxi]: Database connection failed

Post by gaurav »

Hi

I have just installed the trail version of NagiosXI.
After installation, I am getting the initial webpage in IE where I click on "Access Nagios XI " and once I click this, the next page that I see is: "DB Connect Error [nagiosxi]: Database connection failed ".

I know that this points to the fact that Nagios XI is not able to connect to the DB.
But I am fairly new to Nagios and do not know much troubleshooting.
May someone please help me resolve this issue.

OS: Cent

Thanks
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by mguthrie »

This is an error we were seeing with 64bit manual installs, but as far as I knew we had made the changes in our install scripts to fix this issue.

Is this on a manual install, and is it 64 or 32 bit?

Which version of XI is it?



I'd check to see if both postgresql and mysql are up and running. Try these two commands and see what you get for output.

Code: Select all

[root@localhost ~]# service mysqld restart
Stopping MySQL:                                            [  OK  ]
Starting MySQL:                                            [  OK  ]
[root@localhost ~]# service postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]
[root@localhost ~]#
gaurav
Posts: 2
Joined: Wed Oct 13, 2010 7:53 am

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by gaurav »

[root ~]# uname -a
Linux local 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686 i686 i386 GNU/Linux
[root ~]# uname -m
i686
[root~]# file /usr/bin/file
/usr/bin/file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

[root ~]# service mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[root@ ~]# service postgresql restart
Stopping postgresql service: [ OK ]
Starting postgresql service: [ OK ]
[root@ ~]#

I downlaoded the NagiosXI: xi-2009r1.3e.tar.gz
I am following the manual install document of NAgios XI.
The OS is 32bit.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: DB Connect Error [nagiosxi]: Database connection failed

Post by mguthrie »

Hmm.... Did you by chance set up the root user account for MySQL or Postgres before running the XI install? This would mess up the creation of the nagios DB user. Did you do any kind of system configurations before running your install, or was it right after a clean install?

Let's check to see if the DB users were setup correctly.

Mysql:

mysql -u nagios -> checking login ability for mysql
psql nagiosxi nagiosxi -> checking login ability for postgres

Here's what the output should look like.

Code: Select all

[root@localhost ~]# mysql -u nagios
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 45848
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.02 sec)

mysql> exit

[root@localhost ~]# psql nagiosxi nagiosxi
Welcome to psql 8.1.21, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

nagiosxi=> \d
                     List of relations
 Schema |            Name             |   Type   |  Owner
--------+-----------------------------+----------+----------
 public | if_command_id_seq           | sequence | nagiosxi
 public | if_meta_id_seq              | sequence | nagiosxi
 public | if_option_id_seq            | sequence | nagiosxi
 public | if_sysstat_id_seq           | sequence | nagiosxi
 public | if_user_id_seq              | sequence | nagiosxi
 public | if_usermeta_id_seq          | sequence | nagiosxi
 public | xi_commands                 | table    | nagiosxi
 public | xi_commands_command_id_seq  | sequence | nagiosxi
 public | xi_events                   | table    | nagiosxi
 public | xi_events_event_id_seq      | sequence | nagiosxi
 public | xi_meta                     | table    | nagiosxi
 public | xi_meta_meta_id_seq         | sequence | nagiosxi
 public | xi_options                  | table    | nagiosxi
 public | xi_options_option_id_seq    | sequence | nagiosxi
 public | xi_sysstat                  | table    | nagiosxi
 public | xi_sysstat_sysstat_id_seq   | sequence | nagiosxi
 public | xi_usermeta                 | table    | nagiosxi
 public | xi_usermeta_usermeta_id_seq | sequence | nagiosxi
 public | xi_users                    | table    | nagiosxi
 public | xi_users_user_id_seq        | sequence | nagiosxi
(20 rows)

nagiosxi=>

Locked