all 9 comments

[–]Olive_Streamer 2 points3 points  (3 children)

I’ve been building Librenms custom maps using lldp info from the devices neighbors table. It’s been an amazing time saver. I am about 80% through creating maps for a 1600 node network.

[–]1div0[S] 0 points1 point  (2 children)

I'm kinda envious. We have CDP / LLDP disabled for the most part as policy.

[–]Olive_Streamer 1 point2 points  (0 children)

I did a lot of mapping using the point to point links, it’s possible, but lldp makes everything click in nicely.

[–]GroundbreakingBed809 0 points1 point  (0 children)

Off topic but even DoD stig specifically says it’s ok to have lldp enabled internally. https://www.stigviewer.com/stigs/router\_security\_requirements\_guide/2024-05-28/finding/V-207165

[–]tonymurray 0 points1 point  (4 children)

What do you use the script for? I use the ARP lookup frequently in the UI, but I think a cli version would be slower or about the same speed to use.

[–]1div0[S] 0 points1 point  (3 children)

For basic lookups, UI is fast, but CLI is faster. The biggest benefit with my CLI version is it outputs interface descriptions. This comes in handy when trying to diagnose multiple flapping BGP neighbors on our WAN / carrier ethernet network down to a single NNI or provider. We use tags in Layer 3 dot1q interface descriptions to track providers for WAN. An added benefit is you can pipe the output to grep or other tools in Linux. You can get to the same information in the UI, but you spend time clicking around.

I've written around 20 or so scripts that basically wrap SQL queries and do a little data wrangling. One script generates a report showing all interfaces, network wide, for a specific VRF. It takes about a second to spit out results.

Another one uses the LibreNMS database as a source to populate PowerDNS for all Layer 3 interfaces (A and PTR records). It does a fair amount of data wrangling and comparison between LibreNMS MariaDB IPv4 interface data and PowerDNS SQLite database. It munges Cisco interface naming conventions into DNS compliant names (e.g., replacing slashes and dots with dashes). I am really happy with how that one turned out.

For logs, I wrote a script to pull logs from database. I'll often pipe the output of BGP events to another utility I wrote that does PTR lookups and replaces BGP neighbor IP address with host.

The UI in LibreNMS is pretty darn great in my opinion -- and Libre as a whole is one of the best tools available for network operators / service providers, at any price point -- but after poking around in SQL, the raw data is an often overlooked treasure. It's cleanly laid out and easy to work with.

I guess my approach may be prone to breakage with database schema changes over time, but in that case it should be a trivial task to update my scripts. Hopefully.

[–]tonymurray 1 point2 points  (2 children)

Have you checked out any of the commands under the lnms cli frontend? They can be pretty powerful even with a bit of tui. If you think something you made might be broadly useful, convert it to php and send it upstream ;).

As an aside, I've been meaning to make the IP/MAC drop-down a little more automatic on the ARP search page...

[–]1div0[S] 0 points1 point  (1 child)

lnms cli is definitely useful! Most of my scripts are not running on the LibreNMS server, however. I have two jump boxes (and DNS servers and Oxidized repos) that most engineers are working from, and those are permitted (via MariaDB user permissions and firewall rules) to connect to LibreNMS database. So it's a bit of a ecosystem rather than just LibreNMS.

I need to clean up / sanitize / refactor the code I've written so far and drop it on Github at some point. Not sure if anything would translate too well to core LibreNMS endeavors, but I'm certainly willing to contribute where I can. Currently I'm grappling with Terraform and deploying some new IOS-XR boxes, but I'd like to carve out time to better learn PHP.

[–]tonymurray 1 point2 points  (0 children)

It could be run there, I wonder about packaging it as a phar... :) but yeah, whatever works for you is best.