mirror of
https://github.com/openwrt/packages.git
synced 2026-12-03 00:35:30 +04:00
prometheus-node-exporter-ucode: fix sporadic wifi error
Some properties may not be available, properly guard them. Fixes error like: error running collector 'wifi': left-hand side expression is null In this case it corresponds to a link with a signal too weak. iwinfo phy0-mesh0 assoclist xx:xx:xx:xx:xx:xx -89 dBm / -107 dBm (SNR 18) 90 ms ago RX: unknown 183148 Pkts. TX: unknown 53985 Pkts. expected throughput: unknown Co-authored-by: OpenWrt AI review account <openwrt-ai@hauke-m.de> Signed-off-by: Samuele Longhi <agave@dracaena.it>
This commit is contained in:
1 parent
a1656e7d31
commit
85ba4cff22
2 files changed
+8
-3
No files matched your search
@@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=prometheus-node-exporter-ucode
|
||||
PKG_VERSION:=2024.02.07
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_MAINTAINER:=Andre Heider <a.heider@gmail.com>
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
@@ -68,11 +68,16 @@ for (let radio in x) {
|
||||
let bitrate = 0;
|
||||
const stations = length(wsta) || 0;
|
||||
if (stations) {
|
||||
let rated = 0;
|
||||
for (let sta in wsta) {
|
||||
signal += sta["sta_info"].signal;
|
||||
bitrate += sta["sta_info"]["tx_bitrate"].bitrate32;
|
||||
const br = sta["sta_info"]["tx_bitrate"]?.bitrate32;
|
||||
if (br) {
|
||||
bitrate += br;
|
||||
rated++;
|
||||
}
|
||||
}
|
||||
bitrate /= stations * 0.01;
|
||||
bitrate = rated ? bitrate / (rated * 0.01) : 0;
|
||||
signal /= stations;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user