Page 2 of 2

Re: apply config fail

Posted: Tue Apr 07, 2015 2:34 am
by MichielvM

Code: Select all

[root@ndltil-rhn01 ~]# visudo -c
/etc/sudoers: parsed OK
[root@ndltil-rhn01 ~]# ll -t /usr/local/nagios/etc/services | grep til-svr-010*
-rw-rw-r-- 1 apache nagios 17590 Apr  2 10:27 til-svr-010.cfg
[root@ndltil-rhn01 ~]# ll -t /usr/local/nagios/etc/hosts | grep til-svr-010*
-rw-rw-r-- 1 apache nagios 1245 Apr  2 10:27 til-svr-010.cfg
[root@ndltil-rhn01 ~]#
About the failed snapshot: I know what you mean by the red one. But it isn't generated for some reason.
The automated snapshot (everyday around 22:00 hours) is ok (?)
But when I do a manual Apply config, I see this:

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

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.
View a snapshot of this configuration error **No red snapshots**
**Try Again** button
Show Config Changes

Code: Select all

Write host configurations ...
Host configuration files successfully written!

Write service configurations ...
Configuration file: oss-svr-015-oracle.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!
Show Errors

Code: Select all

Error: Could not find any host matching 'til-svr-010' (config file '/usr/local/nagios/etc/services/til-svr-010-oracle.cfg', starting on line 337)
Error: Could not expand hostgroups and/or hosts specified in service (config file '/usr/local/nagios/etc/services/til-svr-010-oracle.cfg', starting on line 337)

Re: apply config fail

Posted: Tue Apr 07, 2015 10:59 am
by lmiltchev
The apply configuration fails, and you are rolled back to the "last known good checkpoint", but you don't have any snapshots with config errors (in red color)? Can you go to Admin->Config Snapshots and post a screenshot of this page?

Also, run the reconfigure_nagios.sh script from the command line as root and as nagios, and show us the output:

Code: Select all

cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh

su nagios
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh

Re: apply config fail

