Page 1 of 2

Error applying time period configuration

Posted: Tue Sep 02, 2014 10:48 am
by luniversity
I've taken over management of our Nagios environment and noticed that the default time period xi_timeperiod_24x7 was not set to active in the CCM time periods. So I modified and checked the "Active" box but when I try to apply the configuration I recieve the following error:

Code: Select all

Warning: Duplicate definition found for timeperiod 'xi_timeperiod_24x7' (config file '/usr/local/nagios/etc/timeperiods.cfg', starting on line 641)
Error: Could not add object property in file '/usr/local/nagios/etc/timeperiods.cfg' on line 642.
   Error processing object config files!
When I look at the /usr/local/nagios/etc/timeperiods.cfg file I don't see any definition for this time period. The line #641 referenced in the error is a comment line making the end of the file.

Code: Select all

    641 ###############################################################################
    642 #
    643 # Timeperiod configuration file
    644 #
    645 # END OF FILE
    646 #
    647 ###############################################################################
Is it possible that this configuration exists in another config file some place? Any help is appreciated.

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 2:04 pm
by BanditBBS
Go ahead and make your changes again and instead of hitting "Apply configuration" go to advanced and write config. Then select the write button and then verify. Then go look at the file in question again.

More than likely that time period is in another static file somewhere and you activating it in the CCM is making a dupe definition. Then it rolls back to previous good config so when yuo look inthe file you don't see the definition you activated.

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 3:33 pm
by luniversity
Hey Bandit, I'm not sure I follow. When I look at the options under the "Advanced" link in the left hand menu I do not see "Write Config" as an option. The only options I have listed under advanced are:

Host Dependencies
Service Dependencies
Nagios Core Main Config
Nagios Core CGI Config

Am I missing something. Note that I'm on an older version of Nagios (XI 2012r1.2).

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 3:33 pm
by BanditBBS
Sorry, it is right below that under Tools

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 3:52 pm
by luniversity
Got it. Unfortunately it didn't work. The definition still does not show up in the timeperiod.cfg, I still see the message in red text that reads "Apply Configuration for new changes to take effect".

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 3:58 pm
by Box293
Execute this command at the CLI:

Code: Select all

grep -r timeperiod_name /usr/local/nagios/etc/
This will identify where it is defined.

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 4:00 pm
by BanditBBS
So you:
made the time period active again. Do not "Apply Config"
Went to tools - Write Config Files
Pressed the Write button(and waitied for it to finish)
Pressed the Verify button. When you did this, did it come back blue or red? If red, copy-n-paste the error here

and definitely do what Box293 said...that will get you to find where it is defined static.

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 4:12 pm
by luniversity
See that's what happens when I don't follow directions. I didn't hit the "Write" button first. Still didn't work though.

This time I did exactly as you instructed. When I click on verify I get this error message:
Error: Could not add object property in file '/usr/local/nagios/etc/timeperiods.cfg' on line 643.

Nagios Core 3.4.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 05-11-2012
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'...
Processing object config file '/usr/local/nagios/etc/timeperiods.cfg'...
Warning: Duplicate definition found for timeperiod 'xi_timeperiod_24x7' (config file '/usr/local/nagios/etc/timeperiods.cfg', starting on line 642)
Error: Could not add object property in file '/usr/local/nagios/etc/timeperiods.cfg' on line 643.
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.
I ran grep against timeperiod_name and found that I do indeed have a another entry with the same name under the ../static/ directory:
[root@nagios01r6v static]# grep -r timeperiod_name /usr/local/nagios/etc/ | grep xi_timeperiod_24x7
/usr/local/nagios/etc/static/xiobjects.cfg: timeperiod_name xi_timeperiod_24x7
/usr/local/nagios/etc/timeperiods.cfg: timeperiod_name xi_timeperiod_24x7

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 4:18 pm
by BanditBBS
Hmm, not sure why that is in that static file, you aren't supposed to modify those. My XI objects file only has xi_default_contact in it. Maybe someone else can speak up as to why it would be in that file before we say to go ahead and remove it.

Re: Error applying time period configuration

Posted: Tue Sep 02, 2014 4:22 pm
by luniversity
Yeah I took this over from another guys who is gone now. I tried to delete the one in /usr/local/nagios/etc through the CCM but it's got about 800 dependent relationships on it. I'm gonna quit on it for the day. I'll check back in tomorrow. Thanks fella's.