Discovery sees devices but are not added to LNMS

I am trying to get LNMS to add all devices it discovers via CDP but I realized yesterday it was missing some things. I have run multiple full discoveries over several days and the devices I am looking at have not changed.

Trying to make things less complex I am going to focus on 3 devices.

  1. 10.100.0.82 - Catlyst 3560 switch - existed in LNMS after initial CDP discovery
  2. 10.100.0.80 - Nexus 5548 switch - manually added to LNMS yesterday
  3. 10.100.0.81 - Nexus 5548 switch - does not exist in LNMS

Switch 10.100.0.81/mgmt0 port is connected to 10.100.0.82/Fas0/47 port. I have not added it to LNMS since I am hoping it will be discovered.

After adding 10.100.0.80 manually to LNMS and some discovery/polling cycles completed I can see the following things:

  1. 10.100.0.80/mgmt0 port connects to 10.100.0.82/Fas0/48 port
  2. 10.100.0.80 ports - neighbors shows 10.100.0.82 connected via CDP
  3. 10.100.0.80 map shows connection to 10.100.0.82
  4. 10.100.0.82 ports - neighbors does NOT show 10.100.0.80
  5. 10.100.0.82 map shows connection to 10.100.0.80

I have run a manual discovery of 10.100.0.82 like this: ./discovery.php -h 10.100.0.82 -d -m discovery-protocols -v
I can see in the output that both 10.100.0.80 and 10.100.0.81 shows up in the CDP discovery.

How can I make them show up properly as CDP neighbors? (and automatically add the devices to LNMS)

Thanks

Post the output of the discovery you ran.

Whole output was too long.
http://pastebin.com/Jd60HbQN

Run SELECTdevice_idFROMdevicesWHEREsysName= 'DC-H5-4948-10G-1.domain.com' ORhostname= 'DC-H5-4948-10G-1.domain.com'; but with the proper hostname. Does it return anything?

MariaDB [librenms]> select device_id,sysName,hostname,hardware,serial from devices where sysName like 'DC-H5-4948-10G-1%';
+-----------+-----------------------------+-------------+------------------+-------------+
| device_id | sysName                     | hostname    | hardware         | serial      |
+-----------+-----------------------------+-------------+------------------+-------------+
|        47 | dc-h5-4948-10g-1.domain.com | 10.100.0.87 | catalyst494810GE | FOX1404G7QX |
+-----------+-----------------------------+-------------+------------------+-------------+
1 row in set (0.00 sec)

So the device exists already and won’t be re-added.

Look in eventlog, it will probably list this.

I believe you have gotten confused. The device that wont add to discovery is not a catalyst.
Please look at my original post.

The detailed discovery data I posted for swich 10.100.0.82 shows I should have 9 neighbors but LNMS gui only has 7 of the 9. Even after I manually added 1 of the 2 missing devices 10.100.0.82 still only shows 7 of 9.

Figure I will add this as well. The detailed discovery is from device_id 46. I manually added device_id 1074. It is missing dc-nexus-5k-h7-2 aka 10.100.0.81.

MariaDB [librenms]> select device_id,sysName,hostname,hardware,serial from devices where hostname like "10.100.0.8%";
+-----------+-----------------------------+-------------+------------------+-------------+
| device_id | sysName                     | hostname    | hardware         | serial      |
+-----------+-----------------------------+-------------+------------------+-------------+
|      1074 | dc-nexus-5k-h7-1            | 10.100.0.80 | Nexus5548        | SSI144007GJ |
|        46 | dc-mgmt-h7.domain.com       | 10.100.0.82 | WS-C3560-48TS-S  | CAT0937Z48L |
|        51 | dc-h3-4948-10g-1.domain.com | 10.100.0.83 | catalyst494810GE | FOX1223G531 |
|        52 | dc-h3-4948-10g-2.domain.com | 10.100.0.84 | catalyst494810GE | FOX10520A9R |
|        49 | dc-h4-4948-10g-1.domain.com | 10.100.0.85 | catalyst494810GE | FOX1348GHGT |
|        50 | dc-h4-4948-10g-2.domain.com | 10.100.0.86 | catalyst494810GE | FOX1223G53S |
|        47 | dc-h5-4948-10g-1.domain.com | 10.100.0.87 | catalyst494810GE | FOX1404G7QX |
|        48 | dc-h5-4948-10g-2.domain.com | 10.100.0.88 | catalyst494810GE | FOX1404G7QZ |
+-----------+-----------------------------+-------------+------------------+-------------+
8 rows in set (0.00 sec)

MariaDB [librenms]> select device_id,sysName,hostname,hardware,serial from devices where sysName like "dc-nexus-5k-h7%";
+-----------+------------------+-------------+-----------+-------------+
| device_id | sysName          | hostname    | hardware  | serial      |
+-----------+------------------+-------------+-----------+-------------+
|      1074 | dc-nexus-5k-h7-1 | 10.100.0.80 | Nexus5548 | SSI144007GJ |
+-----------+------------------+-------------+-----------+-------------+
1 row in set (0.00 sec)

Ok I broke down and looked at the code. Here is what is going on. 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'])) {

Any chance we could make it so that it would allow invalid hostnames if discovery_by_ip is true?

Add the following config line to your Nexus switch:

cdp format device-id system-name