Skip to content

prometheus-node-exporter-lua: add unbound stats collector#28784

Closed
marinierb wants to merge 2 commits into
openwrt:masterfrom
marinierb:unbound-exporter
Closed

prometheus-node-exporter-lua: add unbound stats collector#28784
marinierb wants to merge 2 commits into
openwrt:masterfrom
marinierb:unbound-exporter

Conversation

@marinierb
Copy link
Copy Markdown

@marinierb marinierb commented Mar 13, 2026

📦 prometheus-node-exporter-lua

Maintainer: @champtar

Description: Add a collector for unbound statistics


🧪 Run Testing Details

  • OpenWrt Version: 25.12
  • OpenWrt Target/Subtarget: MediaTek ARM/Filogic 8x0 (MT798x)
  • OpenWrt Device: GL.iNet GL-MT6000

Signed-off-by: Bruno Marinier bmgm41@gmail.com

Signed-off-by: Bruno Marinier <bmgm41@gmail.com>
@marinierb
Copy link
Copy Markdown
Author

marinierb commented Mar 27, 2026

@champtar Monsieur Champetier, merci de bien vouloir jeter un coup d'oeil à ce PR. C'est mon tout premier!

["total.recursion.time.median" ] = metric("unbound_recursion_time_median_total", "counter"),
}

local handle = io.popen("/usr/sbin/unbound-control stats_noreset | sed 's/_/./g'")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

popen'ing 3 binaries (sh / unbound-control / sed) is "extremely" costly

You should be able to use unbound unix socket
https://github.com/letsencrypt/unbound_exporter/blob/01314cb6b51ed429f3e583d26b41d37754483084/exporter/unbound_exporter.go#L567

Untested (not a unbound user), but here is a try

socket = require("socket")
socket.unix = require("socket.unix")
c = assert(socket.unix())
assert(c:connect("/run/unbound-remote-control.sock"))
assert(c:send("UBCT1 stats_noreset\n"))

local out = c:receive("*a")
c:close()

Signed-off-by: marinierb <bmgm41@gmail.com>
Signed-off-by: marinierb <notareal@email.address>
@marinierb
Copy link
Copy Markdown
Author

@champtar Made the switch to unix socket. Please review. Thanks!

@marinierb
Copy link
Copy Markdown
Author

Question: For this to work requires configuration changes to unbound, i.e.

remote-control:
    control-enable: yes
    control-interface: /run/unbound.ctl
    control-use-cert: no

How do I document that? A comment in the unbound.lua file?

@marinierb marinierb closed this by deleting the head repository Apr 6, 2026
@champtar
Copy link
Copy Markdown
Member

champtar commented Apr 6, 2026

@marinierb why are you closing ?

@marinierb
Copy link
Copy Markdown
Author

@champtar That was a mistake. Will resubmit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants