I am new to checkmk plugin development and trying to modify a script written in latest standarts. Now base snmp oid is following,
.1.3.6.1.4.1.12356.101.14.4.3.1.3
returns
.1.3.6.1.4.1.12356.101.14.4.3.1.3.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.50.55.57 = "AP01"
.1.3.6.1.4.1.12356.101.14.4.3.1.3.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.50.56.56 = "AP03"
.1.3.6.1.4.1.12356.101.14.4.3.1.3.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.51.49.57 = "AP02"
.1.3.6.1.4.1.12356.101.14.4.3.1.3.1.16.70.80.50.50.49.69.53.53.50.49.48.57.57.71.88.74 = "AP05"
.1.3.6.1.4.1.12356.101.14.4.3.1.3.1.16.70.80.50.50.49.69.53.53.50.49.48.57.57.72.48.70 = "AP04"
You see it returns 5 Acess Points and script has a bunch of other oids which returns exactly 5 items per Access Point. Now there is oid, 1.3.6.1.4.1.12356.101.14.4.5.1.9 which returns two results per Access point
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.50.55.57.1 = 1
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.50.55.57.2 = 1
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.50.56.56.1 = 1
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.50.56.56.2 = 0
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.51.49.57.1 = 1
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.49.57.48.50.55.51.49.57.2 = 2
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.50.49.48.57.57.71.88.74.1 = 1
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.50.49.48.57.57.71.88.74.2 = 0
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.50.49.48.57.57.72.48.70.1 = 0
.1.3.6.1.4.1.12356.101.14.4.5.1.9.1.16.70.80.50.50.49.69.53.53.50.49.48.57.57.72.48.70.2 = 0
above .1 at the end means ghz 2.4, .2 means 5ghz. Now I am stack and can`t parse this oid because it returns 10 items , 2 per main item. I wish developers of device have putten .1 and .2 right after .9 but they did not )
Parse section:
def parse_fortigate_ap_connection(string_table: List[StringTable]) -> Section:
pprint.pprint(string_table)
"""
>>> from pprint import pprint
>>> pprint(parse_fortigate_ap_connection([
... [["a"], ["b"]],
... [["1", "0"], ["2", "5"]],
... ]))
{'a': AccessPoint(connection_state=ConnectionState(status='offLine', description='The WTP is not connected.'), station_count=0),
'b': AccessPoint(connection_state=ConnectionState(status='onLine', description='The WTP is connected.'), station_count=5)}
"""
return {
wtp_name: AccessPoint(
ConnectionState(*_CONN_STATE_TO_READABLE[connection_state]),
int(station_count),
hwid,
)
for (wtp_name,), (
connection_state,
station_count,
hwid,
) in zip(*string_table)
}