prometheus-node-exporter-lua: check for clients_call method is missing
@PolynomialDivision is already working on this.
Since Apr 25, 2022.
- Dominant language
- Makefile
- Stars
- 4.6k
- Forks
- 4k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 134
Description
Maintainer: @champtar
Environment: not model specific, OpenWrt 21.02
Description:
In hostapd_ubus_stations.lua the method get_clients gets called for interfaces that might not be in the hostapd namespace and therefore the call fails:
Thu Apr 21 21:08:03 2022 daemon.err prometheus-node-exporter-lua[20: Failed to connect to hostapd - wpa_ctrl_open: No such file or directory
Thu Apr 21 21:08:04 2022 daemon.err prometheus-node-exporter-lua[20: Failed to connect to hostapd - wpa_ctrl_open: No such file or directory
Thu Apr 21 21:08:04 2022 daemon.info prometheus-node-exporter-lua[20: .../lua/prometheus-collectors/hostapd_ubus_stations.lua:62: attempt to index local 'clients_call' (a nil value)
The hostapd namespace needs to be checked for the availability of the get_clients method or the hostapd namespace should be used to get the interfaces instead of using the network.wireless status call.
Here is an example of the network.wireless status call (ubus -v call network.wireless status):
{
"radio0": {
"up": true,
"pending": false,
"autostart": true,
"disabled": false,
"retry_setup_failed": false,
"config": {
"hwmode": "11a",
"path": "pci0000:00/0000:00:00.0",
"htmode": "VHT40",
"channel": "36",
"txpower": 19,
"country": "DE",
"legacy_rates": false
},
"interfaces": [
{
"section": "radio0_if0",
"ifname": "wlan5-ff",
"config": {
"ifname": "wlan5-ff",
"mode": "ap",
"encryption": "none",
"ssid": "berlin.freifunk.net",
"isolate": true,
"network": [
"dhcp"
],
"mode": "ap",
"isolate": true
},
"vlans": [
],
"stations": [
]
},
{
"section": "radio0_if1",
"ifname": "wlan5-ffowe",
"config": {
"ifname": "wlan5-ffowe",
"mode": "ap",
"encryption": "owe",
"ssid": "berlin.freifunk.net Encrypted",
"ieee80211w": 1,
"isolate": true,
"network": [
"dhcp"
],
"mode": "ap",
"isolate": true
},
"vlans": [
],
"stations": [
]
},
{
"section": "radio0_if2",
"ifname": "wlan5-mesh",
"config": {
"ifname": "wlan5-mesh",
"mode": "mesh",
"mesh_id": "Mesh-Freifunk-Berlin",
"mesh_fwding": false,
"mcast_rate": 12000,
"mode": "mesh",
"network": [
"mesh_11s_5ghz"
]
},
"vlans": [
],
"stations": [
]
}
]
},
"radio1": {
"up": true,
"pending": false,
"autostart": true,
"disabled": false,
"retry_setup_failed": false,
"config": {
"hwmode": "11g",
"path": "platform/ahb/18100000.wmac",
"htmode": "VHT20",
"channel": "13",
"txpower": 17,
"country": "DE",
"legacy_rates": false
},
"interfaces": [
{
"section": "radio1_if0",
"ifname": "wlan2-ff",
"config": {
"ifname": "wlan2-ff",
"mode": "ap",
"encryption": "none",
"ssid": "berlin.freifunk.net",
"isolate": true,
"network": [
"dhcp"
],
"mode": "ap",
"isolate": true
},
"vlans": [
],
"stations": [
]
},
{
"section": "radio1_if1",
"ifname": "wlan2-ffowe",
"config": {
"ifname": "wlan2-ffowe",
"mode": "ap",
"encryption": "owe",
"ssid": "berlin.freifunk.net Encrypted",
"ieee80211w": 1,
"isolate": true,
"network": [
"dhcp"
],
"mode": "ap",
"isolate": true
},
"vlans": [
],
"stations": [
]
},
{
"section": "radio1_if2",
"ifname": "wlan2-mesh",
"config": {
"ifname": "wlan2-mesh",
"mode": "mesh",
"mesh_id": "Mesh-Freifunk-Berlin",
"mesh_fwding": false,
"mcast_rate": 12000,
"mode": "mesh",
"network": [
"mesh_11s_2ghz"
]
},
"vlans": [
],
"stations": [
]
}
]
}
}
Here is the listing of the hostapd namespace, which misses the mesh interfaces wlan2-mesh and wlan5-mesh which causes the calles for those interfaces to fail:
'hostapd' @0bb0c0ce
"config_add":{"iface":"String","config":"String"}
"config_remove":{"iface":"String"}
'hostapd.wlan2-ff' @c7775328
"reload":{}
"get_clients":{}
"get_status":{}
"del_client":{"addr":"String","reason":"Integer","deauth":"Boolean","ban_time":"Integer"}
"list_bans":{}
"wps_start":{}
"wps_status":{}
"wps_cancel":{}
"update_beacon":{}
"get_features":{}
"switch_chan":{"freq":"Integer","bcn_count":"Integer","center_freq1":"Integer","center_freq2":"Integer","bandwidth":"Integer","sec_channel_offset":"Integer","ht":"Boolean","vht":"Boolean","block_tx":"Boolean"}
"set_vendor_elements":{"vendor_elements":"String"}
"notify_response":{"notify_response":"Integer"}
"bss_mgmt_enable":{"neighbor_report":"Boolean","beacon_report":"Boolean","bss_transition":"Boolean"}
"rrm_nr_get_own":{}
"rrm_nr_list":{}
"rrm_nr_set":{"list":"Array"}
"rrm_beacon_req":{"addr":"String","mode":"Integer","op_class":"Integer","channel":"Integer","duration":"Integer","bssid":"String","ssid":"String"}
"wnm_disassoc_imminent":{"addr":"String","duration":"Integer","neighbors":"Array","abridged":"Boolean"}
"bss_transition_request":{"addr":"String","disassociation_imminent":"Boolean","disassociation_timer":"Integer","validity_period":"Integer","neighbors":"Array","abridged":"Boolean"}
'hostapd.wlan2-ffowe' @456301cb
"reload":{}
"get_clients":{}
"get_status":{}
"del_client":{"addr":"String","reason":"Integer","deauth":"Boolean","ban_time":"Integer"}
"list_bans":{}
"wps_start":{}
"wps_status":{}
"wps_cancel":{}
"update_beacon":{}
"get_features":{}
"switch_chan":{"freq":"Integer","bcn_count":"Integer","center_freq1":"Integer","center_freq2":"Integer","bandwidth":"Integer","sec_channel_offset":"Integer","ht":"Boolean","vht":"Boolean","block_tx":"Boolean"}
"set_vendor_elements":{"vendor_elements":"String"}
"notify_response":{"notify_response":"Integer"}
"bss_mgmt_enable":{"neighbor_report":"Boolean","beacon_report":"Boolean","bss_transition":"Boolean"}
"rrm_nr_get_own":{}
"rrm_nr_list":{}
"rrm_nr_set":{"list":"Array"}
"rrm_beacon_req":{"addr":"String","mode":"Integer","op_class":"Integer","channel":"Integer","duration":"Integer","bssid":"String","ssid":"String"}
"wnm_disassoc_imminent":{"addr":"String","duration":"Integer","neighbors":"Array","abridged":"Boolean"}
"bss_transition_request":{"addr":"String","disassociation_imminent":"Boolean","disassociation_timer":"Integer","validity_period":"Integer","neighbors":"Array","abridged":"Boolean"}
'hostapd.wlan5-ff' @80c3cbdb
"reload":{}
"get_clients":{}
"get_status":{}
"del_client":{"addr":"String","reason":"Integer","deauth":"Boolean","ban_time":"Integer"}
"list_bans":{}
"wps_start":{}
"wps_status":{}
"wps_cancel":{}
"update_beacon":{}
"get_features":{}
"switch_chan":{"freq":"Integer","bcn_count":"Integer","center_freq1":"Integer","center_freq2":"Integer","bandwidth":"Integer","sec_channel_offset":"Integer","ht":"Boolean","vht":"Boolean","block_tx":"Boolean"}
"set_vendor_elements":{"vendor_elements":"String"}
"notify_response":{"notify_response":"Integer"}
"bss_mgmt_enable":{"neighbor_report":"Boolean","beacon_report":"Boolean","bss_transition":"Boolean"}
"rrm_nr_get_own":{}
"rrm_nr_list":{}
"rrm_nr_set":{"list":"Array"}
"rrm_beacon_req":{"addr":"String","mode":"Integer","op_class":"Integer","channel":"Integer","duration":"Integer","bssid":"String","ssid":"String"}
"wnm_disassoc_imminent":{"addr":"String","duration":"Integer","neighbors":"Array","abridged":"Boolean"}
"bss_transition_request":{"addr":"String","disassociation_imminent":"Boolean","disassociation_timer":"Integer","validity_period":"Integer","neighbors":"Array","abridged":"Boolean"}
'hostapd.wlan5-ffowe' @bbacf20d
"reload":{}
"get_clients":{}
"get_status":{}
"del_client":{"addr":"String","reason":"Integer","deauth":"Boolean","ban_time":"Integer"}
"list_bans":{}
"wps_start":{}
"wps_status":{}
"wps_cancel":{}
"update_beacon":{}
"get_features":{}
"switch_chan":{"freq":"Integer","bcn_count":"Integer","center_freq1":"Integer","center_freq2":"Integer","bandwidth":"Integer","sec_channel_offset":"Integer","ht":"Boolean","vht":"Boolean","block_tx":"Boolean"}
"set_vendor_elements":{"vendor_elements":"String"}
"notify_response":{"notify_response":"Integer"}
"bss_mgmt_enable":{"neighbor_report":"Boolean","beacon_report":"Boolean","bss_transition":"Boolean"}
"rrm_nr_get_own":{}
"rrm_nr_list":{}
"rrm_nr_set":{"list":"Array"}
"rrm_beacon_req":{"addr":"String","mode":"Integer","op_class":"Integer","channel":"Integer","duration":"Integer","bssid":"String","ssid":"String"}
"wnm_disassoc_imminent":{"addr":"String","duration":"Integer","neighbors":"Array","abridged":"Boolean"}
"bss_transition_request":{"addr":"String","disassociation_imminent":"Boolean","disassociation_timer":"Integer","validity_period":"Integer","neighbors":"Array","abridged":"Boolean"}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.