Page 1 of 1

Duplicate definition for service on host 'localhost'

Posted: Tue Apr 29, 2014 1:20 pm
by PhilG
Hello.
I'm running Nagios XI version 2012R2.9 on Red Hat Linux 6.5

Last week I worked with Nagios Tech Support and we were able to remove all the existing Services and Hosts and get back the Localhost.

I attempted to run a Windows WMI monitor to add a Windows server, and noted error messages in the Config file that was created, so I did not apply the configuration.

I now note the following in the Event Log that confirms some of the error messages in the Configuration files and wonder if this can be fixed and how, and after fixing these, will I be able to successfully run a new Windows monitor wizard add?
Configuration Warning2014-04-29 07:57:18Warning: Duplicate definition found for service 'Current Load' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 14)
Configuration Warning2014-04-29 07:57:18Warning: Duplicate definition found for service 'Current Users' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 22)
Configuration Warning2014-04-29 07:57:18Warning: Duplicate definition found for service 'HTTP' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 30)
Configuration Warning2014-04-29 07:57:18Warning: Duplicate definition found for service 'PING' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 38)
Configuration Warning2014-04-29 07:57:18Warning: Duplicate definition found for service 'Root Partition' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 46)
Configuration Warning2014-04-29 07:57:18Warning: Duplicate definition found for service 'SSH' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 54)
Configuration Warning2014-04-29 07:57:18Warning: Duplicate definition found for service 'Swap Usage' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 62)
Configuration Warning2014-04-29 07:57:18Warning: Duplicate definition found for service 'Total Processes' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 70)



Thank you.

Re: Duplicate definition for service on host 'localhost'

Posted: Tue Apr 29, 2014 1:55 pm
by slansing
Those are warnings not errors, they would not stop the apply config from running. What were the errors you received? They should show you exactly what you need to change to resolve the issue.

These duplicate definitions are curious, have you tried finding them in the CCM and removing them?

Re: Duplicate definition for service on host 'localhost'

Posted: Wed Apr 30, 2014 10:53 am
by PhilG
slansing wrote:Those are warnings not errors, they would not stop the apply config from running. What were the errors you received? They should show you exactly what you need to change to resolve the issue.

These duplicate definitions are curious, have you tried finding them in the CCM and removing them?

1). Regarding the errors
"Error: Check period 'xi_timeperiod_24x7' specified for service '<service name>' on host '<new host we were trying to add>' is not defined anywhere!",
I went into the Configure menu - Advanced Configuration - Legacy CCM - Alerting - Time Periods, and noted that the Time Period Management "Time Period" named "xi_timeperiod_24x7" was not Active, the Description and Template Name were blank, the Active option was checked but greyed out, and the Time definitions were not defined.
Is there way to restore this, since the other 6 Time Periods exist, are active, and are defined?

2). Regarding the following warnings, further below between the asterisks:
I identified that the following existed in /usr/local/nagios/etc/hosts:
localhost.cfg
<my new server host>.cfg

I identified that the following existed in /usr/local/nagios/etc/services:
localhost.cfg
localhost_services.cfg
<my new server host>.cfg

It appears that the localhost config file was duplicated somehow.
The timestamp of localhost_services.cfg was
"# Date: 2014-04-25 11:37:58"

The timestamp of localhost.cfg was
"# Date: 2014-04-25 11:55:35"

Should I delete one of the files (which one), and then Apply Configs in the console, or ???

*************** Warnings *************
Warning: Duplicate definition found for service 'Total Processes' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 70)
Warning: Duplicate definition found for service 'Swap Usage' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 62)
Warning: Duplicate definition found for service 'SSH' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 54)
Warning: Duplicate definition found for service 'Root Partition' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 46)
Warning: Duplicate definition found for service 'PING' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 38)
Warning: Duplicate definition found for service 'HTTP' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 30)
Warning: Duplicate definition found for service 'Current Users' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 22)
Warning: Duplicate definition found for service 'Current Load' on host 'localhost' (config file '/usr/local/nagios/etc/services/localhost_services.cfg', starting on line 14)
Read object config files okay...
*****************************************

3). I noted that there is only one Host Group (linux-servers) that is Active and defined - "windows-servers" is not Active nor defined. I do not know if there were any defined Service Groups initially. Should there be?

Should I re-run the Nagios XI update setup again?

Re: Duplicate definition for service on host 'localhost'

Posted: Wed Apr 30, 2014 11:43 am
by lmiltchev
1) Modify the "xi_timeperiod_24x7" in the Core Config Manager, so that you would have:

Timeperiod Name = xi_timeperiod_24x7
Description = 24x7
monday 00:00-24:00
tuesday 00:00-24:00
...
sunday 00:00-24:00
Active = checked

Save, but don't apply configuration. Run the Write Config Tool to check for config errors (CCM->Tools->Write Config Files). If there are no errors (warnings are OK), apply configuration.

2) You need to delete the duplicate in the CCM, run the Write Config Tool to check for config errors, and apply configuration (if there are no errors). If you already removed the duplicates in the CCM, but they still show up in the GUI, this means that you may have a "ghost" host/service. Check the timestamps:

Code: Select all

ll /usr/local/nagios/etc/hosts | grep localhost
ll /usr/local/nagios/etc/services | grep localhost
If you have a config that is not updating, remove it manually from the CLI:

Code: Select all

cd /usr/local/nagios/etc/hosts
rm -f <ghost config>.cfg
cd /usr/local/nagios/etc/services
rm -f <ghost config>.cfg
3) This is normal. If you have any windows hosts, add them as members to "windows-servers" (CCM->Host Groups->windows-servers->Modify), select the "Active" checkbox, save and Apply Configuration.

Re: Duplicate definition for service on host 'localhost'

Posted: Wed Apr 30, 2014 2:49 pm
by PhilG
Okay, I did apply your instructions in 1). and it appears that worked fine.

As per 2)., I am not seeing any duplicate localhost in Monitoring - Hosts or Monitoring - Services.
I identified /usr/local/nagios/etc/services/localhost_services.cfg
was not updating so deleted that file.

As per 3)., I went into Monitoring - Host Groups, and modified "windows-servers" since there was no Description, and then made it active.

Thank you.

Re: Duplicate definition for service on host 'localhost'

Posted: Wed Apr 30, 2014 2:54 pm
by lmiltchev
I am glad I could help! :D
I am locking this topic. If you have any more questions/issues, please, start a new thread.