From 7d9cc2e95aa8a1da170949b06040ec298a2487f5 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 26 Apr 2026 15:22:00 +0200 Subject: [PATCH] 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 --- 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 878f5ce41d..2d5fa8d9a7 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 a92b7ddc16..3493453931 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 } -