Page 1 of 1

mrtg error: contains a duplicate definition for target

Posted: Tue Jan 29, 2019 4:18 am
by sgargano
Dear support,

we found by chance that our graphs for routers and switches were not working after 4 days.
I found out by the logs that the problem occurred since we applied a new configuration wizard where we were adding a new interface to be monitored.
Googling the problem we found out the below string which returned the error "contains duplicate definition".

Code: Select all

env LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok

ERROR: Line 245 (Target[10.63.255.3_7]: 7:[email protected]:161::::2) in CFG file (/etc/mrtg/conf.d/10.63.255.3.cfg)
contains a duplicate definition for target[10.63.255.3_7].
First definition is on line 4
I checked the cfg file and seen that the interface no.7 were defined just once, it was not duplicated. But the error was there. I deleted the cfg file and the error gone but we have seen a lot of other errors during the execution like:

Code: Select all

SNMPGET Problem for ifHCInOctets.1 ifHCOutOctets.1 on [email protected]:::::2:v4only: No response from remote host "10.61.64.5" at /usr/bin/../lib/mrtg2/Net_SNMP_util.pm line 594.
Net_SNMP_util::snmpget('[email protected]:::::2:v4only', 'HASH(0x38ec898)', 'ifHCInOctets.1', 'ifHCOutOctets.1') called at /usr/bin/mrtg line 2330
main::getsnmparg('HASH(0x180f640)', 'HASH(0x38f03b8)', 'HASH(0x1704510)', 'HASH(0x1baac30)') called at /usr/bin/mrtg line 2510
main::readtargets('HASH(0x180f640)', 'ARRAY(0x189a428)', 'HASH(0x1704510)') called at /usr/bin/mrtg line 403
main::main called at /usr/bin/mrtg line 143
2019-01-28 17:34:12: WARNING: skipping because at least the query for ifHCInOctets.1 on  10.61.64.5 did not succeed
2019-01-28 17:34:12: WARNING: no data for ifHCInOctets&ifHCOutOctets:[email protected]. Skipping further queries for Host 10.61.64.5 in this round.
SNMPGET Problem for ifHCInOctets.2 ifHCOutOctets.2 on [email protected]:::::2:v4only: No response from remote host "62.161.55.129" at /usr/bin/../lib/mrtg2/Net_SNMP_util.pm line 594.
Net_SNMP_util::snmpget('[email protected]:::::2:v4only', 'HASH(0x33ad120)', 'ifHCInOctets.2', 'ifHCOutOctets.2') called at /usr/bin/mrtg line 2330
main::getsnmparg('HASH(0x180f640)', 'HASH(0x33afc70)', 'HASH(0x1704510)', 'HASH(0x1baac30)') called at /usr/bin/mrtg line 2510
main::readtargets('HASH(0x180f640)', 'ARRAY(0x189a428)', 'HASH(0x1704510)') called at /usr/bin/mrtg line 403
main::main called at /usr/bin/mrtg line 143
2019-01-28 17:34:12: WARNING: skipping because at least the query for ifHCInOctets.2 on  62.161.55.129 did not succeed
2019-01-28 17:34:12: WARNING: no data for ifHCInOctets&ifHCOutOctets:[email protected]. Skipping further queries for Host 62.161.55.129 in this round.
2019-01-28 17:34:12: WARNING: Skipping host chlugbi5 as it does not resolve to an IPv4 address
2019-01-28 17:34:12: WARNING: no data for ifHCInOctets&ifHCOutOctets:trap@chlugbi5. Skipping further queries for Host chlugbi5 in this round.
2019-01-28 17:34:12: WARNING: Expected a number but got 'noSuchInstance'
My questions:
Why a duplicate definition was written during the wizard configuration with no notice about the error and we had to found it by chance?
Where the right configuration is now taken after the cfg deletion?
How to fix dozens of errors found by the mrtg probably due to the obsolete cfg files that coming from the old configuration?
How we can avoid that it happens again?

Thanks for your support

Re: mrtg error: contains a duplicate definition for target

Posted: Tue Jan 29, 2019 5:11 pm
by cdienger
Make sure the system has the latest router/switch wizard(2.4.0) installed under Admin > System Extensions > Manage Config Wizards. I haven't been able to reproduce the problem with this version yet.

The configs for old systems can be removed from /etc/mrtg/conf.d/. There could also be rrd files associated with these devices under /var/lib/mrtg

Re: mrtg error: contains a duplicate definition for target

Posted: Mon Mar 04, 2019 7:47 am
by sgargano
cdienger wrote: The configs for old systems can be removed from /etc/mrtg/conf.d/. There could also be rrd files associated with these devices under /var/lib/mrtg
It's not easy to recognize which of those files are needed or not between thousands of hosts-services monitored.
Is there any tool available for this?

Re: mrtg error: contains a duplicate definition for target

Posted: Mon Mar 04, 2019 8:23 am
by scottwilkerson
you should be able to run the following to see where they are located

Code: Select all

grep 10.63.255.3_7 -R /etc/mrtg/conf.d/