Warning: Duplicate , but found none.

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
lout_tie
Posts: 14
Joined: Wed Jan 18, 2017 5:28 am

Warning: Duplicate , but found none.

Post by lout_tie »

hello

I know this problem with duplicate is very common. I try to read through all the posts and helps. But none seems solve my problem

my nagios is in the directory etc/nagios3 and not in /usr/...



using nagios3 -v /etc/nagios3/nagios.cfg

Code: Select all

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config directory '/etc/nagios3/objects/commands'...
Processing object config directory '/etc/nagios3/objects'...
Processing object config directory '/etc/nagios3/objects/templates'...
Processing object config file '/etc/nagios3/objects/templates/generic-service-template.cfg'...
Processing object config file '/etc/nagios3/objects/templates/generic-host-template.cfg'...
Processing object config directory '/etc/nagios3/objects/commands'...
Processing object config directory '/etc/nagios3/objects/services'...
Processing object config file '/etc/nagios3/objects/services/services.cfg'...
Processing object config directory '/etc/nagios3/objects/hosts'...
Processing object config file '/etc/nagios3/objects/hosts/host_pi.cfg'...
Processing object config file '/etc/nagios3/objects/hosts/localhost.cfg'...
Processing object config file '/etc/nagios3/objects/hosts/host_test.cfg'...
Processing object config file '/etc/nagios3/objects/contacts.cfg'...
Processing object config file '/etc/nagios3/objects/timeperiods.cfg'...
Processing object config directory '/etc/nagios3/objects'...
Processing object config directory '/etc/nagios3/objects/templates'...
Processing object config file '/etc/nagios3/objects/templates/generic-service-template.cfg'...
Warning: Duplicate definition found for service 'generic-service' (config file '/etc/nagios3/objects/templates/generic-service-template.cfg', starting on line 2)
Error: Could not add object property in file '/etc/nagios3/objects/templates/generic-service-template.cfg' on line 3.
   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.
Folder and rights

Code: Select all

drwxr-xr-x   5 root root    4096 Feb  1 08:52 .
drwxr-xr-x 117 root root    4096 Feb  1 00:21 ..
-rw-r--r--   1 root root    2109 Okt  5  2014 apache2.conf
-rwxrwxr--   1 root root   12472 Jan 31 09:06 cgi.cfg
-rw-r--r--   1 root root    2443 Mär 15  2016 commands.cfg
drwxr-xr-x   3 root root    4096 Jan 31 10:05 conf.d
-rw-r--r--   1 root root      50 Jan 23 15:07 htpasswd.users
-rw-r--r--   1 root root   44743 Jan 31 15:43 nagios.cfg
drwxrwxrwx   6 root root    4096 Feb  1 08:15 objects
-rw-r--r--   1 root nagios  1293 Jul 29  2011 resource.cfg
drwxr-xr-x   2 root root    4096 Jan  4 12:01 stylesheets

cut outs from my nagios.cfg

Code: Select all

#
# NAGIOS.CFG - Sample Main Config File for Nagios 
#
#
##############################################################################


# LOG FILE
# This is the main log file where service and host events are logged
# for historical purposes.  This should be the first option specified 
# in the config file!!!

log_file=/var/log/nagios3/nagios.log

# Commands definitions
cfg_dir=/etc/nagios3/objects/commands

# Debian also defaults to using the check commands defined by the debian
# nagios-plugins package
cfg_dir=/etc/nagios3/objects

# Debian uses by default a configuration directory where nagios3-common,
# other packages and the local admin can dump or link configuration
# files into.
cfg_dir=/etc/nagios3/objects

# OBJECT CONFIGURATION FILE(S)
# These are the object configuration files in which you define hosts,
# host groups, contacts, contact groups, services, etc.
# You can split your object definitions across several config files
# if you wish (as shown below), or keep them all in a single config file.

# You can specify individual object config files as shown below:


#cfg_file=/etc/nagios3/objects/commands.cfg
#cfg_file=/etc/nagios3/objects/contacts.cfg
#cfg_file=/etc/nagios3/objects/timeperiods.cfg
#cfg_file=/etc/nagios3/objects/templates.cfg
#cfg_file=/etc/nagios3/objects/hosts.cfg

# Definitions for monitoring a Windows machine
#cfg_file=/etc/nagios3/objects/windows.cfg

# Definitions for monitoring a router/switch
#cfg_file=/etc/nagios3/objects/switch.cfg

# Definitions for monitoring a network printer
#cfg_file=/etc/nagios3/objects/printer.cfg


# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:

cfg_dir=/etc/nagios3/objects
#cfg_dir=/etc/nagios3/printers
#cfg_dir=/etc/nagios3/switches
#cfg_dir=/etc/nagios3/routers




