Upgrade Error - Timeperiod duplication

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Phil.Pearce
Posts: 52
Joined: Fri Jul 18, 2014 7:30 am

Upgrade Error - Timeperiod duplication

Post by Phil.Pearce »

Hi,

Ive just tried to upgrade using the gui.

Got this messgage
Warning: Duplicate definition found for timeperiod 'xi_timeperiod_24x7' (config file '/usr/local/nagios/etc/timeperiods.cfg', starting on line 392)
Error: Could not add object property in file '/usr/local/nagios/etc/timeperiods.cfg' on line 395.
Ive looked in the file:
define timeperiod {
timeperiod_name xi_timeperiod_24x7
alias 24x7
name xi_timeperiod_24x7
saturday 00:00-24:00
friday 00:00-24:00
thursday 00:00-24:00
wednesday 00:00-24:00
tuesday 00:00-24:00
monday 00:00-24:00
sunday 00:00-24:00
}
is only defined once..

Any ideas? as i cant get past this now
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Upgrade Error - Timeperiod duplication

Post by tgriep »

Could you post the full /usr/local/nagios/etc/timeperiods.cfg file so we can check it for any other errors?
Then, login to the server as root, run the following commands and post the output.

Code: Select all

grep -R timeperiod_name /usr/local/nagios/etc/*
/usr/local/nagios/bin/nagios -vv /usr/local/nagios/etc/nagios.cfg
Thanks
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: Upgrade Error - Timeperiod duplication

Post by tacolover101 »

@tgriep has the correct answer - just adding my two cents.

from the core config manager page, you should see a 'manage config files' link - try running a delete, write, and verify - this will delete all of your local config files, write them out from the DB, and then verify with nagios once again. if corruption has occured at a filesystem level, this generally resolves it.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Upgrade Error - Timeperiod duplication

Post by tgriep »

Thanks @tacolover101 for the help.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Phil.Pearce
Posts: 52
Joined: Fri Jul 18, 2014 7:30 am

Re: Upgrade Error - Timeperiod duplication

Post by Phil.Pearce »

the upgrade error was resolved.

I do have a load of these

Warning: Duplicate definition found for service 'VMTools' on host hostname' (config file '/usr/local/nagios/etc/services/hostname.cfg', starting on line 136)

Ive looked at the cfg and it looks fine, ive deleted the files, written and verified (the above errors)

Any ideas?

I
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Upgrade Error - Timeperiod duplication

Post by tgriep »

The service 'VMTools' is defined in another file and when it gets to the file in your example, determines it is a duplicate so you would have to search another config file for that service.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Phil.Pearce
Posts: 52
Joined: Fri Jul 18, 2014 7:30 am

Re: Upgrade Error - Timeperiod duplication

Post by Phil.Pearce »

not sure I understand.

from another forum post, i was told to delete/write and verify the config files.

When i did verify
Warning: Duplicate definition found for service 'Uptime' on host 'DC1-PNLB-MECW01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 116)
Warning: Duplicate definition found for service 'Memory Usage' on host 'DC1-PNLB-MECW01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 76)
Warning: Duplicate definition found for service 'Drive D: Disk Usage' on host 'DC1-PNLB-MECW01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 56)
Warning: Duplicate definition found for service 'Drive C: Disk Usage' on host 'DC1-PNLB-MECW01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 36)
Warning: Duplicate definition found for service 'CPU Usage' on host 'DC1-PNLB-MECW01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 16)
Warning: Duplicate definition found for service 'Ping' on host 'DC1-AWS-DC-EFAR1' (config file '/usr/local/nagios/etc/services/DC1-AWS-DC-EFAR1.cfg', starting on line 84)
Warning: Duplicate definition found for service 'BACKUP1: Current Disk Queue Length' on host 'MECSQL01' (config file '/usr/local/nagios/etc/services/MECSQL01.cfg', starting on line 50)
Warning: Duplicate definition found for service 'CPU Usage' on host 'DC1-PAOS-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 16)
Warning: Duplicate definition found for service 'CPU Usage' on host 'DC1-PBAI-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 16)
Warning: Duplicate definition found for service 'CPU Usage' on host 'dc1-pbai-mecw01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 16)
Warning: Duplicate definition found for service 'Drive C: Disk Usage' on host 'DC1-PAOS-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 36)
Warning: Duplicate definition found for service 'Drive C: Disk Usage' on host 'DC1-PBAI-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 36)
Warning: Duplicate definition found for service 'Drive C: Disk Usage' on host 'dc1-pbai-mecw01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 36)
Warning: Duplicate definition found for service 'Drive D: Disk Usage' on host 'DC1-PAOS-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 56)
Warning: Duplicate definition found for service 'Drive D: Disk Usage' on host 'DC1-PBAI-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 56)
Warning: Duplicate definition found for service 'Drive D: Disk Usage' on host 'dc1-pbai-mecw01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 56)
Warning: Duplicate definition found for service 'Memory Usage' on host 'DC1-PAOS-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 76)
Warning: Duplicate definition found for service 'Memory Usage' on host 'DC1-PBAI-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 76)
Warning: Duplicate definition found for service 'Memory Usage' on host 'dc1-pbai-mecw01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 76)
Warning: Duplicate definition found for service 'Uptime' on host 'DC1-PAOS-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 116)
Warning: Duplicate definition found for service 'Uptime' on host 'DC1-PBAI-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 116)
Warning: Duplicate definition found for service 'Uptime' on host 'dc1-pbai-mecw01' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 116)
Warning: Duplicate definition found for service 'VMTools' on host 'DC1-PAOS-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 136)
Warning: Duplicate definition found for service 'VMTools' on host 'DC1-PBAI-MECW02' (config file '/usr/local/nagios/etc/services/DC1-PAOS-MECW01.cfg', starting on line 136)
When i look at the cfg file it looks ok, there is no duplication for the service. eg... vmtools

DC1-PAOS-MECW01.cfg

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.6.7
# Date:	      2017-07-21 15:01:22
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios CCM will overwrite all manual settings during the next update if you 
# would like to edit files manually, place them in the 'static' directory or 
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
	host_name			DC1-PAOS-MECW01
	service_description		CPU Usage
	use				xiwizard_windowsserver_nsclient_service
	hostgroup_name			HOSTGROUPNAME
	check_command			check_xi_service_nsclient!nagiospasswordhere!CPULOAD!-l 5,80,90!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notification_options		w,c,u,r,s,
	notifications_enabled		1
	contacts			Monitoring
	contact_groups			Infrastructure,HOSTGROUPNAME ,On-Call
	_xiwizard			windowsserver
	register			1
	}	

define service {
	host_name			DC1-PAOS-MECW01
	service_description		Drive C: Disk Usage
	use				xiwizard_windowsserver_nsclient_service
	hostgroup_name			HOSTGROUPNAME
	check_command			check_xi_service_nsclient!nagiospasswordhere!USEDDISKSPACE!-l C -w 80 -c 95!!!!!
	max_check_attempts		5
	check_interval			60
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notification_options		w,c,u,r,s,
	notifications_enabled		1
	contacts			Monitoring,service.monitoring
	contact_groups			Infrastructure,HOSTGROUPNAME ,On-Call
	_xiwizard			windowsserver
	register			1
	}	

define service {
	host_name			DC1-PAOS-MECW01
	service_description		Drive D: Disk Usage
	use				xiwizard_windowsserver_nsclient_service
	hostgroup_name			HOSTGROUPNAME
	check_command			check_xi_service_nsclient!nagiospasswordhere!USEDDISKSPACE!-l D -w 80 -c 95!!!!!
	max_check_attempts		5
	check_interval			60
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notification_options		w,c,u,r,s,
	notifications_enabled		1
	contacts			Monitoring,service.monitoring
	contact_groups			Infrastructure,HOSTGROUPNAME ,On-Call
	_xiwizard			windowsserver
	register			1
	}	

define service {
	host_name			DC1-PAOS-MECW01
	service_description		Memory Usage
	use				xiwizard_windowsserver_nsclient_service
	hostgroup_name			HOSTGROUPNAME
	check_command			check_mem!90!95!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notification_options		w,c,u,r,s,
	notifications_enabled		1
	contacts			Monitoring
	contact_groups			Infrastructure,HOSTGROUPNAME ,On-Call
	_xiwizard			windowsserver
	register			1
	}	

define service {
	host_name			DC1-PAOS-MECW01
	service_description		Port 12 Bandwidth
	use				xiwizard_switch_port_bandwidth_service
	servicegroups			Network Interfaces
	check_command			check_xi_service_mrtgtraf!192.168.238.10_12.rrd!500,500!800,800!M!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notification_options		w,c,u,r,s,
	notifications_enabled		1
	contacts			Monitoring
	contact_groups			Infrastructure,HOSTGROUPNAME ,On-Call
	_xiwizard			switch
	register			1
	}	

define service {
	host_name			DC1-PAOS-MECW01
	service_description		Uptime
	use				xiwizard_windowsserver_nsclient_service
	hostgroup_name			HOSTGROUPNAME
	check_command			check_xi_service_nsclient!nagiospasswordhere!UPTIME!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notification_options		w,c,u,r,s,
	notifications_enabled		1
	contacts			Monitoring
	contact_groups			Infrastructure,HOSTGROUPNAME ,On-Call
	_xiwizard			windowsserver
	register			1
	}	

define service {
	host_name			DC1-PAOS-MECW01
	service_description		VMTools
	use				xiwizard_windowsserver_nsclient_service
	hostgroup_name			HOSTGROUPNAME
	check_command			check_xi_service_nsclient!nagiospasswordhere!SERVICESTATE!-l VMTools -d SHOWALL!!!!!
	max_check_attempts		5
	check_interval			20
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notification_options		w,c,u,r,s,
	notifications_enabled		1
	contacts			Monitoring
	contact_groups			Infrastructure,HOSTGROUPNAME ,On-Call
	_xiwizard			windowsserver
	register			1
	}	

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Upgrade Error - Timeperiod duplication

Post by ssax »

You have the services attached to the hostgroup:

Code: Select all

hostgroup_name         HOSTGROUPNAME
Those mean that every host in that hostgroup will get the service, that is why you are getting the duplicate warnings.

You can attach a service to a host, a hostgroup, or both.


Let us know if you have any questions.


Thank you
Phil.Pearce
Posts: 52
Joined: Fri Jul 18, 2014 7:30 am

Re: Upgrade Error - Timeperiod duplication

Post by Phil.Pearce »

Yes, sorry I searched/replaced the original text as it identifies the company/service
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Upgrade Error - Timeperiod duplication

Post by lmiltchev »

What ssax was trying to say is that if you had a service added to a host AND ALSO added to a hostgroup, that this host is a member of, you would see a "Duplicate definition found for service" warning. To clear the warning, you would need to remove the service from either the host, or the hostgroup (leave it in one place only).

In any case, configuration warnings are not errors, so they won't prevent you from applying configuraiton (restarting nagios), so you don't need to worry about them too much. It is nice to have them cleaned up though.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked