]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
zabbix_agentd: Add support for kresd metrics
authorRobin Roevens <robin.roevens@disroot.org>
Thu, 18 Jun 2026 17:58:34 +0000 (19:58 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 20 Jun 2026 12:06:11 +0000 (12:06 +0000)
Add new UserParameter ipfire.kresd.stats.get for retrieval of kresd metrics using curl over unix-sockert.
Add curl command to sudoers for Zabbix agent to be able to access the unix-socket.

Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/zabbix_agentd/sudoers
config/zabbix_agentd/userparameter_ipfire.conf

index 50a9e69def4d907c57155158f1e23d270b5883ac..13edfcce91e07c35d29c872303e50a72729f7aa6 100644 (file)
@@ -12,3 +12,4 @@ zabbix ALL=(ALL) NOPASSWD: /opt/pakfire/pakfire status, /usr/sbin/fping, /usr/sb
 zabbix ALL=(ALL) NOPASSWD: /usr/local/bin/openvpnctrl rw log, /usr/local/bin/wireguardctrl dump
 zabbix ALL=(ALL) NOPASSWD: /var/ipfire/zabbix_agentd/scripts/ipfire_certificate_detail.sh
 zabbix ALL=(ALL) NOPASSWD: /var/ipfire/zabbix_agentd/scripts/ipfire_services.pl
+zabbix ALL=(ALL) NOPASSWD: /usr/bin/curl -s --unix-socket /var/run/knot-resolver/kres-api.sock http\://localhost/metrics/json
index e88c202985faa9e841bae383bd3bc8aab457aebf..a91e305a32c9343a15b811e11cba536b794f4d8a 100644 (file)
@@ -10,9 +10,12 @@ UserParameter=ipfire.captive.clients,awk -F ',' 'length($2) == 17 {sum += 1} END
 UserParameter=ipfire.services.get,sudo /var/ipfire/zabbix_agentd/scripts/ipfire_services.pl
 # IPS throughput bypassed/scanned/whitelisted in bytes/type (JSON)
 UserParameter=ipfire.ips.throughput.get,sudo /usr/local/bin/getipstat -xm | awk 'BEGIN{ORS="";print "{"}/Chain IPS/{f=1}/BYPASSED/&&f{printf "\"bypassed\":%s",$2}/SCANNED/&&f{printf ",\"scanned\":%s",$2}/WHITELISTED/&&f{printf ",\"whitelisted\":%s",$2}/^$/{f=0}END{print "}"}'
+# Knot DNS resolver statistics 
+UserParameter=ipfire.kresd.stats.get,sudo /usr/bin/curl -s --unix-socket /var/run/knot-resolver/kres-api.sock http://localhost/metrics/json
 # Addon: Guardian: Number of currently blocked IP's
 UserParameter=ipfire.guardian.blocked.count,sudo /usr/local/bin/getipstat | awk 'BEGIN{ORS="";c=0}/Chain GUARDIAN/{f=1}/DROP/&&f{c++}/^$/{f=0}END{print c}'
 #
 # Allow item key to be called with (unused) parameters. This allows the #SINGLETON method of discovering this item only when specific service is active
 Alias=ipfire.ips.throughput.get[]:ipfire.ips.throughput.get
+Alias=ipfire.kresd.stats.get[]:ipfire.kresd.stats.get
 Alias=ipfire.guardian.blocked.count[]:ipfire.guardian.blocked.count
\ No newline at end of file