This is a question if it is possible to convert a mac address in hex to an integer format and use it in a OID, used in an Item prototype in a Discovery list.
I've spent days looking through Zabbix documentation, forums, evaluating downloadable templates, testing Zabbix 4.0, googling and so on in an effort to try to read Microtik wireless statuses through SNMP.
Reading ethernet interfaces, CPU, voltage etc is no problem. But to read the different WIRELESS statuses in a Mikrotik AP is harder. Why? Because the OIDs there are build partly from the mac addresses of the wireless connections. It's not enough with a numeric SMNP index.
So, to find the statuses of the connections to the wireless stations/clients (all connected to the same AP) we need to look into the wireless table and registration table in the AP.
I've add the MIB file from Mikrotik and it makes it simpler for snmpwalk.
snmpwalk -v 2c -c public 10.221.2.1 -On MIKROTIK-MIB::mtxrWlRtabUptime
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.35.224.56. 8 = Timeticks: (116377300) 13 days, 11:16:13.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.35.224.64. 8 = Timeticks: (116377300) 13 days, 11:16:13.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.44.77.92.8 = Timeticks: (116377100) 13 days, 11:16:11.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.96.136.199 .8 = Timeticks: (34980200) 4 days, 1:10:02.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.96.137.12. 8 = Timeticks: (116377300) 13 days, 11:16:13.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.219.76.195 .8 = Timeticks: (115348800) 13 days, 8:24:48.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.241.231.33 .8 = Timeticks: (116351900) 13 days, 11:11:59.00
Here 7 clients are connected to the AP, and the different uptimes are showing. A part of the OID, example "0.12.66.241.231.33" in the last line is the mac of the client.
MIKROTIK-MIB::mtxrWlRtabUptime cannot be used with index, as I can see.
All OIDs contain prefix, the mac and a suffix. I cannot see how to use a SNMPINDEX here to collect the client info one by one in a Discovery list.
Ok, we do a test:
To log, display and alert for different statuses like uptime, wireless speed, noise floor, and so on, we define Discovery list/rules and under there Item prototypes.
The mac addresses can be found using a discovery rule:
discovery[{#SNMPVALUE},1.3.6.1.4.1.14988.1.1.1.2.1.1]
#SNMPVALUE vill then contain teh mac addresses in hex.
Available clients:
snmpwalk -v 2c -c public 10.221.2.1 -On 1.3.6.1.4.1.14988.1.1.1.2.1.1
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.35.224.56.8 = Hex-STRING: 00 0C 42 23 E0 38
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.35.224.64.8 = Hex-STRING: 00 0C 42 23 E0 40
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.44.77.92.8 = Hex-STRING: 00 0C 42 2C 4D 5C
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.96.136.199. 8 = Hex-STRING: 00 0C 42 60 88 C7
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.96.137.12.8 = Hex-STRING: 00 0C 42 60 89 0C
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.219.76.195. 8 = Hex-STRING: 00 0C 42 DB 4C C3
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.241.231.33. 8 = Hex-STRING: 00 0C 42 F1 E7 21
We define Item prototypes:
Key: WirelessRegistrationTable-NoiseFloor[{#SNMPVALUE}]
SNMP OID: .1.3.6.1.4.1.14988.1.1.1.2.1.12.{#SNMPVALUE}.8
We connect this to a device.
From the log:
item "BR-MI-S21 - Kvaale Vest 3:WirelessRegistrationTable-NoiseFloor[00 0C 42 60 88 C7 ]" became not supported: snmp_parse_oid(): cannot parse OID "1.3.6.1.4.1.14988.1.1.1.2.1.12.00 0C 42 60 88 C7.8".
It tells: cannot parse OID "1.3.6.1.4.1.14988.1.1.1.2.1.12.00 0C 42 60 88 C7.8"
Of course it can't. The string "00 0C 42 60 88 C7" needs to be converted to the integer representation, with dots added. That means: "0.12.66.96.136.199"
snmpwalk -v 2c -c public 10.221.2.1 -On 1.3.6.1.4.1.14988.1.1.1.2.1.12.0.12.66.96.136.199. 8
.1.3.6.1.4.1.14988.1.1.1.2.1.12.0.12.66.96.136.199 .8 = INTEGER: 58
So the noise floor for this connected client is 58dB. That is what we are looking for. But how to make this work in Zabbix? Converting "00 0C 42 60 88 C7" to "0.12.66.96.136.199". Or any other approach?
Have tried to implement this conversion with macro and regsub, unsuccessfully. Zabbix 3.0 is in production, but I have Zabbix 3.4 available too, and can switch to it.
Anyone who can help?
Thanks.
I've spent days looking through Zabbix documentation, forums, evaluating downloadable templates, testing Zabbix 4.0, googling and so on in an effort to try to read Microtik wireless statuses through SNMP.
Reading ethernet interfaces, CPU, voltage etc is no problem. But to read the different WIRELESS statuses in a Mikrotik AP is harder. Why? Because the OIDs there are build partly from the mac addresses of the wireless connections. It's not enough with a numeric SMNP index.
So, to find the statuses of the connections to the wireless stations/clients (all connected to the same AP) we need to look into the wireless table and registration table in the AP.
I've add the MIB file from Mikrotik and it makes it simpler for snmpwalk.
snmpwalk -v 2c -c public 10.221.2.1 -On MIKROTIK-MIB::mtxrWlRtabUptime
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.35.224.56. 8 = Timeticks: (116377300) 13 days, 11:16:13.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.35.224.64. 8 = Timeticks: (116377300) 13 days, 11:16:13.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.44.77.92.8 = Timeticks: (116377100) 13 days, 11:16:11.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.96.136.199 .8 = Timeticks: (34980200) 4 days, 1:10:02.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.96.137.12. 8 = Timeticks: (116377300) 13 days, 11:16:13.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.219.76.195 .8 = Timeticks: (115348800) 13 days, 8:24:48.00
.1.3.6.1.4.1.14988.1.1.1.2.1.11.0.12.66.241.231.33 .8 = Timeticks: (116351900) 13 days, 11:11:59.00
Here 7 clients are connected to the AP, and the different uptimes are showing. A part of the OID, example "0.12.66.241.231.33" in the last line is the mac of the client.
MIKROTIK-MIB::mtxrWlRtabUptime cannot be used with index, as I can see.
All OIDs contain prefix, the mac and a suffix. I cannot see how to use a SNMPINDEX here to collect the client info one by one in a Discovery list.
Ok, we do a test:
To log, display and alert for different statuses like uptime, wireless speed, noise floor, and so on, we define Discovery list/rules and under there Item prototypes.
The mac addresses can be found using a discovery rule:
discovery[{#SNMPVALUE},1.3.6.1.4.1.14988.1.1.1.2.1.1]
#SNMPVALUE vill then contain teh mac addresses in hex.
Available clients:
snmpwalk -v 2c -c public 10.221.2.1 -On 1.3.6.1.4.1.14988.1.1.1.2.1.1
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.35.224.56.8 = Hex-STRING: 00 0C 42 23 E0 38
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.35.224.64.8 = Hex-STRING: 00 0C 42 23 E0 40
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.44.77.92.8 = Hex-STRING: 00 0C 42 2C 4D 5C
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.96.136.199. 8 = Hex-STRING: 00 0C 42 60 88 C7
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.96.137.12.8 = Hex-STRING: 00 0C 42 60 89 0C
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.219.76.195. 8 = Hex-STRING: 00 0C 42 DB 4C C3
.1.3.6.1.4.1.14988.1.1.1.2.1.1.0.12.66.241.231.33. 8 = Hex-STRING: 00 0C 42 F1 E7 21
We define Item prototypes:
Key: WirelessRegistrationTable-NoiseFloor[{#SNMPVALUE}]
SNMP OID: .1.3.6.1.4.1.14988.1.1.1.2.1.12.{#SNMPVALUE}.8
We connect this to a device.
From the log:
item "BR-MI-S21 - Kvaale Vest 3:WirelessRegistrationTable-NoiseFloor[00 0C 42 60 88 C7 ]" became not supported: snmp_parse_oid(): cannot parse OID "1.3.6.1.4.1.14988.1.1.1.2.1.12.00 0C 42 60 88 C7.8".
It tells: cannot parse OID "1.3.6.1.4.1.14988.1.1.1.2.1.12.00 0C 42 60 88 C7.8"
Of course it can't. The string "00 0C 42 60 88 C7" needs to be converted to the integer representation, with dots added. That means: "0.12.66.96.136.199"
snmpwalk -v 2c -c public 10.221.2.1 -On 1.3.6.1.4.1.14988.1.1.1.2.1.12.0.12.66.96.136.199. 8
.1.3.6.1.4.1.14988.1.1.1.2.1.12.0.12.66.96.136.199 .8 = INTEGER: 58
So the noise floor for this connected client is 58dB. That is what we are looking for. But how to make this work in Zabbix? Converting "00 0C 42 60 88 C7" to "0.12.66.96.136.199". Or any other approach?
Have tried to implement this conversion with macro and regsub, unsuccessfully. Zabbix 3.0 is in production, but I have Zabbix 3.4 available too, and can switch to it.
Anyone who can help?
Thanks.

Comment