Open the file in something like Notepad++ and search for DHCP. It should be arround .1.3.6.1.2.1.9999.1.1.1.1.0.
The next OID will tell you where to look in the walk to find the DHCP server information. Mine returned 1.3.6.1.4.1.14988.1
Looking under there the number of active leases for my single scope was in .1.3.6.1.4.1.14988.1.1.6.1.0 There should be a Gauge32 value for each scope.
I have skipped use SNMP, since I need to set up SNMP for each new router. Instead I make the router send me the data using Syslog, including DHCP pool information.
This is not correct, there always is only a single number (the total number of entries) there even when you have more than one DHCP scope!
To find the number of leases per scope you need to walk the .1.3.6.1.2.1.9999.1.1.6.4.1.4 OID and group/count the entries (the address is part of the OID, the value of each entry is the type static/dynamic/waiting).
Seems to be a bug in RouterOS when getting DHCP information. I have around 200 addresses in my DHCP scopes. This show the bottom part of the log, and you see snmpwalk from linux fails not getting all leases.
That is true, it is a bug in RouterOS but you can work around it by passing the “-Cc” flag to snmpwalk.
(I would recommend using snmpbulkwalk -v2c for such long lists, but it requires the same flag to work around this bug)
snmpbulkwalk -Cc -v2c -c public router .1.3.6.1.2.1.9999.1.1.6.4.1.4
This was already mentioned in reply #3, the OID .1.3.6.1.4.1.14988.1.1.6.1.0 is the numeric value of MIKROTIK-MIB::mtxrDHCPLeaseCount.0
However, there is always only a .0 and there is no separate DHCPLeaseCount per pool or per DHCP scope.
That is why the solution is to walk the list of DHCP leases and group them by address in some external script.
Total number of leases is sufficient for my purposes, though I can certainly see a use case for getting the totals of each pool (and count of pools) if the RouterOS devs are ever bored (unlikely).
Next question: Is there a way to get a count of “available” dhcp leases or a count of “remaining” dhcp leases?
I’d like to set up a Zabbix trigger to tell me if the pool is nearing exhaustion. ie: % of remaining available leases is less than 20.
No, it is not available. You will have to write your own script to count the number of leases and calculate the percentage based on the size of your pools.
You can do this on the system running Zabbix or (in theory) also on the router itself, because you can write RouterOS scripts that are invoked when you read a user-defined OID.
But I am not going to help you with that! Writing and debugging RouterOS scripts is a frustrating affair.