Skip to content

Crash when wifi channel is on 'auto'

The check crashes if the channel on the AP is set to 'auto':

Exception: TypeError ('<' not supported between instances of 'str' and 'int')

Traceback:

  File "/omd/sites/cmk/lib/python3/cmk/base/checking.py", line 581, in get_aggregated_result
    result = _aggregate_results(check_function(**kwargs))
  File "/omd/sites/cmk/lib/python3/cmk/base/checking.py", line 813, in _aggregate_results
    perfdata, results = _consume_and_dispatch_result_types(subresults)
  File "/omd/sites/cmk/lib/python3/cmk/base/checking.py", line 857, in _consume_and_dispatch_result_types
    for subr in subresults:
  File "/omd/sites/cmk/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 89, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/cmk/local/lib/python3/cmk/base/plugins/agent_based/unifi.py", line 482, in check_unifi_radio
    yield Result(state=State.OK, summary=f"Type: %s/%s" % (wifi_type(radio), radio.get('radio')))
  File "/omd/sites/cmk/local/lib/python3/cmk/base/plugins/agent_based/unifi.py", line 433, in wifi_type
    if ssid.get('channel') < 15:

Beneath the fold two radio_table excerpts from U6-Lite and U6-Pro as examples

U6-Lite with channel numbers "radio_table": [ { "radio": "ng", "name": "ra0", "max_txpower": 23, "min_txpower": 6, "nss": 2, "min_rssi_enabled": false, "sens_level_enabled": false, "radio_caps": 147476, "radio_caps2": 1, "builtin_antenna": true, "builtin_ant_gain": 3, "loadbalance_enabled": false, "current_antenna_gain": 0, "ht": "20", "channel": 1, "backup_channel": 0 }, { "radio": "na", "name": "rai0", "max_txpower": 23, "min_txpower": 6, "nss": 2, "min_rssi_enabled": false, "sens_level_enabled": false, "is_11ac": true, "is_11ax": true, "has_dfs": true, "has_fccdfs": true, "radio_caps": 50479124, "radio_caps2": 15, "builtin_antenna": true, "builtin_ant_gain": 3, "loadbalance_enabled": false, "current_antenna_gain": 0, "ht": "40", "channel": 40, "backup_channel": 0 } ],
U6-Pro with auto channel "radio_table": [ { "sens_level_enabled": false, "channel": "auto", "radio": "ng", "min_rssi_enabled": false, "tx_power_mode": "auto", "vwire_enabled": true, "ht": 20, "name": "wifi0", "min_txpower": 6, "max_txpower": 22, "builtin_antenna": true, "builtin_ant_gain": 4, "current_antenna_gain": 0, "nss": 2, "is_11ac": true, "is_11ax": true, "radio_caps": 16404, "radio_caps2": 31 }, { "sens_level_enabled": false, "channel": "auto", "radio": "na", "min_rssi_enabled": false, "tx_power_mode": "auto", "vwire_enabled": true, "ht": 80, "name": "wifi1", "min_txpower": 6, "max_txpower": 26, "builtin_antenna": true, "builtin_ant_gain": 6, "current_antenna_gain": 0, "nss": 4, "is_11ac": true, "is_11ax": true, "has_dfs": true, "has_fccdfs": true, "has_ht160": true, "radio_caps": 251805700, "radio_caps2": 31 } ],
Maybe going for 'radio' as identifier if 2.4 or 5GHz would be more appropriate? Would need to know the values of other APs to be sure though.

Oh, and minor, the "type" for my U6-Pro is 'UAP6MP'. Maybe you wan't to add that to the translation table?