Updated to disable auto-discovery by ip #2182

Merged
merged 2 commits into from Oct 26, 2015

Projects

None yet

6 participants

@laf
Member
laf commented Oct 20, 2015

Fix #1846
Fix #1762

So it doesn't look like we can realistically find a way to counter duplicate devices being added when people are using a mix of hostnames, shortnames and IPs. This PR will now disable the auto discovery of devices via IP. You will need to enable the support via a config option. Adding devices via IP via cli/webui/api is still possible as this is manually fed.

@laf laf Updated to disable auto-discovery by ip
76f862f
@paulgear
Member

Seems reasonable to me 👍

@paszczus

It looks like a workaround, not like a real fix i guess. Why to not check if same IP is already in database instead?

@laf
Member
laf commented Oct 21, 2015

Not a work around imho. Duplicate device detection when using IPs just isn't possible with the way things are today.

@paszczus

Can`t you just check if this returns values?

SELECT hostname FROM devices GROUP BY hostname HAVING count(*) > 1;

And if yes, disable autodiscovery/adding same device?

@laf
Member
laf commented Oct 22, 2015

? That is simply returning a list of hostnames that are duplicated in the DB. We already do a distinct check on hostnames so you can't add the same hostname twice. The issue is when the same device is added by hostname, shortname and IP.

@paszczus

@laf i dont understand that. I have devices added with exactly same IP, they dont have different hostnames or shortname. So it looks like that distinct check should be also on IPs, not only on hostnames. Am i right?

@laf
Member
laf commented Oct 22, 2015

I can't see how that's possible from the code.

However this PR is not about duplicates for the same hostname, can you create a separate issue with information showing this please.

@paulgear
Member

@paszczus You can't guarantee that the same IP will not be present on multiple devices in a network. e.g. In my last job, every remote site server had an interface on 192.168.1.0/24 to talk to its local ADSL modem, but the LAN interface was how the server was identified, and that was unique.

I think this is about the best we can do; it's an unfortunate artefact of supporting those LibreNMS users who don't want to give all devices a unique hostname.

@laf I think it might be worth adding a warning to the documentation about it that it can result in duplicate devices under some circumstances.

@laf laf Updated docs
212b1c2
@laf
Member
laf commented Oct 25, 2015

Docs updated.

@SaaldjorMike SaaldjorMike merged commit a929cb9 into librenms:master Oct 26, 2015

2 checks passed

Auto-Deploy Build finished. No test results found.
Details
Scrutinizer No new issues
Details
@laf laf deleted the laf:issue-2105 branch Oct 26, 2015
@MHammett

It also doesn't seem to address what I had in my issue: #1846

I had both duplicate hostname entries as well as multiple unique hostnames, but the same physical device (router, for instance with maybe twenty different IPs, but all the same device).

@laf
Member
laf commented Oct 26, 2015

@MHammett PR #2189 fixes duplicate hostnames.

@laf
Member
laf commented Oct 26, 2015

As for the same device being added multiple times with different hostnames, we can't fix that. It's the same issue as trying to detect based on IP alone. the only real way are things like serial numbers but these just aren't available to us until after a full poll at which point it's too late.

@MHammett

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment