Modify 'discovery-protocols.inc.php' to fix neighbours problem on Extreme Networks EXOS switch

snmp
Tags: #<Tag:0x00007fe224aa7ba8>

#1

Hi,
I am new here and first time to post. I come form Macao. I work at a company where are many Extreme switches. I am testing and plan to deploy LibreNMS if boss accept. Before then, I found there a bug about neighbours tab disappear or cannot recognized remote port, even two switches connected each other and added to LibreNMS. I have found the bug and tested in physical switches. The end, I fixed it by adding codes to ‘discovery-protocols.inc.php’.


PHP File: Modified discovery-protocols.inc.php https://drive.google.com/open?id=1itqtA4PzEqUnLAh4OhdPf9YhA1jTJyTH

To reproduce, I tested again with Extreme official VM image, and two VM switches were added to LibreNMS and connected between with their port 1.
IMG: switch-1 ports ht-tps://drive.google.com/open?id=1Y6yAV4E8Sp75JYTLqPFN52EitVei2ZGR
IMG: switch-2 ports ht-tps://drive.google.com/open?id=136M3tUiqLnSuwuEi7qmkWV5jviN6UfeL

The bug is caused by SNMP polling switch-1 with ifIndex to DB (associate ifIndex when adding switch), the port “1” is “1001”. Another switch-2 discover the switch-1 port “1” by LLDP is “1” (after LiberNMS get this information). Two values are not equal (“1001” != “1”). If I change to use ifName associate when adding device, because ifName is “1:1”, so it can not equal to LLDP too (“1:1” != “1”).
IMG: DB ports.ifIndex != links.remote_port (LLDP Port Id) ht-tps://drive.google.com/open?id=1BEE0qUGNXTZC88a3qDIED5Ec4LfgYQ5D
IMG: Ports table from SNMP ht-tps://drive.google.com/open?id=1BX4DmoCvRyDHtZp-dwU8s_itm6xo-pSg
IMG: LLDP details from two swtiches ht-tps://drive.google.com/open?id=1ZB2hyfvuAHR8hZ8s0RVHIySGp3KUp-iq

As above photo, the LLDP advertise ‘Port ID’ is a number (store as string), and it also advertise “Port description” after I set 'configure port 1 display-string “XXXXX” '.
IMG: LLDP port description after configure … display-string ht-tps://drive.google.com/open?id=1IUjLIqXg8Kt-74RGJYK_UY83JJy_MK5o

To my company switches, many of switches are stacking, the port ID from LLDP will be “1:1”, ifIndex still 1001. (VM does not support stacking, and I am not able to provide physical switch photo, sorry!) So, if I use ifName to associate when adding switch, it may work on stacking switch (doesn’t work on non-stacking switch). On the other hand, I can configure ‘display-string’ to get LLDP “Port description” same as ifDescr from SNMP, and associate with iDescr when adding switch. It also not good because much work and maybe typo (every switch and ports much configure ‘display-string’. So, I choose to add code to LibreNMS to convert LLDP Port id value to equal to ifIndex.

As a result, ‘links’ table get the right ‘remote_port’ value, equal to ifIndex. ‘Neighbours’ tab appear and recognized remote ports.
IMG: DB ports.ifIndex == links.remote_port ht-tps://drive.google.com/open?id=19S3hT1_GyHxsMqIUEaOSHElou1s_UD7E
IMG Neighbours tab appear and recognized remote port
ht-tps://drive.google.com/open?id=1Ftit-lbVhBlWquZXc0HCSEZdFgl3ZRHI

Further, map appear correct.
IMG: Map also appear ht-tps://drive.google.com/open?id=1LvpvkRP8qr9xajkdegydZ9ytbwQ6LnUB

2019-03-22T16:58:00Z


#2

Hi!

First, thank you for your post.

You can actually pull request that code to be inserted in the main code:

https://docs.librenms.org/Developing/Using-Git/


#3

OK, I will try tomorrow.