Posted: Thu Apr 09, 2015 4:40 am
by MichielvM
Here's the output
[root@ndltil-rhn01 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=07rm8h' -O nagiosql.login--2015-04-09 11:25:36-- http://localhost/nagiosxi/includes/components/ccm/
Connecting to 192.168.254.118:443... connected.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.login”

[ <=> ] 8,505 --.-K/s in 0.1s

2015-04-09 11:25:38 (60.8 KB/s) - “nagiosql.login” saved [8505]

NAGIOSQL LOGIN FAILED!
[root@ndltil-rhn01 scripts]# su nagios
[nagios@ndltil-rhn01 scripts]$ pwd
/usr/local/nagiosxi/scripts
[nagios@ndltil-rhn01 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=07rm8h' -O nagiosql.login--2015-04-09 11:26:29-- http://localhost/nagiosxi/includes/components/ccm/
Connecting to 192.168.254.118:443... connected.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.login”

[ <=> ] 8,505 --.-K/s in 0.01s

2015-04-09 11:26:29 (660 KB/s) - “nagiosql.login” saved [8505]

NAGIOSQL LOGIN FAILED!

Re: apply config fail

Posted: Thu Apr 09, 2015 4:06 pm
by lmiltchev
Are you using a proxy? If you are, please follow our recommendations about proxy configuration on our FAQ wiki page here:

http://support.nagios.com/wiki/index.ph ... th_Proxies

Make sure you exclude localhost in "/etc/wgetrc", i.e.

Code: Select all

no_proxy=localhost,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 # Hosts to exclude from proxying
Can you also run the following command and show us the output:

Code: Select all

ll /usr/local/nagiosxi/scripts/nagiosql*

Re: apply config fail

Posted: Wed Jun 03, 2015 8:10 am
by MichielvM
No proxy.

Requested output:

Code: Select all

[root@ndltil-rhn01 ~]# ll /usr/local/nagiosxi/scripts/nagiosql*
-rwxrwxr-x 1 nagios nagios    161 Jun  3 11:50 /usr/local/nagiosxi/scripts/nagiosql.cookies
-rwxrwxr-x 1 nagios nagios 271780 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_defaults.sql
-rwxrwxr-x 1 nagios nagios   8238 May 28 16:14 /usr/local/nagiosxi/scripts/nagiosql.delete.contact
-rwxrwxr-x 1 nagios nagios    952 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_delete_contact.php
-rwxrwxr-x 1 nagios nagios   1991 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_delete_host.php
-rwxrwxr-x 1 nagios nagios    509 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_delete_object.sh
-rwxrwxr-x 1 nagios nagios   2846 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_delete_service.php
-rwxrwxr-x 1 nagios nagios    955 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_delete_timeperiod.php
-rwxrwxr-x 1 nagios nagios   7400 Dec 17 11:29 /usr/local/nagiosxi/scripts/nagiosql.export.additional
-rwxrwxr-x 1 nagios nagios   1334 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_exportall.php
-rwxrwxr-x 1 nagios nagios  13594 Mar  6 08:16 /usr/local/nagiosxi/scripts/nagiosql.export.monitoring
-rwxrwxr-x 1 nagios nagios   1333 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_importall.php
-rwxrwxr-x 1 nagios nagios  16801 Mar  2 15:51 /usr/local/nagiosxi/scripts/nagiosql.import.monitoring
-rwxrwxr-x 1 nagios nagios   8505 Jun  3 11:50 /usr/local/nagiosxi/scripts/nagiosql.login
-rwxrwxr-x 1 nagios nagios   1849 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_login.php
-rwxrwxr-x 1 nagios nagios   2246 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_snapshot.sh
-rwxrwxr-x 1 nagios nagios    262 May  1 14:08 /usr/local/nagiosxi/scripts/nagiosql_trim_backups.sh
I got another one on another Xi srver

Code: Select all

Error: Invalid max_check_attempts value for host 'dcf-fr-s07'
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/dcf-fr-s07.cfg', starting on line 14)
Host does not exist anymore. I've tried to writ the config manually via CCM-Write config and so on.
My pending changes are execued allright, but apply config still fails.. (on both errors)

I can't help it, but these 'ghost fails' seem to have increased since version 2014Rx.x

Re: apply config fail

Posted: Wed Jun 03, 2015 10:57 am
by abrist
Humor me here for a minute. We have seen issues with sudoer rules on r2.6. Try removing "sudo" from the statement on line #44 in the file:

Code: Select all

/usr/local/nagiosxi/scripts/restart_nagios_with_export.sh
Change:

Code: Select all

    sudo $BASEDIR/manage_services.sh restart nagios
To:

Code: Select all

    $BASEDIR/manage_services.sh restart nagios
Save out. Now remove the host and service config files:

Code: Select all

rm -f /usr/local/nagios/etc/hosts/*
rm -f /usr/local/nagios/etc/services/*
And then try to run reconfigure nagios from the cli:

Code: Select all

cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
Post the output.

Re: apply config fail

Posted: Thu Jun 04, 2015 4:39 am
by MichielvM
Had to edit /etc/wgetrc to get rid of proxy isssues. But after that the above reconfiguration steps worked for me.
Thanks a bunch.

I do, however still have one issue where the apply config reports a host error stating that the host that cannot be a child/parent of itself.
I've obviously looked in the host config. No parents.
I was hoping that above steps would clear this one too, but too bad. still there..

Re: apply config fail

Posted: Thu Jun 04, 2015 9:39 am
by lmiltchev
Do you see any config errors when you run the Write Config Tool?

CCM->Write Config Files->Write->Verify

Have you tried deleting the configs via the Write Config Tool and applying configuration?

Delete->Write->Verify->Apply Configuration (if there are no config errors in the previous steps)