From fc44f87dc52b2a35a2a234c26ec88a7fa6beb7f2 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sun, 17 Jun 2018 17:01:57 +0900 Subject: prometheus-node-exporter-lua: handle fancy release Some releases may have non letters in it's name currently resulting in an empty ("") output which is then discarded, resulting in *missing* labels in the metric. Now it uses `.-` to catch as little as possible, but anything. Signed-off-by: Paul Spooren --- .../files/usr/lib/lua/prometheus-collectors/openwrt.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/prometheus-node-exporter-lua/files/usr/lib/lua') 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 2f5030d7a..8b9785a27 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 @@ -6,7 +6,7 @@ local labels = { board_name = string.sub(get_contents("/tmp/sysinfo/board_name"), 1, -2) } -for k, v in string.gmatch(get_contents("/etc/openwrt_release"), "(DISTRIB_%w+)='(%w+)'\n") do +for k, v in string.gmatch(get_contents("/etc/openwrt_release"), "(DISTRIB_%w+)='(.-)'\n") do if k == "DISTRIB_ID" then labels["id"] = v elseif k == "DISTRIB_RELEASE" then -- cgit v1.2.3