Page 1 of 1
Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 10:49 am
by rawwrr
Hi,
I'm having some trouble applying the latest configuration modification I made to quite a lot of hosts. I did edit the check period and notification period for those hosts.
Since then, If I try to apply the config, I get the message Error: Could not add object property in file '/usr/local/nagios/etc/timeperiods.cfg' on line 164.
I did take a look at my timeperiods.cfg but it is pretty basic. Is there a way to pinpoint the error to a particular timeperiod object?
I'm running CentOS 5 64 bit (VMware image).
The following command returns;/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors: 0
Thanks!
PS: I would normally just restore the previous snapshot but I noticed that my latest modification did not create any snapshot.. it would take me quite some time to redo all the changes.
Re: Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 10:58 am
by ssax
Please run the commands below and post the full output in code tags:
Code: Select all
su - nagios
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
Re: Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 11:26 am
by rawwrr
That was a good idea - I forgot about that script.
It appears there is a duplicate entry. Should I comment the one in the /usr/local/nagios/etc/timeperiods.cfg file?
Although this output make it looks like my server is pretty messed up.
Code: Select all
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=shoutstrong88!' -O nagiosql.login--2015-06-30 12:04:47-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.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'
[ <=> ] 10,839 --.-K/s in 0.02s
2015-06-30 12:04:47 (651 KB/s) - `nagiosql.login' saved [10839]
LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: http://localhost/nagiosxi/includes/components/ccm/
Array
(
)
touch: cannot touch `/usr/local/nagiosxi/scripts/reconfigure_nagios.lock': Permission denied
SETUID ROOT OK
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=shoutstrong88!' -O nagiosql.login--2015-06-30 12:04:48-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.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'
[ <=> ] 10,839 --.-K/s in 0.02s
2015-06-30 12:04:48 (627 KB/s) - `nagiosql.login' saved [10839]
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-30 12:04:49-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.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'
[ <=> ] 22,161 12.3K/s in 1.8s
2015-06-30 12:04:51 (12.3 KB/s) - `nagiosql.export.monitoring' saved [22161]
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...
Warning: use_embedded_perl_implicitly is deprecated and will be removed.
Warning: sleep_time is deprecated and will be removed.
Warning: p1_file is deprecated and will be removed.
Warning: external_command_buffer_slots is deprecated and will be removed. All commands are always processed upon arrival
Warning: enable_embedded_perl is deprecated and will be removed.
Warning: command_check_interval is deprecated and will be removed. Commands are always handled on arrival
Read main config file okay...
Warning: Duplicate definition found for timeperiod 'xi_timeperiod_24x7' (config file '/usr/local/nagios/etc/timeperiods.cfg', starting on line 175)
Error: Could not add object property in file '/usr/local/nagios/etc/timeperiods.cfg' on line 176.
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: 1
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors /usr/local/nagiosxi/scripts
./nom_create_nagioscore_errorpoint.sh: line 14: 1435680291.txt: Permission denied
tar: 1435680291.tar.gz: Cannot open: Permission denied
tar: Error is not recoverable: exiting now
tar: Removing leading `/' from member names
chown: cannot access `1435680291.txt': No such file or directory
chown: cannot access `1435680291.tar.gz': No such file or directory
/usr/local/nagiosxi/scripts
LATEST NOM SNAPSHOT: /usr/local/nagiosxi/nom/checkpoints/nagioscore/1433849941.tar.gz
/ /usr/local/nagiosxi/scripts
RESTORING NOM SNAPSHOT : /usr/local/nagiosxi/nom/checkpoints/nagioscore/1433849941.tar.gz
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/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 rwxrwxr-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 rwxrwxr-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 rwxrwxr-x: Operation not permitted
tar: usr/local/nagios/etc: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc: Cannot change mode to rwxrwsr-x: Operation not permitted
tar: Error exit delayed from previous errors
/usr/local/nagiosxi/scripts
SETUID ROOT OK
RESETTING PERMS
Thanks!
Re: Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 12:58 pm
by ssax
No, the files will get rewritten.
Do you see duplicates listed in Configure > Core Config Manager > Alerting > Timeperiods?
If not, try this:
Go to Configure > Core Config Manager > Tools > Write Config Files
- Click Delete (don't worry, they get rewritten)
- Click Write
- Click Verify, does it verify properly? If yes, try to apply configuration.
Re: Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 1:15 pm
by rawwrr
I just noticed that I do have 2 very similar timeperiods;
xi_timeperiod_24x72
xi_timeperiod_24x7
Although they are not identical. Is there a way to replace, for example, all "xi_timeperiod_24x72" with "xi_timeperiod_24x7"?
I'd try to delete the xi_timeperiod_24x72 timeperiod. I tried the bulk edit tool but it does not seem to work for check periods and notification periods.
Thanks again!
Edit: I followed the instructions in the previous post but I get the same error message.
Re: Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 1:30 pm
by ssax
If you use the bulk mods tool, make sure to use the ID of the template, not the name, and it will work.
Go to Configure > Core Config Manager > Alerting > Timeperiods and look on the far right column and it will give you the ID to use.
Re: Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 2:09 pm
by rawwrr
got it ! Thanks for your help and quick replies, that's very appreciated.
Actually, I do not think the "duplicate" timeperiod was the issue, it appears it was a disabled contact group.. everything worked fine after enabling it.
Anyway, my installation is long overdue for a major clean up.. I'll have to get down to it.
Thanks again for your help
Re: Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 3:25 pm
by lmiltchev
rawwrr, is it OK if we lock this topic and mark it as "resolved"?
Re: Could not add object property in file timeperiods.cfg
Posted: Tue Jun 30, 2015 3:47 pm
by rawwrr
yes, thank you