From: Robin Roevens <robin.roevens@disroot.org>
To: development@lists.ipfire.org, Michael Tremer <michael.tremer@ipfire.org>
Cc: Robin Roevens <robin.roevens@disroot.org>
Subject: Re: Knot resolver in CU 203: enable HTTP API
Date: Thu, 18 Jun 2026 19:58:33 +0200 [thread overview]
Message-ID: <20260618180341.35720-1-robin.roevens@disroot.org> (raw)
In-Reply-To: <C5DF9FD4-7E97-49DD-9309-0463885A9A7D@ipfire.org>
Hi Michael
Michael Tremer schreef op wo 17-06-2026 om 14:11 [+0100]:
> Hello Robin,
>
> I totally agree that the overhead of kresctl is way too high,
> especially on some of the weaker hardware that we are using. The HTTP
> responses are available instantaneously which is much nicer as it
> almost uses zero resources.
>
> It seems that kresctl is only returning the plain output of the HTTP
> API anyways.
>
> However, I am not sure if we should make this available over the
> network because of the following problems:
>
> * Port Number Congestion - Port 5000 is a very round number and might
> already be used by other services like OpenVPN or even the proxy
> where people can choose a port number freely. As the number is easy
> to remember chances are high.
I just took 5000 as that was used in the example provided by the knot documentation. I noticed older versions of knot had a HTTP plugin serving more or less the same purpose, and that operated on port 8043 (http) or 8443 (https). It seems they downscaled that (only http now) and built it into the core..
>
> * Security - Securing access to localhost is hard.
True.. any process running on IPFire could easily query/use the knot API.
>
> So I have a counter-proposal which does not require any configuration
> changes on behalf of the Knot Resolver configuration. Kresctl already
> as a socket to communicate with the daemon using a Unix domain socket
> using the HTTP API - although it feels a bit weird sending HTTP over
> the socket. But it does work:
>
> [root@fw01 ~]# curl --unix-socket
> /var/run/knot-resolver/kres-api.sock http://localhost/metrics/json
> {"kresd:kresd0": {"answer": {"total": 0, "noerror": 0, "nxdomain": 0,
> "nodata": 0, "1ms": 0, "10ms": 0, "50ms": 0, "100ms": 0, "250ms": 0,
> "500ms": 0, "1000ms": 0,…
>
> Is this an option for Zabbix? I suppose you are using curl as a
> replacement to kresctl as it is much more lightweight. Or are you
> using an internal HTTP client of the zabbix agent? And if so, does it
> support the Unix socket?
Zabbix agent natively supports querying http(s) over tcp/udp sockets using a builtin client, but does not support unix sockets out of the box. So using this method will need a different approach on the Zabbix agent if we want to support it "out-of-the-box". I've been looking around for existing Knot templates, but the only ones I found use the http(s) plugin for knot and even query the interface straight from the Zabbix server instead of through the agent, so the http(s) interface has to be accessible from the Zabbix server for them to work.
Anyway, the unix socket won't work natively, so I will have to add a new UserParameter to the Zabbix agent IPFire specific config, calling curl to retrieve the metrics from the unix socket, like I already do with ping, arping, getipstat, openvpnctrl, wireguardctl etc..
I've tested this and this seems to work nearly as good as natively calling http. There will always be a little performance loss due to the fact that a separate process is forked to execute an additional binary. But as it seems minimal, this should not pose a problem.
Regards
Robin
--
Dit bericht is gescanned op virussen en andere gevaarlijke
inhoud door MailScanner en lijkt schoon te zijn.
next prev parent reply other threads:[~2026-06-18 18:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 20:15 Robin Roevens
2026-06-16 20:15 ` [PATCH] knot-resolver: Enable " Robin Roevens
2026-06-17 13:11 ` Knot resolver in CU 203: enable " Michael Tremer
2026-06-18 17:58 ` Robin Roevens [this message]
2026-06-18 17:58 ` [PATCH] zabbix_agentd: Add support for kresd metrics Robin Roevens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260618180341.35720-1-robin.roevens@disroot.org \
--to=robin.roevens@disroot.org \
--cc=development@lists.ipfire.org \
--cc=michael.tremer@ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox