Page 1 of 2

Configuration verification fails - contacts.cfg

Posted: Fri May 03, 2013 8:00 am
by yranib
Hi,

The configuration verification is failing since I deleted some services and hosts. I did not touch the contacts but when checking the configuration snapshot output I get this:
  • 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/xitemplates.cfg'...
    Processing object config file '/usr/local/nagios/etc/static/xitest.cfg'...
    Processing object config file '/usr/local/nagios/etc/contacttemplates.cfg'...
    Processing object config file '/usr/local/nagios/etc/contactgroups.cfg'...
    Processing object config file '/usr/local/nagios/etc/contacts.cfg'...
    Error: Invalid contact object directive 'host_notifications_enable'.
    Error: Could not add object property in file '/usr/local/nagios/etc/contacts.cfg' on line 46.
    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.
Line 46 of contacts.cfg is:
host_notifications_enabled 1

I have no idea why this is failing...
Checking the configuration files gives 0 errors.

Re: Configuration verification fails - contacts.cfg

Posted: Fri May 03, 2013 11:43 am
by abrist
Can you post the config for the contact in question? Go to the CCM --> contacts --> click on the "disk" icon to the right of the contact and post the text of the file here.

Re: Configuration verification fails - contacts.cfg

Posted: Wed Jun 05, 2013 4:27 am
by yranib
Hi, sorry for the late reply. The issue is still the same.