# OBJECT CACHE FILE
# This option determines where object definitions are cached when
# Nagios starts/restarts.  The CGIs read object definitions from 
# this cache file (rather than looking at the object config files
# directly) in order to prevent inconsistencies that can occur
# when the config files are modified after Nagios starts.

object_cache_file=/var/cache/nagios3/objects.cache

in conf.d Directory I moved all templates in an extra folder and rename with different ending than .cfg.

The templates that I will use for my other definition I copied to ../objects/templates. I set them all to register 0



The weird thinig is doesnt matter what I do..it seems it doesnt read the cfg at all. It keeps the localhost , the default setting. I can see that in objects.cache.

When I seek for generic-service . I just one with the name as generic-service.. from the templates. Rest of it is just using the template which is alright. Since it should be inherited.

I dont know where I might have configurated it wrong. Much Appreciated!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Warning: Duplicate , but found none.

Post by rkennedy »

Please run grep -R 'generic-service' /etc/nagios3/ and post the full result - there is a duplicate somewhere and this should show us.
Former Nagios Employee
lout_tie
Posts: 14
Joined: Wed Jan 18, 2017 5:28 am

Re: Warning: Duplicate , but found none.

Post by lout_tie »

Code: Select all

 $grep -R 'generic-service' /etc/nagios3/


/etc/nagios3/objects/services/services.cfg:        use                             generic-service
/etc/nagios3/objects/services/services.cfg:        use                             generic-service
/etc/nagios3/objects/hosts/localhost.cfg:        use                             generic-service         ; Name of service template to use
/etc/nagios3/objects/hosts/localhost.cfg:        use                             generic-service         ; Name of service template to use
/etc/nagios3/objects/hosts/localhost.cfg:        use                             generic-service         ; Name of service template to use
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Warning: Duplicate , but found none.

Post by rkennedy »

That's odd, it didn't even pick up on your template file which it mentioned generic-service in. Can you please zip up your entire /etc/nagios3/ configuration directory for us to look at?
Former Nagios Employee
lout_tie
Posts: 14
Joined: Wed Jan 18, 2017 5:28 am

Re: Warning: Duplicate , but found none.

Post by lout_tie »

Hello

I was on vacation..Now I recheck my nagios setting... I lost all my original Templates..I cant remember I erased them.

Is there a way to redownload the templates or cfg files that came original in the conf.d folder?
lout_tie
Posts: 14
Joined: Wed Jan 18, 2017 5:28 am

Re: Warning: Duplicate , but found none.

Post by lout_tie »

So I just manually recreated some of the templates files. Just the one I need to check like generic-service and generic-host templates.

I zip my nagios3 folder.

doesnt matter what I do. It doesnt pick up my configuration. I checked even in the init.d . It gets the right folder. I dont even know from where he reads the files.
Attachments
nagios3_1.zip
(37.93 KiB) Downloaded 191 times
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Warning: Duplicate , but found none.

Post by rkennedy »

Everything looks fine from what I can tell. Can you try correcting this definition? I could see it messing with things potentially since it's not commented out all the way -

Code: Select all

d#efine service{
  #      use                             generic-service         ; Name of service template to use
   #     host_name                       localhost
    #    service_description             Total Processes
#		check_command                   check_procs!250!400
 #       }
Is starting fresh, on the latest version, an option for you? You're a couple years behind now version wise, and it's hard to say what could be going on with the older version, especially without knowing how it was installed / compiled. We have source instructions that should work fine on a new, clean machine. https://support.nagios.com/kb/article.p ... ategory=58
Former Nagios Employee
lout_tie
Posts: 14
Joined: Wed Jan 18, 2017 5:28 am

Re: Warning: Duplicate , but found none.

Post by lout_tie »

I commented out for a test. But whatever I do It doesnt change anything. I just used nagios3 for a test. It could just apt-get install nagios latest version. But it should have worked regardless nagios3 oder nagios4 or not? I dont know what I messed up. But I think the only option for me is to uninstall nagios and restart
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Warning: Duplicate , but found none.

Post by dwhitfield »

You're unlikely to get the latest version from apt-get. My Debian box doesn't have Nagios Core 4 in the repos at all. The best thing to do would be to compile from source: https://support.nagios.com/kb/article.php?id=96

Now, if you want to stay on your current nagios3, I'd be curious the output of find / -name nagios.cfg.
lout_tie
Posts: 14
Joined: Wed Jan 18, 2017 5:28 am

Re: Warning: Duplicate , but found none.

Post by lout_tie »

bascially it didnt find anything useful. Most indicate /var/lib/lxcfs/cgroup /... something then : No authority

I dont think this is the problem.
Locked