Using reconfigure_nagios.sh does not add hosts to nagios

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
fe9817
Posts: 12
Joined: Mon Jun 27, 2016 6:55 am

Using reconfigure_nagios.sh does not add hosts to nagios

Post by fe9817 »

Im having a problem using the automated host management in Nagios XI together with puppet, I have followed this guide: https://assets.nagios.com/downloads/nag ... gement.pdf on a new installion of Nagios XI.

Code: Select all

System:
Nagios XI Version : 5.2.9
nagiosxi.example.com 3.10.0-327.22.2.el7.x86_64 x86_64
CentOS Linux release 7.2.1511 (Core)
Gnome is not installed
I have reinstalled the server a couple of times, and sometime the import works at the beginning, but it will eventually start failing. It fails without any error or warnings, the hosts just don't show up in CCM. I have also looked in the database and the hosts isn't configure there either.

Running './reconfigure_nagios.sh' from the command line:

Code: Select all

./reconfigure_nagios.sh

URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&username=nagiosxi&password=n@gweb' -O nagiosql.login--2016-07-13 14:03:35--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘nagiosql.login’

    [ <=>                                                                                                                                                                                                                                                                                                       ] 35,560      --.-K/s   in 0.01s   

2016-07-13 14:03:35 (2.68 MB/s) - ‘nagiosql.login’ saved [35560]

LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: http://localhost/nagiosxi/includes/components/ccm/
Array
(
    [0] => test01.example.com.cfg
    [1] => test02.example.com.cfg
)
IMPORTING /usr/local/nagios/etc/import/test01.example.com.cfg
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'cmd=admin&type=import&importsubmitted=true&chbOverwrite=1&subForm=Import&selImportFile[]=/usr/local/nagios/etc/import/test01.example.com.cfg' -O nagiosql.import.monitoring
--2016-07-13 14:03:35--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘nagiosql.import.monitoring’

    [ <=>                                                                                                                                                                                                                                                                                                       ] 16,950       106KB/s   in 0.2s   

2016-07-13 14:03:36 (106 KB/s) - ‘nagiosql.import.monitoring’ saved [16950]

IMPORTING /usr/local/nagios/etc/import/test02.example.com.cfg
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'cmd=admin&type=import&importsubmitted=true&chbOverwrite=1&subForm=Import&selImportFile[]=/usr/local/nagios/etc/import/test02.example.com.cfg' -O nagiosql.import.monitoring
--2016-07-13 14:03:36--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘nagiosql.import.monitoring’

    [ <=>                                                                                                                                                                                                                                                                                                       ] 16,816       104KB/s   in 0.2s   

2016-07-13 14:03:36 (104 KB/s) - ‘nagiosql.import.monitoring’ saved [16816]

RESETTING PERMS
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&username=nagiosxi&password=n@gweb' -O nagiosql.login--2016-07-13 14:03:36--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘nagiosql.login’

    [ <=>                                                                                                                                                                                                                                                                                                       ] 35,560      --.-K/s   in 0.01s   

2016-07-13 14:03:36 (2.74 MB/s) - ‘nagiosql.login’ saved [35560]

LOGIN SUCCESSFUL!
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'cmd=apply&type=writeConfig' -O nagiosql.export.monitoring
--2016-07-13 14:03:37--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘nagiosql.export.monitoring’

    [  <=>                                                                                                                                                                                                                                                                                                      ] 15,149      59.9KB/s   in 0.2s   

2016-07-13 14:03:37 (59.9 KB/s) - ‘nagiosql.export.monitoring’ saved [15149]

WRITE CONFIGS SUCCESSFUL!
OUTPUT: 
Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
	Checked 12 services.
	Checked 1 hosts.
	Checked 2 host groups.
	Checked 0 service groups.
	Checked 2 contacts.
	Checked 2 contact groups.
	Checked 124 commands.
	Checked 8 time periods.
	Checked 0 host escalations.
	Checked 0 service escalations.
Checking for circular paths...
	Checked 1 hosts
	Checked 0 service dependencies
	Checked 0 host dependencies
	Checked 8 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
RET: 0
fe9817
Posts: 12
Joined: Mon Jun 27, 2016 6:55 am

Re: Using reconfigure_nagios.sh does not add hosts to nagio

Post by fe9817 »

Solved my own problem, it turns out that it is needed to run /usr/local/nagiosxi/tools/xiprepimport.php before running ./reconfigure_nagios.sh.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Using reconfigure_nagios.sh does not add hosts to nagio

Post by mcapra »

For the benefit of those reading in the future, xiprepimport.php helps tidy up a given configuration file.

Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
fe9817
Posts: 12
Joined: Mon Jun 27, 2016 6:55 am

Re: Using reconfigure_nagios.sh does not add hosts to nagio

Post by fe9817 »

Yes, please lock the issue. It might also be an idea to update the document about automated host management.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Using reconfigure_nagios.sh does not add hosts to nagio

Post by mcapra »

We're actually in the process of reviewing several of our internal documents. I'll add this one to the list :)
Former Nagios employee
https://www.mcapra.com/
Locked