We have a jack lookup tool available for users at our university. It gives basic information about the network jacks available around campus (e.g. port description, VLAN, speed/duplex, MAC address, etc.) It uses Libre’s DB to find all of that info. We’ve had requests to add a couple of fields (maximum allowed MAC addresses and if sticky MAC’s is enabled). Those OID’s are not polled by default in Libre I couldn’t figure out how to get it to poll for them. So I decided to write a script that polled those. I added two columns to the end of the “ports” table (ifMaxMacAllowed and ifStickyMacEnabled) using the below statements:
ALTER TABLE ports
ADD ifMaxMacAllowed INT NOT NULL;
ALTER TABLE ports
ADD ifStickyMacEnabled CHAR(1) NOT NULL;
My script would then populate all of the new fields with the results from the script after figuring out what row the data belonged in. My script used mysql.connector to connect to the db and run the statements. It would use the below statement to update the row:
UPDATE ports
SET ifMaxMacAllowed = [int], ifStickyMacEnabled = ‘[y/n]’ WHERE ifAlias = [port description] AND ifDescr = [port #]
Everything worked well. All of the rows were updated with the correct data. However, I discovered (a few days later) the MAC addresses from the “ports_fdb” and “ipv4_mac” tables had somehow been deleted. We have been able to repopulate the fields so that part is fine. We reverted everything back to the way it was so it could pass validation.What I don’t know is how/why the MAC addresses were deleted. My script did not poll all of our switches (DC and others were left out), and only the switches polled by my script were affected. I’m not very knowledgeable with DB’s and their design; I just know a little SQL. Should I have done this differently? Any help would be appreciated.
mradams
When asking for help and support, please provide as much information as possible. This should include:
- Steps to reproduce an issue.
- The output of
./validate.php
If it’s an issue with the WebUI then please consider including a screenshot and the browser version you are using.
If you are having troubles with discovery/polling include the pastebin output of:
./discovery.php -h HOSTNAME -d | ./pbin.sh
./poller.php -h HOSTNAME -r -f -d | ./pbin.sh
If you need to post any text longer than a few lines, please use a pastebin service such as https://p.libren.ms using non-expiring pastes.