BGP prefix counts + IPv6 BGP peers for MikroTik RouterOS v7 — testers wanted

Hi all,

LibreNMS shows MikroTik BGP sessions, but the Prefixes graphs stay empty, and IPv6 BGP peers don’t show up at all. That’s not a LibreNMS bug. RouterOS v7 only exposes a small part of the BGP4-MIB over SNMP: no prefix counters, and no way to describe IPv6 peers. MikroTik has been asked to add it, but until then the data simply isn’t there.

So I built a LibreNMS plugin that reads the data straight from the routers instead (read-only):

  • Prefix counts go into the same place LibreNMS stores them for Cisco, Juniper and others, so the built-in Routing → BGP → Prefixes graphs and the list_cbgp API just work for MikroTik.
  • IPv6 BGP sessions are added as normal LibreNMS BGP peers: state, AS, uptime, prefix and update graphs, and BGP Session Up/Down events, so the BGP alert rules work for IPv6 too.
  • It runs as part of the normal device poll, so no extra cron job or service is needed.
  • Connect your way: SSH, RouterOS API, API-SSL, or REST over HTTP/HTTPS, with custom ports and per-router overrides.
  • On the settings page: Test and Poll now per router, Poll all now, and an Update now button.

Install (it uses LibreNMS’s own lnms plugin:add):
curl -fsSLO https://raw.githubusercontent.com/SirZeruks/librenms-routeros-bgp/main/install.sh
less install.sh
sudo bash install.sh
Then go to Overview → Plugins → Plugin Admin → routeros-bgp → Settings. The step-by-step manual is in the repo. Please use a read-only router user; the manual shows how.

Repo: GitHub - SirZeruks/librenms-routeros-bgp: LibreNMS plugin: BGP prefix counts and IPv6 BGP peers for MikroTik RouterOS v7 (REST, API, API-SSL or SSH) · GitHub

It’s running here on 24 production RouterOS 7.24 routers over SSH. The other connection methods and the IPv6 support are tested against RouterOS 7.23.

I’d really like feedback from other setups: other RouterOS versions, other connection methods, bigger BGP tables. If you try it, please open an issue on GitHub with your LibreNMS version, RouterOS version, connection method, and the output of sudo -u librenms ./lnms routeros-bgp:poll --test (remove anything private). “It works” reports help just as much.

Use at your own risk: it’s GPL-3.0, provided as is.