Page 1 of 1

Applying Configuration after "reset to defaults" error

Posted: Fri Jun 26, 2015 12:42 pm
by teliasonerano
Hi,

i have a problem with our NagiosXI installation .. had a problem with a host that would not go away from the "applying configuration" page .. i tried deleting the services and host associated with the faulty host .. but it was still giving error on that host when applying config.

i then decided to do a "reset to defaults" on my system to start from scratch .. but even on a clean system .. the host still gives an error

Error: Invalid max_check_attempts value for host 'tb-tomcat-1.netcom.no'
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/tb-tomcat-1.netcom.no.cfg', starting on line 16)

is there a temp file or something where Nagios has stored this host ? how can i get rid of it without screpping the whole OS and start all over again ?

regards
Ronny

Re: Applying Configuration after "reset to defaults" error

Posted: Fri Jun 26, 2015 12:50 pm
by ssax
Please go to Configure > Core Config Manager > Tools > Write Config Files
- Click Delete (don't worry, they get rewritten)
- Click Write
- Click Verify and post the full output here.
- If the verify has no errors, try to apply configuration

If apply config fails at that point run these commands:

Code: Select all

su - nagios
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
Then post the full output of those commands so that we can troubleshoot.

Re: Applying Configuration after "reset to defaults" error

Posted: Fri Jun 26, 2015 1:01 pm
by teliasonerano
Hi, and thank you for the reply

- Click Delete (don't worry, they get rewritten)
- Click Write

Write host configurations ...
Configuration file: localhost.cfg successfully written!
Host configuration files successfully written!

Write service configurations ...
Configuration file: localhost.cfg successfully written!
Service configuration files successfully written!

Configuration file: hostgroups.cfg successfully written!
Configuration file: servicegroups.cfg successfully written!
Configuration file: hosttemplates.cfg successfully written!
Configuration file: servicetemplates.cfg successfully written!
Configuration file: timeperiods.cfg successfully written!
Configuration file: commands.cfg successfully written!
Configuration file: contacts.cfg successfully written!
Configuration file: contactgroups.cfg successfully written!
Configuration file: contacttemplates.cfg successfully written!
Configuration file: servicedependencies.cfg successfully written!
Configuration file: hostdependencies.cfg successfully written!
Configuration file: serviceescalations.cfg successfully written!
Configuration file: hostescalations.cfg successfully written!
Configuration file: serviceextinfo.cfg successfully written!
Configuration file: hostextinfo.cfg successfully written!

- Click Verify and post the full output here.

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://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 8 services.
Checked 1 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 2 contacts.
Checked 2 contact groups.
Checked 109 commands.
Checked 7 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 7 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

- If the verify has no errors, try to apply configuration


Command submitted for processing...
Waiting for configuration verification.....
Backend login to the Core Config Manager failed.

An error occurred while attempting to apply your configuration to Nagios Core. Monitoring engine configuration files have been rolled back to their last known good checkpoint.

Error: Invalid max_check_attempts value for host 'tb-tomcat-1.netcom.no'
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/tb-tomcat-1.netcom.no.cfg', starting on line 16)

./reconfigure_nagios.sh .. as nagios

Code: Select all

[nagios@nagios-prod scripts]$ ./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--2015-06-26 19:58:33--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1, ::1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.login”

    [ <=>                                                                                                                                                                                      ] 11,254      --.-K/s   in 0.01s   

2015-06-26 19:58:33 (1.07 MB/s) - “nagiosql.login” saved [11254]

LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: http://localhost/nagiosxi/includes/components/ccm/
Array
(
)
ERROR TRYING TO SETUID ROOT!
RESETTING PERMS
/bin/chown: changing ownership of `/usr/local/nagios/etc/hosts/localhost.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/hosts': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/serviceextinfo.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/contacts.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/npcd.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/rra.cfg-sample': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/rra.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/pages/web_traffic.cfg-sample': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/pages': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/background.pdf': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/process_perfdata.cfg-sample': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/process_perfdata.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/config.php': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/pnp4nagios_release': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/check_commands/check_nwstat.cfg-sample': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/check_commands': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp/npcd.cfg-sample': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/pnp': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/servicetemplates.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/hosttemplates.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/serviceescalations.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/import': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/services/localhost.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/services': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/ndo2db.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/contactgroups.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/commands.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/contacttemplates.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/mysql_init': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/hostescalations.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/timeperiods.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/nsca.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/send_nsca.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/cgi.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/servicegroups.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/servicedependencies.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/ndomod.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/hostgroups.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/resource.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/nrpe.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/hostdependencies.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/nagios.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/static/xiobjects.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/static/xitemplates.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/static/xitest.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/static': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/hostextinfo.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagios/etc/': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/hosts': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/hosts/localhost.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/serviceextinfo.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/contacts.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/npcd.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/rra.cfg-sample': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/rra.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/pages': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/pages/web_traffic.cfg-sample': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/background.pdf': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/process_perfdata.cfg-sample': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/process_perfdata.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/config.php': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/pnp4nagios_release': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/check_commands': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/check_commands/check_nwstat.cfg-sample': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/pnp/npcd.cfg-sample': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/servicetemplates.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/hosttemplates.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/serviceescalations.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/import': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/services': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/services/localhost.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/ndo2db.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/contactgroups.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/commands.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/contacttemplates.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/mysql_init': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/hostescalations.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/timeperiods.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/nsca.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/send_nsca.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/cgi.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/servicegroups.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/servicedependencies.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/ndomod.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/hostgroups.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/resource.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/nrpe.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/hostdependencies.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/nagios.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/static': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/static/xiobjects.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/static/xitemplates.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/static/xitest.cfg': Operation not permitted
/bin/chmod: changing permissions of `/usr/local/nagios/etc/hostextinfo.cfg': Operation not permitted
/bin/chown: changing ownership of `/usr/local/nagiosxi/etc/components/ccm_config.inc.php': Operation not permitted
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--2015-06-26 19:58:33--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1, ::1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.login”

    [ <=>                                                                                                                                                                                      ] 11,254      --.-K/s   in 0.01s   

2015-06-26 19:58:33 (1.10 MB/s) - “nagiosql.login” saved [11254]

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
--2015-06-26 19:58:34--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1, ::1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.export.monitoring”

    [  <=>                                                                                                                                                                                     ] 14,108      53.5K/s   in 0.3s    

2015-06-26 19:58:34 (53.5 KB/s) - “nagiosql.export.monitoring” saved [14108]

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

Website: http://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 8 services.
        Checked 1 hosts.
        Checked 1 host groups.
        Checked 0 service groups.
        Checked 2 contacts.
        Checked 2 contact groups.
        Checked 109 commands.
        Checked 7 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 7 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
Running configuration check...
Stopping nagios: done.
Starting nagios: done.

Re: Applying Configuration after "reset to defaults" error

Posted: Fri Jun 26, 2015 1:49 pm
by lmiltchev
Run the following commands and show us the output:

Code: Select all

grep -R "NAGIOSXI=nagios" /etc/sudoers
grep -R "NAGIOSXI=nagios" /etc/sudoers.d
Then also run the following command to begin capturing log output:

Code: Select all

tail -f /usr/local/nagiosxi/var/cmdsubsys.log &> /tmp/cmd.txt
Attempt to Apply Configuration from the web interface. After the browser has returned some output to the screen, press Ctrl+C to stop the log tail, and post the cmd.txt that was generated in the "/tmp/" directory.

Re: Applying Configuration after "reset to defaults" error

Posted: Fri Jun 26, 2015 1:58 pm
by teliasonerano
sudoers :

[root@nagios-prod ~]# grep -R "NAGIOSXI=nagios" /etc/sudoers
User_Alias NAGIOSXI=nagios

sudoers.d :

[root@nagios-prod ~]# grep -R "NAGIOSXI=nagios" /etc/sudoers.d
[root@nagios-prod ~]#

PROCESSED 0 COMMANDS
YING NAGIOSCORE CONFIG...
CMDLINE=cd /usr/local/nagiosxi/scripts && ./reconfigure_nagios.sh
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
--2015-06-26 20:55:20-- http://localhost/nagiosxi/includes/components/ccm/
Resolving proxy.netcom.no... 212.45.173.105, 212.45.173.106, 212.45.173.124
Connecting to proxy.netcom.no|212.45.173.105|:8080... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: http://212.45.183.249 [following]
--2015-06-26 20:55:20-- http://212.45.183.249/
Connecting to proxy.netcom.no|212.45.173.105|:8080... connected.
Proxy request sent, awaiting response... 503 Service Unavailable
2015-06-26 20:55:21 ERROR 503: Service Unavailable.

/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.loginNAGIOSQL LOGIN FAILED!
OUTPUT=/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.loginNAGIOSQL LOGIN FAILED!
RETURNCODE=2
.....


i see the problem now ... /etc/wgetrc has proxy enabled... i commented out the proxy and now it works :) ..

thank you so much for the help!!

regards
Ronny

Re: Applying Configuration after "reset to defaults" error

Posted: Fri Jun 26, 2015 2:05 pm
by tmcdonald
I'll be closing this thread now, but feel free to open another if you need anything in the future!