Ever have "duplicate" issues?

71 views
Skip to first unread message

William Pool

unread,
Sep 23, 2016, 4:29:59 PM9/23/16
to nagrestconf-users
So, I've been testing our production setup a lot with a bunch of DEV system restore backups. 

Most the time it works, I but then I encounter issues like the following:

Warning: Duplicate definition found for hostgroup 'mgmt' (config file '/etc/nagios/objects/local/local_hostgroups.cfg', starting on line 6)
Error: Could not add object property in file '/etc/nagios/objects/local/local_hostgroups.cfg' on line 7.
   Error processing object config files!

It's always something with the mgmt or svctmpl-contacts and I can't seem to figure what it is.

Then it's a SNAFU to get things working again.

Anyone run into this?

William Pool

unread,
Sep 23, 2016, 7:45:24 PM9/23/16
to nagrestconf-users
Okay, I created backups from my dev setup and started to restore.

I started off with the commands and time periods; good

Then I restored contacts and contact groups; good

Then I restored templates; good

Then I restored servicesets; good

Then I created a HOSTGROUP named: PROD UTIL

Since, I had NO nodes in the list and nagios would fail, I decided to add itself with the values:

name: nagios-prod
alias: nagios-prod
IP Address: 127.0.0.1
Service Sets: PROD LINUX
HostTemp: hosts-prod
HostGroup: PROD-UTIL

Completely NEW system being added NO previous systems added.

Then I get the duplicate error again:

The output on the apply is:

Reading configuration data...
   Read main config file okay...
Warning: Duplicate definition found for hostgroup 'PROD-UTIL' (config file '/etc/nagios/objects/local/local_hostgroups.cfg', starting on line 6)
Error: Could not add object property in file '/etc/nagios/objects/local/local_hostgroups.cfg' on line 7.
   Error processing object config files!

The directory is owned via Apache and group'd nagios which is how my dev system is that works

The file in question has

cat /etc/nagios/objects/local/local_hostgroups.cfg

#################################################################

#         THIS FILE WAS CREATED BY THE CSV2NAG SCRIPT           #

#   DON'T MODIFY THIS FILE. ALL CHANGES WILL BE OVERWRITTEN     #

#################################################################


define hostgroup {

    hostgroup_name    PROD-UTIL

    alias             PROD UTIL

}


Trying to find the duplicate . . .

[root@lakana-prod-nagios01-us-east-1a local]# pwd

/etc/nagios/objects/local

[root@prod-nagios01-us-east-1a local]# grep -i util *

local_hostgroups.cfg:    hostgroup_name    PROD-UTIL

local_hostgroups.cfg:    alias             PROD UTIL


Only seeing one . . .

/etc/nagios/objects/local/local-nodes/PROD-UTIL

[root@prod-nagios01-us-east-1a PROD-UTIL]# grep util *

[root@prod-nagios01-us-east-1a PROD-UTIL]# cat nagios-prod.cfg 

#################################################################

#         THIS FILE WAS CREATED BY THE CSV2NAG SCRIPT           #

#   DON'T MODIFY THIS FILE. ALL CHANGES WILL BE OVERWRITTEN     #

#################################################################


define host {

       use             host-prod

       host_name       nagios-prod

       alias           nagios-prod

       address         127.0.0.1

       hostgroups      PROD-UTIL


What am I missing? This is totally frustrating me. 

Running 1.174.6

Thanks for any insight! 

Mark Clarkson

unread,
Sep 25, 2016, 6:17:45 PM9/25/16
to nagrestc...@googlegroups.com
I'll have a proper look at this tomorrow but the "Warning: Duplicate definition found... " message is from 'nagios -v /etc/nagios/nagios.cfg'.

Check /etc/nagios/nagios.cfg to see if it's bringing in more than just 'cfg_dir=/etc/nagios/objects/local'. I can't think of any other reason for it finding duplicates that aren't in the local/ directory.

If you don't see anything wrong there then please post the entire output from 'nagios -v /etc/nagios/nagios.cfg'. 
--
You received this message because you are subscribed to the Google Groups "nagrestconf-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nagrestconf-us...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William Pool

unread,
Sep 26, 2016, 12:12:50 PM9/26/16
to nagrestconf-users

The duplicate in nagios.cfg was it. I don't know why, but I'm thinking Ansible added it back is my guess. 

THanks, I am the only one on this project, so I'm hitting that burn-out phase bags!

Mark Clarkson

unread,
Sep 26, 2016, 1:25:03 PM9/26/16
to nagrestconf-users
No problem! I've got your back.
Reply all
Reply to author
Forward
0 new messages