BUG? Issue with SNMP OID Query for Specific Route on MikroTik Router

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

IP-FORWARD-MIB::ipCidrRouteMask.0.0.0.0.0.0.0.0.0.8.8.8.8 = IpAddress: 0.0.0.0

But this command generates an error:

snmpwalk -v2c -c public 10.16.254.31 IP-FORWARD-MIB::ipCidrRouteMask.0.0.0.0.0.0.0.0.0.8.8.8.8

IP-FORWARD-MIB::ipCidrRouteMask.0.0.0.0.0.0.0.0.0.8.8.8.8 = No Such Object available on this agent at this OID

Any ideas or suggestions?

P.S. RoS 7.15.2 - checked several stable releases - 7.10.2, 7.12.1, 7.14.2

Have you tried to snmptranslate the hole Mikrotiks own mib.
To see if there is the field that you looking for.

curl -O https://download.mikrotik.com/routeros/7.15.2/mikrotik.mib
snmptranslate -Tz -m ./mikrotik.mib

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.

Anyone who who have good skills in SNMP or anyone from Mikrotik - hlp me pls.

Hello Mikrotik - i need support:

https://help.mikrotik.com/servicedesk/servicedesk/customer/portal/1/SUP-160152

Have similar problem

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).

It happening even if I perform SNMWALK without OID specified, reading whole SNMP tree

.1.3.6.1.2.1.4.24.4.1.1.10.12.33.192.255.255.255.224.0.0.0.0.0 10.12.33.192
.1.3.6.1.2.1.4.24.4.1.1.10.12.34.12.255.255.255.252.0.0.0.0.0 10.12.34.12
.1.3.6.1.2.1.4.24.4.1.1.10.12.34.16.255.255.255.252.0.10.12.102.140 10.12.34.16
.1.3.6.1.2.1.4.24.4.1.1.10.12.34.20.255.255.255.252.0.10.12.102.140 10.12.34.20
.1.3.6.1.2.1.4.24.4.1.1.10.12.34.20.255.255.255.252.0.0.0.0.0 10.12.34.20
.1.3.6.1.2.1.4.24.4.1.1.10.12.34.20.255.255.255.252.0.0.0.0.0 10.12.34.20
.1.3.6.1.2.1.4.24.4.1.1.10.12.34.20.255.255.255.252.0.0.0.0.0 10.12.34.20

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 :sunglasses:

So here’s what I have so far based on the documentation :



Used MIBs in RouterOS:

MIKROTIK-MIB
MIB-2
HOST-RESOURCES-MIB
IF-MIB
IP-MIB
IP-FORWARD-MIB
IPV6-MIB
BRIDGE-MIB
DHCP-SERVER-MIB
CISCO-AAA-SESSION-MIB
ENTITY-MIB
UPS-MIB
SQUID-MIB

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:

/ip route
add comment="Carrier 3 - Out" disabled=no distance=1 dst-address=8.8.4.4/32 \
    gateway=192.168.88.1 pref-src="" routing-table=main scope=10 \
    suppress-hw-offload=no target-scope=10
add comment="Carrier 1 - Out" disabled=no distance=1 dst-address=9.9.9.9/32 \
    gateway=123.456.789.123 pref-src="" routing-table=main scope=10 \
    suppress-hw-offload=no target-scope=10
add check-gateway=ping comment="Carrier 1 - Check" disabled=no distance=1 \
    dst-address=0.0.0.0/0 gateway=9.9.9.9 pref-src="" routing-table=main scope=\
    10 suppress-hw-offload=no target-scope=11
add check-gateway=ping comment="Carrier 3 - Check" disabled=no distance=2 \
    dst-address=0.0.0.0/0 gateway=8.8.4.4 pref-src="" routing-table=main scope=\
    10 suppress-hw-offload=no target-scope=12

Using Paessler I get something like this in response from a router NOT in failover:

Paessler SNMP Tester - 23.3.87.552 Computername: LTM1
12/18/2024 2:59:42 PM (13 ms) : Device: 1.2.3.4
12/18/2024 2:59:42 PM (20 ms) : SNMP v1
12/18/2024 2:59:42 PM (24 ms) : Walk 1.3.6.1.2.1.4.24.4.1.16
12/18/2024 2:59:42 PM (94 ms) : 1.3.6.1.2.1.4.24.4.1.16.0.0.0.0.0.0.0.0.0.8.8.4.4 = "1" [ASN_INTEGER]<<<Notice both of my routes
12/18/2024 2:59:42 PM (165 ms) : 1.3.6.1.2.1.4.24.4.1.16.0.0.0.0.0.0.0.0.0.9.9.9.9 = "1" [ASN_INTEGER]<<Exist here
12/18/2024 2:59:42 PM (226 ms) : 1.3.6.1.2.1.4.24.4.1.16.8.8.4.4.255.255.255.255.0.192.168.1.1 = "1" [ASN_INTEGER]
12/18/2024 2:59:42 PM (287 ms) : 1.3.6.1.2.1.4.24.4.1.16.9.9.9.9.255.255.255.255.0.192.168.200.254 = "1" [ASN_INTEGER]

And this from a device IN failover:

Paessler SNMP Tester - 23.3.87.552 Computername: LTM1
12/18/2024 3:00:17 PM (18 ms) : Device: 1.2.3.5
12/18/2024 3:00:17 PM (23 ms) : SNMP v1
12/18/2024 3:00:17 PM (29 ms) : Walk 1.3.6.1.2.1.4.24.4.1.16
12/18/2024 3:00:17 PM (120 ms) : 1.3.6.1.2.1.4.24.4.1.16.0.0.0.0.0.0.0.0.0.8.8.4.4 = "1" [ASN_INTEGER]<<<Notice only active shows up
12/18/2024 3:00:17 PM (210 ms) : 1.3.6.1.2.1.4.24.4.1.16.8.8.4.4.255.255.255.255.0.192.168.200.1 = "1" [ASN_INTEGER]
12/18/2024 3:00:17 PM (300 ms) : 1.3.6.1.2.1.4.24.4.1.16.9.9.9.9.255.255.255.255.0.123.456.789.123 = "1" [ASN_INTEGER]
12/18/2024 3:00:17 PM (397 ms) : 1.3.6.1.2.1.4.24.4.1.16.10.0.0.0.255.255.255.0.0.172.31.253.254 = "1" [ASN_INTEGER]

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:

  1. 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]
  2. 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 :open_mouth: