Discovery failing for invalid hostnames even when discovery_by_ip enabled #5525

Closed
towster opened this Issue Jan 20, 2017 · 0 comments

Projects

None yet

2 participants

@towster
Contributor
towster commented Jan 20, 2017

DO NOT DELETE THIS INFORMATION.

Please read this information carefully.

GitHub issues is for feature requests or bugs, please do not post issues asking for help or how to do X, Y or Z.
You can use our irc channel ##librenms on freenode to ask questions or our community site.

Please confirm each of the sections below by putting an x in the box like [x].

  • Is your install up to date? Updating your install
    Please do not submit an issue if your install is not up to date within the last 24 hours or on a stable monthly release.
  • Please include all of the information between the ==================================== section of ./validate.php which you can run from the cli.
  • Unless your issue is for a WebUI fix or feature then please provide ALL info asked for here.
  • Please provide as much detail as possible.
  • Please do NOT post more than 10 lines of debug information here, use a pastebin service or GitHub Gists.
==========================================================Component Version
LibreNMS 81bde0b
DB Schema 156
PHP 7.0.14
MySQL 5.5.52-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2
==========================================================

Lots of info on the issue is posted here:
https://community.librenms.org/t/discovery-sees-devices-but-are-not-added-to-lnms/438/9

TL;DR; The two devices that are missing are:

    [cdpCacheDeviceId] => DC-NEXUS-5K-H7-2(SSI144007HH)
    [cdpCacheDeviceId] => DC-NEXUS-5K-H7-1(SSI144007GJ)

They are failing to pass this condition in discovery-protocols.inc.php:

        if (is_valid_hostname($cdp['cdpCacheDeviceId'])) {

I am thinking it should be changed to something like:

            if (is_valid_hostname($cdp['cdpCacheDeviceId']) || ($config['discovery_by_ip'] == true)) {

I have tested that on my install and will submit patch for this..

@laf laf added a commit that referenced this issue Jan 26, 2017
@towster @laf towster + laf fix: Fix for issue #5525
* Update discovery-protocols.inc.php

Allow invalid hostnames if discovery by IP is true

* Update AUTHORS.md

signing

* Update AUTHORS.md

signing

* CDP discovery by IP modification

CDP would not discover devices that had invalid DNS value for cdpCacheDeviceId - modified to accept 
Also exclude adding devices whose hostname matches the IP

* Update AUTHORS.md

* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.

I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.
3fb65da
@laf laf closed this Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment