aboutsummaryrefslogtreecommitdiff
path: root/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/openwrt.lua
blob: a92b7ddc16f8753181c0a7896ed1772df6961c6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local ubus = require "ubus"
local u = ubus.connect()
local b = u:call("system", "board", {})

local labels = {
    board_name = b.board_name,
    id = b.release.distribution,
    model = b.model,
    release = b.release.version,
    revision = b.release.revision,
    system = b.system,
    target = b.release.target
}

local b = nil
local u = nil
local ubus = nil

local function scrape()
    metric("node_openwrt_info", "gauge", labels, 1)
end

return { scrape = scrape }