Nagios XI errors [importnagiosql]

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
juki
Posts: 8
Joined: Tue Nov 30, 2010 3:49 am

Nagios XI errors [importnagiosql]

Post by juki »

Hi all,

I'm performing a new installation of Nagios XI on RHEL 5.1 32-bit. All went well till I got to executing the command "./E-importnagiosql". This command returned the following errors shown below. The errors in particular are "DB Connect Error [nagiosxi]: Database connection failed" and "Error: Cannot open config file '/usr/local/nagios/etc/contacttemplates.cfg' for reading: No such file or directory"

Anyone know how I can resolve this?

Thanks,
Juki

Code: Select all

[root@nagiosXI nagiosxi]# ./E-importnagiosql 
Starting httpd: 
/var/tmp/nagiosxi/nagiosxi/basedir/scripts /var/tmp/nagiosxi
        DB Connect Error [nagiosxi]: Database connection failed 
ERROR CONNECTING TO DATABASES!
IMPORTING CONFIG FILES...Array
(
    [0] => nagiosadmin.cfg
)
IMPORTING /usr/local/nagios/etc/import/nagiosadmin.cfg
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosql/admin/import.php --no-check-certificate --post-data 'chbOverwrite=1&selImportFile[]=/usr/local/nagios/etc/import/nagiosadmin.cfg' -O nagiosql.import.monitoring
--10:35:02--  http://localhost/nagiosql/admin/import.php
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [text/html]
Saving to: `nagiosql.import.monitoring'

    [ <=>                                                                                                                 ] 0           --.-K/s   in 0s     

10:35:02 (0.00 B/s) - `nagiosql.import.monitoring' saved [0/0]

SETUID ROOT OK
RESETTING PERMS
        DB Connect Error [nagiosxi]: Database connection failed 
ERROR CONNECTING TO DATABASES!
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosql/admin/verify.php --no-check-certificate --post-data 'writeMonitoring=Go' -O nagiosql.export.monitoring
--10:35:03--  http://localhost/nagiosql/admin/verify.php
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [text/html]
Saving to: `nagiosql.export.monitoring'

    [ <=>                                                                                                                 ] 0           --.-K/s   in 0s     

10:35:03 (0.00 B/s) - `nagiosql.export.monitoring' saved [0/0]

--10:35:03--  http://localhost/nagiosql/admin/verify.php
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [text/html]
Saving to: `nagiosql.export.additional'

    [ <=>                                                                                                                 ] 0           --.-K/s   in 0s     

10:35:03 (0.00 B/s) - `nagiosql.export.additional' saved [0/0]

CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosql/admin/verify.php --no-check-certificate --post-data 'writeAdditional=Go' -O nagiosql.export.additional
OUTPUT: 
Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config directory '/usr/local/nagios/etc/static'...
Processing object config file '/usr/local/nagios/etc/static/xiobjects.cfg'...
Processing object config file '/usr/local/nagios/etc/static/xitest.cfg'...
Processing object config file '/usr/local/nagios/etc/static/xitemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/contacttemplates.cfg'...
Error: Cannot open config file '/usr/local/nagios/etc/contacttemplates.cfg' for reading: No such file or directory
   Error processing object config files!


