Nagios Config Error from timperiods.cfg file

Well I have configured nagios timeperiods.cfg file and then I run the verify command /usr/local/bin/nagios -v nagios.cfg and it gave me error as below:

Error: Timeperiod ‘24x7’ has already been defined
Error: Could not register timeperiod (config file ‘/usr/local/etc/nagios/timeperiods.cfg’, starting on line 1)

And my timeperiods.cfg file looks like as below

define timeperiod{ timeperiod_name 24x7 alias 24 Hours A Day, 7 Days A Week sunday 00:00-24:00 monday 00:00-24:00 tuesday 00:00-24:00 wednesday 00:00-24:00 thursday 00:00-24:00 friday 00:00-24:00 saturday 00:00-24:00 }

check your localhost.cfg as there may in fact be a 24x7 timeperiod defined in there. Or you could try the following in the nagios/etc directory:

grep -i “24x7” *.cfg

This should return any file names that have the entry 24x7 in it. Just remove or comment out the 24x7 you don’t want.

Leigh

Thanks well I just commented out that localhost.cfg file in nagios.cfg and it worked. But now I am gettting another error it says that it didn’t found hosts.The error is as below:

Error: Could not find any host matching 'admin-office.net
Error: Could not expand member hosts specified in hostgroup (config file ‘/usr/local/etc/nagios/hostgroups.cfg’, starting on line 13)

Sounds like you have a hostgroup defined that doesn’t have any members. I think you need at least one server in each hostgroup you create or it will complain.