mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 23:18:42 +01:00
prometheus-node-exporter-lua: add openwrt exporter
adds openwrt specific information about the device.
include DISTRIB_{ID, RELEASE, REVISION}, board_name and model
Example output:
# TYPE node_openwrt_info gauge
node_openwrt_info{revision="55a0636",model="QEMU Standard PC (i440FX + PIIX, 1996)",id="LiMe",board_name="qemu-standard-pc-i440fx-piix-1996",release="snapshot"} 1
node_scrape_collector_duration_seconds{collector="openwrt"} 3.814697265625e-05
node_scrape_collector_success{collector="openwrt"} 1
Signed-off-by: Paul Spooren <spooren@informatik.uni-leipzig.de>
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
local labels = {
|
||||
id = "",
|
||||
release = "",
|
||||
revision = "",
|
||||
model = string.sub(get_contents("/tmp/sysinfo/model"), 1, -2),
|
||||
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
|
||||
if k == "DISTRIB_ID" then
|
||||
labels["id"] = v
|
||||
elseif k == "DISTRIB_RELEASE" then
|
||||
labels["release"] = v
|
||||
elseif k == "DISTRIB_REVISION" then
|
||||
labels["revision"] = v
|
||||
end
|
||||
end
|
||||
|
||||
local function scrape()
|
||||
metric("node_openwrt_info", "gauge", labels, 1)
|
||||
end
|
||||
|
||||
return { scrape = scrape }
|
||||
|
||||
Reference in New Issue
Block a user