aboutsummaryrefslogtreecommitdiff
path: root/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/uci_dhcp_host.lua
blob: 95096259999c98bd62a2d8f4f5c95c8adf5032e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
local uci=require("uci")

local function scrape()
  local curs=uci.cursor()
  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"]}
      metric_uci_host(labels, 1)
    end
  end)
end

return { scrape = scrape }