When clicking on the 'disk' icon to the right of the contact it gives me the following (I've replaced the username):
Warning: configuration file is out of date!

Relational information for [username] of table tbl_contact:
Relation to tbl_contactgroup, entry KTW_Admins - deletion possible
Relation to tbl_contacttemplate, entry xi_contact_generic - deletion possible


I read through some other posts for similar issues here, perhaps this logs will help?
I've ran:
./reconfigure_nagios.sh &> reconfig.txt
The output of reconfig.txt is:

Code: Select all

URL: http://localhost/nagiosql/index.php
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosql/index.php --no-check-certificate --post-data 'Submit=Login&tfUsername=nagiosxi&tfPassword=bla0ni' -O nagiosql.login--2013-06-05 11:16:06--  http://localhost/nagiosql/index.php
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/nagiosql/admin.php [following]
--2013-06-05 11:16:06--  http://localhost/nagiosql/admin.php
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5286 (5.2K) [text/html]
Saving to: “nagiosql.login”

     0K .....                                                 100%  605M=0s

2013-06-05 11:16:06 (605 MB/s) - “nagiosql.login” saved [5286/5286]

LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: http://localhost/nagiosql/admin/import.php
Array
(
)
RESETTING PERMS
SETUID ROOT OK
URL: http://localhost/nagiosql/index.php
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosql/index.php --no-check-certificate --post-data 'Submit=Login&tfUsername=nagiosxi&tfPassword=bla0ni' -O nagiosql.login--2013-06-05 11:16:06--  http://localhost/nagiosql/index.php
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/nagiosql/admin.php [following]
--2013-06-05 11:16:06--  http://localhost/nagiosql/admin.php
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5286 (5.2K) [text/html]
Saving to: “nagiosql.login”

     0K .....                                                 100%  614M=0s

2013-06-05 11:16:06 (614 MB/s) - “nagiosql.login” saved [5286/5286]

LOGIN SUCCESSFUL!
URL: http://localhost/nagiosql/admin/verify.php
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
--2013-06-05 11:16:07--  http://localhost/nagiosql/admin/verify.php
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7096 (6.9K) [text/html]
Saving to: “nagiosql.export.monitoring”

     0K ......                                                100%  689M=0s

2013-06-05 11:16:10 (689 MB/s) - “nagiosql.export.monitoring” saved [7096/7096]

WRITE CONFIGS SUCCESSFUL!
--2013-06-05 11:16:10--  http://localhost/nagiosql/admin/verify.php
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7400 (7.2K) [text/html]
Saving to: “nagiosql.export.additional”

     0K .......                                               100%  821M=0s

2013-06-05 11:16:10 (821 MB/s) - “nagiosql.export.additional” saved [7400/7400]

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/xitemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/static/xitest.cfg'...
Processing object config file '/usr/local/nagios/etc/contacttemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/contactgroups.cfg'...
Processing object config file '/usr/local/nagios/etc/contacts.cfg'...
Error: Invalid contact object directive 'host_notifications_enable'.
Error: Could not add object property in file '/usr/local/nagios/etc/contacts.cfg' on line 46.
   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 /usr/local/nagiosxi/scripts
tar: Removing leading `/' from member names
/usr/local/nagiosxi/scripts
LATEST NOM SNAPSHOT: /usr/local/nagiosxi/nom/checkpoints/nagioscore/1370355362.tar.gz
/ /usr/local/nagiosxi/scripts
RESTORING NOM SNAPSHOT : /usr/local/nagiosxi/nom/checkpoints/nagioscore/1370355362.tar.gz
/usr/local/nagiosxi/scripts
RESETTING PERMS
SETUID ROOT OK
I've ran tail-f /usr/local/nagiosxi/var/cmdsubsys.log &> cmd.txt and applied the configuration.
The output of cmd.txt is:

Code: Select all

.............ame=nagiosxi&tfPassword=bla0ni' -O nagiosql.loginLOGIN SUCCESSFUL!
URL: http://localhost/nagiosql/admin/verify.php
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
--2013-06-05 11:16:18--  http://localhost/nagiosql/admin/verify.php
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7096 (6.9K) [text/html]
Saving to: `nagiosql.export.monitoring'

     0K ......                                                100%  782M=0s

2013-06-05 11:16:22 (782 MB/s) - `nagiosql.export.monitoring' saved [7096/7096]

WRITE CONFIGS SUCCESSFUL!
--2013-06-05 11:16:22--  http://localhost/nagiosql/admin/verify.php
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7400 (7.2K) [text/html]
Saving to: `nagiosql.export.additional'

     0K .......                                               100%  836M=0s

2013-06-05 11:16:22 (836 MB/s) - `nagiosql.export.additional' saved [7400/7400]

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/xitemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/static/xitest.cfg'...
Processing object config file '/usr/local/nagios/etc/contacttemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/contactgroups.cfg'...
Processing object config file '/usr/local/nagios/etc/contacts.cfg'...
Error: Invalid contact object directive 'host_notifications_enable'.
Error: Could not add object property in file '/usr/local/nagios/etc/contacts.cfg' on line 46.
   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 /usr/local/nagiosxi/scripts
tar: Removing leading `/' from member names
/usr/local/nagiosxi/scripts
LATEST NOM SNAPSHOT: /usr/local/nagiosxi/nom/checkpoints/nagioscore/1370355362.tar.gz
/ /usr/local/nagiosxi/scripts
RESTORING NOM SNAPSHOT : /usr/local/nagiosxi/nom/checkpoints/nagioscore/1370355362.tar.gz
tar: usr/local/nagios/etc/static: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/static: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/services: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/services: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/pnp/pages: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/pnp/pages: Cannot change mode to rwxrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/pnp/check_commands: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/pnp/check_commands: Cannot change mode to rwxrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/pnp: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/pnp: Cannot change mode to rwxrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/import: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/import: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/hosts: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/hosts: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: Exiting with failure status due to previous errors
/usr/local/nagiosxi/scripts
RESETTING PERMS
SETUID ROOT OK
OUTPUT=SETUID ROOT OK
RETURNCODE=1
....

Re: Configuration verification fails - contacts.cfg

Posted: Wed Jun 05, 2013 11:59 am
by abrist
Go to --> Configure --> Core Config Manager --> Tools --> Write Config Files. Click "write" and then "verify" Post the output of these two buttons.

Re: Configuration verification fails - contacts.cfg

Posted: Fri Jun 07, 2013 4:54 am
by yranib
Here is the output of the 'write' button:
Write host configurations ...
Configuration file successfully written!

Write service configurations ...
Configuration file successfully written!

Write hostgroups.cfg ...
Configuration file successfully written!
Write servicegroups.cfg ...
Configuration file successfully written!
Write hosttemplates.cfg ...
Configuration file successfully written!
Write servicetemplates.cfg ...
Configuration file successfully written!


There is no 'verify' but instead a 'check the configuration files' button. This one gives a huge output file because there are warning for duplicate services and notification time periods not defined. Please let me know if I should post the whole thing, I think the only interesting part is at the end?:
Checked 813 services.
Checking hosts...
Checked 98 hosts.
Checking host groups...
Checked 3 host groups.
Checking service groups...
Checked 6 service groups.
Checking contacts...
Checked 11 contacts.
Checking contact groups...
Checked 4 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 111 commands.
Checking time periods...
Checked 17 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 1610
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

Re: Configuration verification fails - contacts.cfg

Posted: Fri Jun 07, 2013 9:39 am
by slansing
Did you import that contacts.cfg file? The definition it is listing should not be in there.

Re: Configuration verification fails - contacts.cfg

Posted: Fri Jun 14, 2013 3:10 am
by yranib
No, the contacts.cfg file has not been imported.
Is there no way to let it recreate or reset the contacts.cfg? Even if we would lose the data, that does not matter, we have to fix this issue because right now we cannot do any modifications.

Re: Configuration verification fails - contacts.cfg

Posted: Fri Jun 14, 2013 12:25 pm
by abrist
Can we see this contact? Feel free to obfuscate the email address:

Code: Select all

head -35 /usr/local/nagios/etc/contacts.cfg | tail -20

Re: Configuration verification fails - contacts.cfg

Posted: Mon Jun 17, 2013 1:58 am
by yranib
Yes, of course, here it is:

[root@luxnxi01 ~]# head -35 /usr/local/nagios/etc/contacts.cfg | tail -20
alias LUXNTGROUP
host_notification_period adminlux_notification_times
service_notification_period adminlux_notification_times
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
email [email protected]
use xi_contact_generic
}

define contact {
contact_name username
alias Lastname, Firstname (Site)
host_notification_period username_notification_times
service_notification_period username_notification_times
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
email [email protected]
host_notifications_enabled 1
service_notifications_enabled 1
use xi_contact_generic

Re: Configuration verification fails - contacts.cfg

Posted: Mon Jun 17, 2013 1:19 pm
by abrist
You could try removing the offending contact from the CCM, and then applying configuration.