From 1d05d45ae778152dfd7ce1ed0b104bb9f5415461 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sun, 5 Jul 2026 05:37:30 -0400 Subject: [PATCH 01/12] mwan3: skip ci version check No version to test here. Signed-off-by: Etienne Champetier (cherry picked from commit 964750c6e724cee9b9c843bf43966a7aa88b1d58) --- net/mwan3/test-version.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 net/mwan3/test-version.sh diff --git a/net/mwan3/test-version.sh b/net/mwan3/test-version.sh new file mode 100755 index 00000000000000..c52d3c26b35fd4 --- /dev/null +++ b/net/mwan3/test-version.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 From 296b40151c00ba00b32e0b379a1bcd326601e5d3 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sun, 5 Jul 2026 05:43:40 -0400 Subject: [PATCH 02/12] realtek-poe: skip ci version check No version to test here. Signed-off-by: Etienne Champetier (cherry picked from commit 8ebab942f525f937f5b1f08cc751203c9329982b) --- utils/realtek-poe/test-version.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 utils/realtek-poe/test-version.sh diff --git a/utils/realtek-poe/test-version.sh b/utils/realtek-poe/test-version.sh new file mode 100755 index 00000000000000..c52d3c26b35fd4 --- /dev/null +++ b/utils/realtek-poe/test-version.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 From 827dd849f25f71758377fd69c0317cced420cac5 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sun, 5 Jul 2026 05:52:51 -0400 Subject: [PATCH 03/12] ubnt-manager: skip ci version check No version to test here. Signed-off-by: Etienne Champetier (cherry picked from commit cc886eb9908dc2685bf0851c63a806fe42f75393) --- utils/ubnt-manager/test-version.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 utils/ubnt-manager/test-version.sh diff --git a/utils/ubnt-manager/test-version.sh b/utils/ubnt-manager/test-version.sh new file mode 100755 index 00000000000000..c52d3c26b35fd4 --- /dev/null +++ b/utils/ubnt-manager/test-version.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 From 015459c8f8902649b401da30ddfb7aba0191debf Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Mon, 29 Dec 2025 08:30:46 +0100 Subject: [PATCH 04/12] prometheus-node-exporter-lua: remove bmx6 leftovers It looks like I forgot to remove this file while dropping package prometheus-node-exporter-lua-bmx6. Fixes: 9c2bf859005ada11c17835f74826b356cdb0fb7b ("prometheus-node-exporter-lua: drop bmx6 package") Signed-off-by: Josef Schlehofer (cherry picked from commit cab93eb528329628cfe7b5e883f35e106afe650b) --- .../lib/lua/prometheus-collectors/bmx6.lua | 37 ------------------- 1 file changed, 37 deletions(-) delete mode 100644 utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/bmx6.lua diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/bmx6.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/bmx6.lua deleted file mode 100644 index be26072d165bee..00000000000000 --- a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/bmx6.lua +++ /dev/null @@ -1,37 +0,0 @@ -local json = require "cjson" - -local function interpret_suffix(rate) - local value = string.sub(rate, 1, -2) - local suffix = string.sub(rate, -1) - if suffix == "K" then return tonumber(value) * 10^3 end - if suffix == "M" then return tonumber(value) * 10^6 end - if suffix == "G" then return tonumber(value) * 10^9 end - return rate -end - -local function scrape() - local status = json.decode(get_contents("/var/run/bmx6/json/status")).status - local labels = { - version = status.version, - id = status.name, - address = status.primaryIp - } - - metric("bmx6_status", "gauge", labels, 1) - - local links = json.decode(get_contents("/var/run/bmx6/json/links")).links - local metric_bmx6_rxRate = metric("bmx6_link_rxRate","gauge") - local metric_bmx6_txRate = metric("bmx6_link_txRate","gauge") - - for _, link in pairs(links) do - local labels = { - source = status.name, - target = link.name, - dev = link.viaDev - } - metric_bmx6_rxRate(labels, interpret_suffix(link.rxRate)) - metric_bmx6_txRate(labels, interpret_suffix(link.txRate)) - end -end - -return { scrape = scrape } From 67158985eace2d769e4257170bfd495749038dda Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sun, 5 Jul 2026 09:00:01 -0400 Subject: [PATCH 05/12] prometheus-node-exporter-lua: fix typo in description The treewide change done in master doesn't apply cleanly. Signed-off-by: Etienne Champetier --- utils/prometheus-node-exporter-lua/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index 37c6f7d1bee377..31583a6cf8df13 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -54,7 +54,7 @@ endef define Package/prometheus-node-exporter-lua/description Provides node metrics as Prometheus scraping endpoint. - This service is a lightweight rewrite in LUA of the offical Prometheus node_exporter. + This service is a lightweight rewrite in LUA of the official Prometheus node_exporter. endef # Additional optional exporters: From 50ec7e82a85c344aa26b88dfaa79c544a788f8d5 Mon Sep 17 00:00:00 2001 From: Jean-Laurent Girod Date: Wed, 6 May 2026 16:32:17 +0000 Subject: [PATCH 06/12] prometheus-node-exporter-lua: add modemmanager exporter Add a Prometheus collector for ModemManager that exports cellular modem signal metrics via mmcli. Supports multiple modems (labeled by D-Bus object path), exports overall signal quality and detailed per-technology signal parameters (LTE, NR5G, UMTS, GSM, CDMA, ...). Requires signal refresh to be enabled on the modem: mmcli -m --signal-setup= Tested on: ath79/generic, GL.inet GL-X300B, OpenWrt 23.05.5 Co-authored-by: Claude Signed-off-by: Jean-Laurent Girod (cherry picked from commit 1b18489df87f5b511875bba5fee2b2dd1097ac79) --- utils/prometheus-node-exporter-lua/Makefile | 14 +++++- .../prometheus-collectors/modemmanager.lua | 48 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/modemmanager.lua diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index 31583a6cf8df13..e559a05a99ffb8 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=prometheus-node-exporter-lua -PKG_VERSION:=2025.11.22 +PKG_VERSION:=2026.05.06 PKG_RELEASE:=1 PKG_MAINTAINER:=Etienne CHAMPETIER @@ -279,6 +279,17 @@ define Package/prometheus-node-exporter-lua-nft-counters/install $(INSTALL_DATA) ./files/usr/lib/lua/prometheus-collectors/nft_counters.lua $(1)/usr/lib/lua/prometheus-collectors/ endef +define Package/prometheus-node-exporter-lua-modemmanager + $(call Package/prometheus-node-exporter-lua/Default) + TITLE+= (modemmanager collector) + DEPENDS:=prometheus-node-exporter-lua +modemmanager +lua-cjson +endef + +define Package/prometheus-node-exporter-lua-modemmanager/install + $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors + $(INSTALL_DATA) ./files/usr/lib/lua/prometheus-collectors/modemmanager.lua $(1)/usr/lib/lua/prometheus-collectors/ +endef + $(eval $(call BuildPackage,prometheus-node-exporter-lua)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx7)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-dawn)) @@ -300,3 +311,4 @@ $(eval $(call BuildPackage,prometheus-node-exporter-lua-realtek-poe)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-mwan3)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-ethtool)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-nft-counters)) +$(eval $(call BuildPackage,prometheus-node-exporter-lua-modemmanager)) diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/modemmanager.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/modemmanager.lua new file mode 100644 index 00000000000000..8f9a83cfa51535 --- /dev/null +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/modemmanager.lua @@ -0,0 +1,48 @@ +local cjson = require "cjson" + +local function scrape() + local file, output, data + + file = io.popen("mmcli -L -J", 'r') + if not file then return end + output = file:read('*all') + file:close() + + local ok, modem_list = pcall(cjson.decode, output) + if not ok or not modem_list["modem-list"] then return end + + for _, modem in ipairs(modem_list["modem-list"]) do + + file = io.popen("mmcli -m " .. modem .. " -J", 'r') + if file then + output = file:read('*all') + file:close() + + ok, data = pcall(cjson.decode, output) + if ok and data["modem"] then + local quality = data["modem"]["generic"]["signal-quality"]["value"] + metric("modemmanager_signal_quality", "gauge", {modem=modem}, tonumber(quality)) + end + end + + file = io.popen("mmcli -m " .. modem .. " --signal-get -J", 'r') + if file then + output = file:read('*all') + file:close() + + ok, data = pcall(cjson.decode, output) + if ok and data["modem"] and data["modem"]["signal"] then + for tech, values in pairs(data["modem"]["signal"]) do + for metric_name, value in pairs(values) do + local num = tonumber(value) + if num then + metric("modemmanager_signal_" .. tech .. "_" .. metric_name, "gauge", {modem=modem}, num) + end + end + end + end + end + end +end + +return { scrape = scrape } From f1744438b4e18d1d983381d0013f451630c10094 Mon Sep 17 00:00:00 2001 From: Will May Date: Wed, 11 Dec 2024 12:33:37 +0000 Subject: [PATCH 07/12] prometheus-node-exporter-lua: add filesystem metrics Add a collector for the various fileystem metrics which matches the node-exporter behaviour. This collector supports the following metrics: * node_filesystem_size_bytes * node_filesystem_free_bytes * node_filesystem_avail_bytes * node_filesystem_files * node_filesystem_files_free * node_filesystem_readonly Signed-off-by: Will May (cherry picked from commit eba5a9c4da7853b776bb2d985b4ee96a846f9a72) --- utils/prometheus-node-exporter-lua/Makefile | 14 ++- .../lua/prometheus-collectors/filesystem.lua | 85 +++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/filesystem.lua diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index e559a05a99ffb8..c5f0390d5d58af 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=prometheus-node-exporter-lua -PKG_VERSION:=2026.05.06 +PKG_VERSION:=2026.05.07 PKG_RELEASE:=1 PKG_MAINTAINER:=Etienne CHAMPETIER @@ -81,6 +81,17 @@ define Package/prometheus-node-exporter-lua-dawn/install $(INSTALL_DATA) ./files/usr/lib/lua/prometheus-collectors/dawn.lua $(1)/usr/lib/lua/prometheus-collectors/ endef +define Package/prometheus-node-exporter-lua-filesystem + $(call Package/prometheus-node-exporter-lua/Default) + TITLE+= (filesystem collector) + DEPENDS:=prometheus-node-exporter-lua +luci-lib-nixio +endef + +define Package/prometheus-node-exporter-lua-filesystem/install + $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors + $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/filesystem.lua $(1)/usr/lib/lua/prometheus-collectors/ +endef + define Package/prometheus-node-exporter-lua-hostapd_stations $(call Package/prometheus-node-exporter-lua/Default) TITLE+= (hostapd_stations collector) - Requires a full hostapd / wpad build @@ -293,6 +304,7 @@ endef $(eval $(call BuildPackage,prometheus-node-exporter-lua)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx7)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-dawn)) +$(eval $(call BuildPackage,prometheus-node-exporter-lua-filesystem)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-hostapd_stations)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-hostapd_ubus_stations)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-hwmon)) diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/filesystem.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/filesystem.lua new file mode 100644 index 00000000000000..25a1084e7816a6 --- /dev/null +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/filesystem.lua @@ -0,0 +1,85 @@ +-- depends on luci-lib-nixio +local nix = require "nixio" + +local function scrape() + -- node exporter description - Filesystem size in bytes + local metric_size_bytes = metric("node_filesystem_size_bytes", "gauge") + -- node exporter description - Filesystem free space in bytes + local metric_free_bytes = metric("node_filesystem_free_bytes", "gauge") + -- node exporter description - Filesystem space available to non-root users in bytes + local metric_avail_bytes = metric("node_filesystem_avail_bytes", "gauge") + -- node exporter description - Filesystem total file nodes + local metric_files = metric("node_filesystem_files", "gauge") + -- node exporter description - Filesystem total free file nodes + local metric_files_free = metric("node_filesystem_files_free", "gauge") + -- node exporter description - Filesystem read-only status + local metric_readonly = metric("node_filesystem_readonly", "gauge") + + for e in io.lines("/proc/self/mounts") do + local fields = space_split(e) + + local device = fields[1] + local mount_point = fields[2] + local fs_type = fields[3] + + -- Filter list from node exporter: + -- https://github.com/prometheus/node_exporter/blob/b9d0932179a0c5b3a8863f3d6cdafe8584cedc8e/collector/filesystem_linux.go#L36-L37 + if mount_point:find("/dev/?", 1) ~= 1 + and mount_point:find("/proc/?", 1) ~= 1 + and mount_point:find("/run/credentials/?", 1) ~= 1 + and mount_point:find("/sys/?", 1) ~= 1 + and mount_point:find("/var/lib/docker/?", 1) ~= 1 + and mount_point:find("/var/lib/containers/storage/?", 1) ~= 1 + and fs_type ~= "autofs" + and fs_type ~= "binfmt_misc" + and fs_type ~= "bpf" + and fs_type ~= "cgroup" + and fs_type ~= "cgroup2" + and fs_type ~= "configfs" + and fs_type ~= "debugfs" + and fs_type ~= "devpts" + and fs_type ~= "devtmpfs" + and fs_type ~= "fusectl" + and fs_type ~= "hugetlbfs" + and fs_type ~= "iso9660" + and fs_type ~= "mqueue" + and fs_type ~= "nsfs" + and fs_type ~= "overlay" + and fs_type ~= "proc" + and fs_type ~= "procfs" + and fs_type ~= "pstore" + and fs_type ~= "rpc_pipefs" + and fs_type ~= "securityfs" + and fs_type ~= "selinuxfs" + and fs_type ~= "squashfs" + and fs_type ~= "sysfs" + and fs_type ~= "tracefs" then + -- note that this excludes / as it's an overlay filesystem + + local stat = nix.fs.statvfs(mount_point) + + -- https://github.com/torvalds/linux/blob/e5fa841af679cb830da6c609c740a37bdc0b8b35/include/linux/statfs.h#L31 + local ST_RDONLY = 0x001 + + local labels = { + device = device, + fstype = fs_type, + mountpoint = mount_point, + } + + local ro = 0 + if (nix.bit.band(stat.flag, ST_RDONLY)) == 1 then + ro = 1 + end + + metric_size_bytes(labels, stat.blocks * stat.bsize) + metric_free_bytes(labels, stat.bfree * stat.bsize) + metric_avail_bytes(labels, stat.bavail * stat.bsize) + metric_files(labels, stat.files) + metric_files_free(labels, stat.ffree) + metric_readonly(labels, ro) + end + end +end + +return { scrape = scrape } From 1417f80202b19626ea2e9c90ed6066829373110a Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sun, 24 May 2026 18:49:15 -0400 Subject: [PATCH 08/12] prometheus-node-exporter-lua: fixup uci_dhcp_host Handle cases where 'mac' is missing (nil), a single string, or an array (table). Additionally, add support for the 'duid' field. Signed-off-by: Etienne Champetier (cherry picked from commit c8760b4ecfa9d2a2d4ed07f5501329f411bf36ba) --- utils/prometheus-node-exporter-lua/Makefile | 2 +- .../lib/lua/prometheus-collectors/uci_dhcp_host.lua | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index c5f0390d5d58af..878f5ce41d1976 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=prometheus-node-exporter-lua -PKG_VERSION:=2026.05.07 +PKG_VERSION:=2026.05.08 PKG_RELEASE:=1 PKG_MAINTAINER:=Etienne CHAMPETIER diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/uci_dhcp_host.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/uci_dhcp_host.lua index 95096259999c98..2c16fc3c832541 100644 --- a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/uci_dhcp_host.lua +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/uci_dhcp_host.lua @@ -5,8 +5,16 @@ local function scrape() local metric_uci_host = metric("uci_dhcp_host", "gauge") curs:foreach("dhcp", "host", function(s) - if s[".type"] == "host" then - labels = {name=s["name"], mac=string.upper(s["mac"]), dns=s["dns"], ip=s["ip"]} + local labels = {name=s["name"], dns=s["dns"], ip=s["ip"], duid=s["duid"]} + + if s["mac"] == nil then + metric_uci_host(labels, 1) + return + end + + local macs = type(s["mac"]) == "table" and s["mac"] or {s["mac"]} + for _, mac in ipairs(macs) do + labels["mac"] = string.upper(mac) metric_uci_host(labels, 1) end end) From d5035807f82dcff4205619fb008b34999208d1bd Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 26 Apr 2026 15:22:00 +0200 Subject: [PATCH 09/12] prometheus-node-exporter-lua: expose node_os_info the original node_exporter exposes a node_os_info metric with a set of data about the system [1] which is then used by several dashboards. openwrt.lua already exposes OS info, but using the node_openwrt_info metric requires changes to existing dashboards, and would require more complex lookups when there are non-OpenWrt hosts in the overview too. as we've already called ubus and fetched the data, we can expose it in two formats easily. [1] https://github.com/prometheus/node_exporter/blob/d6d0e710bb7daf07a2743fde060f0d5f32c565f3/collector/os_release.go#L190-L192 Signed-off-by: Evgeni Golov (cherry picked from commit 7d9cc2e95aa8a1da170949b06040ec298a2487f5) --- utils/prometheus-node-exporter-lua/Makefile | 2 +- .../usr/lib/lua/prometheus-collectors/openwrt.lua | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index 878f5ce41d1976..2d5fa8d9a71fbd 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=prometheus-node-exporter-lua -PKG_VERSION:=2026.05.08 +PKG_VERSION:=2026.05.09 PKG_RELEASE:=1 PKG_MAINTAINER:=Etienne CHAMPETIER diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/openwrt.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/openwrt.lua index a92b7ddc16f875..3493453931d3ec 100644 --- a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/openwrt.lua +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/openwrt.lua @@ -12,13 +12,22 @@ local labels = { target = b.release.target } +local os_info = { + id = string.lower(b.release.distribution), + name = b.release.distribution, + pretty_name = b.release.distribution .. " " .. b.release.version, + version = b.release.version, + version_id = b.release.version, + build_id = b.release.revision, +} + local b = nil local u = nil local ubus = nil local function scrape() metric("node_openwrt_info", "gauge", labels, 1) + metric("node_os_info", "gauge", os_info, 1) end return { scrape = scrape } - From 04b45f947a5afd6918a6a493c4e058cd84e5b1f8 Mon Sep 17 00:00:00 2001 From: Jun Ouyang Date: Sat, 11 Oct 2025 11:19:25 +0800 Subject: [PATCH 10/12] prometheus-node-exporter-lua: check if status is nil before processing wifi device metrics interfaces Signed-off-by: Jun Ouyang (cherry picked from commit f39d51b14c344c31e8e8ddbdad31dd7ed99216cb) --- utils/prometheus-node-exporter-lua/Makefile | 2 +- .../files/usr/lib/lua/prometheus-collectors/wifi.lua | 4 ++++ .../files/usr/lib/lua/prometheus-collectors/wifi_stations.lua | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index 2d5fa8d9a71fbd..58ed19e9200087 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=prometheus-node-exporter-lua -PKG_VERSION:=2026.05.09 +PKG_VERSION:=2026.05.10 PKG_RELEASE:=1 PKG_MAINTAINER:=Etienne CHAMPETIER diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi.lua index 4b1e8f40208ac2..054ae86a762def 100644 --- a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi.lua +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi.lua @@ -10,6 +10,10 @@ local function scrape() local u = ubus.connect() local status = u:call("network.wireless", "status", {}) + if not status then + return + end + for dev, dev_table in pairs(status) do for _, intf in ipairs(dev_table['interfaces']) do local ifname = intf['ifname'] diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi_stations.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi_stations.lua index c632f94d118269..db95c52f68266e 100644 --- a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi_stations.lua +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi_stations.lua @@ -23,6 +23,10 @@ local function scrape() local u = ubus.connect() local status = u:call("network.wireless", "status", {}) + if not status then + return + end + for dev, dev_table in pairs(status) do for _, intf in ipairs(dev_table['interfaces']) do local ifname = intf['ifname'] From 2168fe2390af3e61d18661df0a07b747da39366b Mon Sep 17 00:00:00 2001 From: Bruno Marinier Date: Mon, 8 Jun 2026 15:25:29 -0400 Subject: [PATCH 11/12] prometheus-node-exporter-lua: add unbound stats collector - New unbound.lua exporter module for unbound stats - Updated Makefile Signed-off-by: Bruno Marinier (cherry picked from commit 4238239218d4fe7cdffb6b53fa29c52c2d3cc0a7) --- utils/prometheus-node-exporter-lua/Makefile | 19 ++++++- .../lib/lua/prometheus-collectors/unbound.lua | 56 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/unbound.lua diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index 58ed19e9200087..8eaa9a79ff3fb9 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=prometheus-node-exporter-lua -PKG_VERSION:=2026.05.10 +PKG_VERSION:=2026.06.05 PKG_RELEASE:=1 PKG_MAINTAINER:=Etienne CHAMPETIER @@ -301,6 +301,22 @@ define Package/prometheus-node-exporter-lua-modemmanager/install $(INSTALL_DATA) ./files/usr/lib/lua/prometheus-collectors/modemmanager.lua $(1)/usr/lib/lua/prometheus-collectors/ endef +define Package/prometheus-node-exporter-lua-unbound + $(call Package/prometheus-node-exporter-lua/Default) + TITLE+= (unbound stats collector) + DEPENDS:=prometheus-node-exporter-lua +unbound-daemon +endef + +define Package/prometheus-node-exporter-lua-unbound/description + Adds a Unbound stats collector to the Prometheus node exporter. + Refer to https://github.com/marinierb/prometheus-node-exporter-lua-unbound for configuration details. +endef + +define Package/prometheus-node-exporter-lua-unbound/install + $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors + $(INSTALL_DATA) ./files/usr/lib/lua/prometheus-collectors/unbound.lua $(1)/usr/lib/lua/prometheus-collectors/ +endef + $(eval $(call BuildPackage,prometheus-node-exporter-lua)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx7)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-dawn)) @@ -324,3 +340,4 @@ $(eval $(call BuildPackage,prometheus-node-exporter-lua-mwan3)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-ethtool)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-nft-counters)) $(eval $(call BuildPackage,prometheus-node-exporter-lua-modemmanager)) +$(eval $(call BuildPackage,prometheus-node-exporter-lua-unbound)) diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/unbound.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/unbound.lua new file mode 100644 index 00000000000000..0555e8decc910e --- /dev/null +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/unbound.lua @@ -0,0 +1,56 @@ +-- Unbound stats exporter + +local socket = require("socket") +local unix = require("socket.unix") + +local function scrape() + local metrics = { + ["total.num.queries" ] = metric("unbound_num_queries_total", "counter"), + ["total.num.queries_ip_ratelimited" ] = metric("unbound_num_queries_ip_ratelimited_total", "counter"), + ["total.num.queries_cookie_valid" ] = metric("unbound_num_queries_cookie_valid_total", "counter"), + ["total.num.queries_cookie_client" ] = metric("unbound_num_queries_cookie_client_total", "counter"), + ["total.num.queries_cookie_invalid" ] = metric("unbound_num_queries_cookie_invalid_total", "counter"), + ["total.num.queries_discard_timeout"] = metric("unbound_num_queries_discard_timeout_total","counter"), + ["total.num.queries_wait_limit" ] = metric("unbound_num_queries_wait_limit_total", "counter"), + ["total.num.cachehits" ] = metric("unbound_cachehits_total", "counter"), + ["total.num.cachemiss" ] = metric("unbound_cachemiss_total", "counter"), + ["total.num.prefetch" ] = metric("unbound_prefetch_total", "counter"), + ["total.num.queries_timed_out" ] = metric("unbound_num_queries_timed_out_total", "counter"), + ["total.query.queue_time_us.max" ] = metric("unbound_query_queue_time_us_max", "gauge"), + ["total.num.expired" ] = metric("unbound_num_expired_total", "counter"), + ["total.num.recursivereplies" ] = metric("unbound_num_recursivereplies_total", "counter"), + ["total.num.dns_error_reports" ] = metric("unbound_num_dns_error_reports_total", "counter"), + ["total.requestlist.avg" ] = metric("unbound_requestlist_avg", "gauge"), + ["total.requestlist.max" ] = metric("unbound_requestlist_max", "gauge"), + ["total.requestlist.overwritten" ] = metric("unbound_requestlist_overwritten_total", "counter"), + ["total.requestlist.exceeded" ] = metric("unbound_requestlist_exceeded_total", "counter"), + ["total.requestlist.current.all" ] = metric("unbound_requestlist_current_all", "gauge"), + ["total.requestlist.current.user" ] = metric("unbound_requestlist_current_user", "gauge"), + ["total.recursion.time.avg" ] = metric("unbound_recursion_time_avg", "gauge"), + ["total.recursion.time.median" ] = metric("unbound_recursion_time_median", "gauge"), + } + + local sock = unix() + local ok, err = sock:connect("/run/unbound.ctl") + if not ok then + return nil, "failed to connect to unbound socket: " .. (err or "unknown") + end + + sock:settimeout(1) + sock:send("UBCT1 stats_noreset\n") + local out = sock:receive("*a") + + sock:close() + + for line in out:gmatch("[^\r\n]+") do + local key, val = line:match("^([^=]+)=(.+)$") + if key and val then + local n = tonumber(val) + if metrics[key] then + metrics[key]({}, n) + end + end + end +end + +return { scrape = scrape } From 478a65d518e206db08f07b24ac506159f9b3998e Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sat, 4 Jul 2026 16:59:16 -0400 Subject: [PATCH 12/12] prometheus-node-exporter-lua: add test / skip test-version test.sh is pretty basic and will not fail if one of the plugin fails, which is fine as most plugins will fail in CI anyway. Signed-off-by: Etienne Champetier (cherry picked from commit 4741715d8ec83015916004fc9508165bbba49069) --- utils/prometheus-node-exporter-lua/test-version.sh | 3 +++ utils/prometheus-node-exporter-lua/test.sh | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100755 utils/prometheus-node-exporter-lua/test-version.sh create mode 100755 utils/prometheus-node-exporter-lua/test.sh diff --git a/utils/prometheus-node-exporter-lua/test-version.sh b/utils/prometheus-node-exporter-lua/test-version.sh new file mode 100755 index 00000000000000..c52d3c26b35fd4 --- /dev/null +++ b/utils/prometheus-node-exporter-lua/test-version.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 diff --git a/utils/prometheus-node-exporter-lua/test.sh b/utils/prometheus-node-exporter-lua/test.sh new file mode 100755 index 00000000000000..913d863eb7d257 --- /dev/null +++ b/utils/prometheus-node-exporter-lua/test.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# shellcheck shell=busybox + +case "$PKG_NAME" in +prometheus-node-exporter-lua-openwrt) + # call ubus outside scape, so skip the check + exit 0 + ;; + +*) + prometheus-node-exporter-lua | grep node_scrape_collector_success + ;; +esac