***> One or more problems was encountered while processing the config files...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.
RET: 254
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors /var/tmp/nagiosxi/nagiosxi/basedir/scripts
tar: Removing leading `/' from member names
/var/tmp/nagiosxi/nagiosxi/basedir/scripts
ls: /usr/local/nagiosxi/nom/checkpoints/nagioscore/*.gz: No such file or directory
NO NOM SNAPSHOT FOUND!
/var/tmp/nagiosxi
Nikel
Posts: 16
Joined: Wed Dec 01, 2010 10:59 am

Re: Nagios XI errors [importnagiosql]

Post by Nikel »

Hey juki,

see the topic: Nagios XI installation problems

It's the same problem
juki
Posts: 8
Joined: Tue Nov 30, 2010 3:49 am

Re: Nagios XI errors [importnagiosql]

Post by juki »

Hi Nikel,

Thanks for the pointer. I have looked through the previous posts but my problem seems to be a little different. These are the contents of;

[root@nagios ~]# ls -l /usr/local/nagios/etc/
total 68
-rwxrwxr-x 1 apache nagios 744 Dec 2 10:13 cgi.cfg
drwsrwsr-x 2 apache nagios 4096 Dec 2 10:13 hosts
drwsrwsr-x 2 apache nagios 4096 Dec 2 11:31 import
-rwxrwxr-x 1 apache nagios 5714 Dec 2 10:13 nagios.cfg
-rwxrwxr-x 1 apache nagios 2229 Dec 2 10:13 ndo2db.cfg
-rwxrwxr-x 1 apache nagios 4723 Dec 2 10:13 ndomod.cfg
-rw-rw-r-- 1 apache nagios 7207 Dec 2 10:14 nrpe.cfg
-rwxrwxr-x 1 apache nagios 5345 Dec 2 10:14 nsca.cfg
-rwxrwxr-x 1 apache nagios 3417 Dec 2 10:14 pnp
-rwxrwxr-x 1 apache nagios 210 Dec 2 10:13 resource.cfg
-rwxrwxr-x 1 apache nagios 1627 Dec 2 10:14 send_nsca.cfg
drwsrwsr-x 2 apache nagios 4096 Dec 2 10:13 services
drwsrwsr-x 2 apache nagios 4096 Dec 2 10:13 static

As you can see, I do not have contacttemplates.cfg, contacts.cfg, contactgroups.cfg files. This is quite baffling since it is a fresh installation.

Any ideas?
Nikel
Posts: 16
Joined: Wed Dec 01, 2010 10:59 am

Re: Nagios XI errors [importnagiosql]

Post by Nikel »

sry, but i'm a noob :)
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Nagios XI errors [importnagiosql]

Post by tonyyarusso »

Does this command work?

Code: Select all

psql template1 postgres
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
juki
Posts: 8
Joined: Tue Nov 30, 2010 3:49 am

Re: Nagios XI errors [importnagiosql]

Post by juki »

Hello Tony,

Yes, it does with the following output;

[root@nagios ~]# psql template1 postgres
Welcome to psql 8.1.9, 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

template1=#


Any further leads?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Nagios XI errors [importnagiosql]

Post by mguthrie »

During the "E" installer script, NagiosQL imports the default config files into the database, and then writes out the configuration files from the database. Can you verify that myql installed correctly and that the password for the mysql root user is nagiosxi?

Try
service mysqld restart

And then see if you can login as root: (password nagiosxi at prompt):
mysql -u root -p
juki
Posts: 8
Joined: Tue Nov 30, 2010 3:49 am

Re: Nagios XI errors [importnagiosql]

Post by juki »

Hello Guthrie,

The output as below;

[root@nagiosXI ~]# service mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[root@nagiosXI ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22

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

mysql>

So yes, it seems mysql is installed and works just fine with the default password too! But still comes up with the same errors as indicated in my initial post.
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Nagios XI errors [importnagiosql]

Post by tonyyarusso »

Back in the psql prompt, once you get to that stage try issuing \l (that's an L, as in list). Do you get something like this, with 'nagiosxi' listed?

Code: Select all

template1=# \l
        List of databases
   Name    |  Owner   | Encoding 
-----------+----------+----------
 nagiosxi  | nagiosxi | UTF8
 postgres  | postgres | UTF8
 template0 | postgres | UTF8
 template1 | postgres | UTF8
(4 rows)

template1=# 
If that works right, exit back to the root shell prompt, and try getting into postgres with the nagios user's permissions:

Code: Select all

[root@demo ~]# su nagios -c "psql nagiosxi nagiosxi"
could not change directory to "/root"
Welcome to psql 8.1.22, 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=> \dt
            List of relations
 Schema |    Name     | Type  |  Owner   
--------+-------------+-------+----------
 public | xi_commands | table | nagiosxi
 public | xi_events   | table | nagiosxi
 public | xi_meta     | table | nagiosxi
 public | xi_options  | table | nagiosxi
 public | xi_sysstat  | table | nagiosxi
 public | xi_usermeta | table | nagiosxi
 public | xi_users    | table | nagiosxi
(7 rows)

nagiosxi=>
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
juki
Posts: 8
Joined: Tue Nov 30, 2010 3:49 am

Re: Nagios XI errors [importnagiosql]

Post by juki »

Hi Tony,

Many thanks for your reply. I have run the respective commands and output is as follows;

Code: Select all

[root@nagios nagiosxi]# psql template1 postgres
Welcome to psql 8.1.9, 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

template1=# \l
        List of databases
   Name    |  Owner   | Encoding
-----------+----------+----------
 nagiosxi  | nagiosxi | UTF8
 postgres  | postgres | UTF8
 template0 | postgres | UTF8
 template1 | postgres | UTF8
(4 rows)

template1=# \q


[root@nagios nagiosxi]# su nagios -c "psql nagiosxi nagiosxi"
Welcome to psql 8.1.9, 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=> \dt
            List of relations
 Schema |    Name     | Type  |  Owner
--------+-------------+-------+----------
 public | xi_commands | table | nagiosxi
 public | xi_events   | table | nagiosxi
 public | xi_meta     | table | nagiosxi
 public | xi_options  | table | nagiosxi
 public | xi_sysstat  | table | nagiosxi
 public | xi_usermeta | table | nagiosxi
 public | xi_users    | table | nagiosxi
(7 rows)

nagiosxi=>

As seen from the above, all looks good as per the queries since they match your examples.

So I still don't know what could be wrong here....
Locked