Hi,
I want to count the number of dhcp leases in ROS,
for now I use
array_find(oid_column(“1.3.6.1.2.1.9999.1.1.6.4.1.4”),“dynamic (2)”)
but array_find only returns the number of the first row in the array where it finds “dynamic (2)”.
So, great to find IF there are any dynamic leases …
It returns 8 here because that is the 1st row which matches.
BUT I want to count the number of rows which contain “dynamic (2)”
any suggestions ?
You might want to know that the OID .1.3.6.1.4.1.14988.1.1.6.1.0 (MIKROTIK-MIB::mtxrDHCPLeaseCount.0) directly returns the total number of leases.
That wil give me the total number, including the expired … I want the total for active static and active dynamic
It does not include the expired leases. But it does include the static ones.
That is strange, it does here :
snmpwalk -v2c -c public -On mt .1.3.6.1.4.1.14988.1.1.6.1
.1.3.6.1.4.1.14988.1.1.6.1.0 = Gauge32: 66
snmpwalk -v2c -c public -On mt .1.3.6.1.2.1.9999.1.1.6.4.1.4 | wc -l
66
the array .1.3.6.1.2.1.9999.1.1.6.4.1.4 includes the expired static leases
static :
snmpwalk -v2c -c public -On mt .1.3.6.1.2.1.9999.1.1.6.4.1.4 | grep INTEGER:\ 1 | wc -l
31
dynamic :
snmpwalk -v2c -c public -On mt .1.3.6.1.2.1.9999.1.1.6.4.1.4 | grep INTEGER:\ 2 | wc -l
1
expired :
snmpwalk -v2c -c public -On mt .1.3.6.1.2.1.9999.1.1.6.4.1.4 | grep INTEGER:\ 3 | wc -l
34
Ah expired static leases, I did not think of those (we don’t have them as static leases are only used for equipment that is always on).
For sure it does not include expired dynamic leases.
tnx for thinking with me …
any other suggestions ?