I am monitoring a MikroTik router using SNMP and Zabbix. My goal is to set up alerts for when the router switches from the main ISP to the backup ISP using recursive routing.
I am able to retrieve a list of all routes successfully with the following command:
snmpwalk -v2c -c public 10.16.254.31 IP-FORWARD-MIB::ipCidrRouteMask
As you can see in my first query i get whole routing table (i just posted first line for example, but in fact there are 27 lines - all routes on this device) - objects and it’s value. But in second query when i try to get value of any route - it gives me an error. A collegue from telegram channel tried same on 3 different vendors and it works. Only on routeros it fails. I am trying to add item for mikrotik hosts in zabbix and i can’t do it using snmp query.
Can you check it on one of your devices? Thank you.
snmpwalk -Cc -v2c -c public 10.0.0.1 .1.3.6.1.2.1.4.24.4
give me 252 routes (out of total 517 listed in winbox), from line number 253 SNMP repeat endlessly route from line 252 with (fake) nexthop 0.0.0.0, until I press CTRL+C (more than 10 000 lines catched before break).
7.12.1 (two routers with same ros ver have same behaviour).
I’m actually working on the very same issue. I have over 20 stores where I need to know when we fall back to secondary ISP (SXT LTE) using zabbix. BTW, I’m using Paessler NSMP Tester and it’s been a god-send
So here’s what I have so far based on the documentation :
Using Paessler MIB Importer, I downloaded the collection provided on the software downloads section from Mikrotik’s website, but that mostly seems to monitor some of their proprietary stuff like neighbors ID-ing, System info (firmware upgrade version, serial, etc) along with other things like partitions, poe, modem.
For routing, I believe we need to use IP-FORWARD-MIB but that link seems to be the latest revision. I found this which also contains the obsolete and deprecated OIDs and some of those give me info as needed. Specifically, I was looking at the following:
To count routes:
1.3.6.1.2.1.4.24.3
To see Destination
1.3.6.1.2.1.4.24.4.1.4
For any routes heading out, I think this MIB can help filter in zabbix by only keeping all values set to 0
1.3.6.1.2.1.4.24.4.1.5
I’m still in the search for something that tells me when a route is disabled. Once I find it I’ll come back and post to see if this can help you generate a trigger for that.
My earlier post just got approved but, I think I found a way to monitor this using IP-FORWARD-MIB
Specifically ipCidrRouteStatus
1.3.6.1.2.1.4.24.4.1.16
Example: I have a site that has been in failover due to an issue, so I can compare the output of one versus another. I’ve configured my routers like this example:
So based on this, walk the following OID to get your:
0.0.0.0 routes
1.3.6.1.2.1.4.24.4.1.16.0.0.0.0
In my case, I’m using zabbix to check that 9.9.9.9 exists in the walk of the OID. Trigger an alert if it doesn’t because that mean’s it’s not active. I have tested consistently across devices that have 9.9.9.9 and those that do not.
On the Zabbix side:
I’m creating an Item of type SNMP Agent, SNMP OID is walk[1.3.6.1.2.1.4.24.4.1.16.0.0.0.0.0.0.0.0.0]
Under Preprocessing, add > Regular expression > Parameter: (1.3.6.1.2.1.4.24.4.1.16.0.0.0.0.0.0.0.0.0.9.9.9.9).* > Output set to OK > Custom on Fail checked > Select “Set value to” and type in FAILED
This will check that 9.9.9.9 exists (like on Device: 1.2.3.4’s response) and create a trigger for when the value is FAILED.
Hope this helps, just got to work on it today and I realized there’s a few devices that don’t have my route