Apply Configuration not finishing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Apply Configuration not finishing

Post by WillemDH »

Hello,

After installing Nagios XI latest on a relatively fresh installation (but with mariadb and apache and some other customizations pre-installed) I'm able to install successfully, but it seem it's not possible to apply a configuration from the gui.

Gone through:
https://support.nagios.com/kb/article.php?id=144
https://support.nagios.com/kb/article.php?id=532
https://support.nagios.com/kb/article.php?id=34

cat /etc/hosts has a localhost entry:

Code: Select all

cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
139.162.156.198 m02.outsideit.net
Now after some troubleshooting it seem that cmdsubsys.log is never created during the apply configuration. Seem like a sudo issue, so I checked visudo and all entries seem the same as on my production server.

Code: Select all

#includedir /etc/sudoers.d

Defaults   !visiblepw
Defaults    always_set_home
Defaults    env_reset
Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"
Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

root                            ALL=(ALL)       ALL
%wheel                          ALL=(ALL)       ALL

Defaults                        requiretty
Defaults:apache                 !requiretty
Defaults:nagios                 !requiretty

User_Alias                      NAGIOSXI=nagios
User_Alias                      NAGIOSXIWEB=apache

NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios checkconfig
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd status
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/html/includes/components/profile/getprofile.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/upgrade_to_latest.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/change_timezone.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/reset_config_perms.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/backup_xi.sh *
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/messages
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/httpd/error_log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/mysqld.log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/html/includes/components/profile/getprofile.sh
NAGIOSXIWEB ALL = NOPASSWD:/etc/init.d/snmptt restart
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/repair_databases.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
Is there any other log I can check too find out what's happening?

Executing reconfigure_nagios.sh from cli with nagios user seem to work:

Code: Select all

sudo su nagios -c ./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&backend=1&username=nagiosxi&password=P6SM2Dhemspe' -O nagiosql.login--2017-01-21 19:23:23--  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’

    [ <=>                                                                                      ] 28,304      --.-K/s   in 0.01s

2017-01-21 19:23:23 (1.80 MB/s) - ‘nagiosql.login’ saved [28304]

LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: http://localhost/nagiosxi/includes/components/ccm/
Array
(
)
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&backend=1&username=nagiosxi&password=P6SM2Dhemspe' -O nagiosql.login--2017-01-21 19:23:23--  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’

    [ <=>                                                                                      ] 28,304      --.-K/s   in 0.01s

2017-01-21 19:23:24 (1.82 MB/s) - ‘nagiosql.login’ saved [28304]

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 'backend=1&cmd=apply&type=writeConfig' -O nagiosql.export.monitoring
--2017-01-21 19:23:24--  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’

    [ <=>                                                                                      ] 21,928      --.-K/s   in 0.01s

2017-01-21 19:23:24 (1.66 MB/s) - ‘nagiosql.export.monitoring’ saved [21928]

WRITE CONFIGS SUCCESSFUL!
OUTPUT:
Nagios Core 4.2.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-07-2016
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 1 host groups.
Question is if the apply config from the webgui is running as the apache or the nagios user?

Followed https://support.nagios.com/kb/article.php?id=34 and reset the nagios xi sudo permissions. Apply configuration kees running forever though. Input is welcome.
Nagios XI 5.8.1
https://outsideit.net
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Apply Configuration not finishing

Post by tgriep »

Try running the following tail command in a shell on the server, then Apply the Config and hopefully the error will be captured and can be posted here.

Code: Select all

tail -f /var/log/httpd/*_log
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Apply Configuration not finishing

Post by WillemDH »

Well, tried another time and it seems I'm missing some files after installation.

The error says there is something wrong with permissions, but actually the files are not there at all.

Code: Select all

ls /usr/local/nagios/etc
total 76
drwsrwsr-x 7 apache nagios 4096 Jan 30 22:12 .
drwxr-xr-x 9 root   root   4096 Jan 30 22:11 ..
-rwxrwxr-x 1 apache nagios  744 Jan 30 22:10 cgi.cfg
drwsrwsr-x 2 apache nagios 4096 Jan 30 22:10 hosts
drwsrwsr-x 2 apache nagios 4096 Jan 30 22:21 import
-rwxrwxr-x 1 apache nagios 5670 Jan 30 22:10 nagios.cfg
-rw-rw-r-- 1 apache nagios 2229 Jan 30 22:11 ndo2db.cfg
-rw-rw-r-- 1 apache nagios 4827 Jan 30 22:11 ndomod.cfg
-rw-rw-r-- 1 apache nagios 7988 Jan 30 22:12 nrpe.cfg
-rw-rw-r-- 1 apache nagios 5345 Jan 30 22:12 nsca.cfg
drwxrwsr-x 4 apache nagios 4096 Jan 30 22:12 pnp
-rwxrwxr-x 1 apache nagios  210 Jan 30 22:10 resource.cfg
-rw-rw-r-- 1 apache nagios 1627 Jan 30 22:12 send_nsca.cfg
drwsrwsr-x 2 apache nagios 4096 Jan 30 22:10 services
drwsrwsr-x 2 apache nagios 4096 Jan 30 22:10 static
Executed the permissions reset script, but didn't really helped.
You do not have the required permissions to view the files attached to this post.
Nagios XI 5.8.1
https://outsideit.net
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Apply Configuration not finishing

Post by tgriep »

You could try and install Nagios again and see if the missing files get added to the system. You may have to completely remove it from the system to do that.
Look at this document for the uninstall instructions.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked