zabbix_agentd: Add support for suricata metrics

Message ID 20260731085343.1085178-2-robin.roevens@disroot.org
State New
Headers
Series zabbix_agentd: Add support for suricata metrics |

Commit Message

Robin Roevens 31 Jul 2026, 8:49 a.m. UTC
Add new UserParameters:
 - suricata.counters.get: for retrieval of suricata counters using suricatasc.
  - suricata.version for retrieval of current suricata version using suricatasc
Add both suricatasc commands to sudoers for Zabbix agent to be able to query suricata.

Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
---
 config/rootfiles/packages/zabbix_agentd          | 1 +
 config/zabbix_agentd/sudoers                     | 1 +
 config/zabbix_agentd/userparameter_suricata.conf | 3 +++
 lfs/zabbix_agentd                                | 2 ++
 4 files changed, 7 insertions(+)
 create mode 100644 config/zabbix_agentd/userparameter_suricata.conf
  

Patch

diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packages/zabbix_agentd
index 7f1f39b64..d73d9a0f2 100644
--- a/config/rootfiles/packages/zabbix_agentd
+++ b/config/rootfiles/packages/zabbix_agentd
@@ -24,6 +24,7 @@  var/ipfire/zabbix_agentd/userparameters/userparameter_ovpn.conf
 var/ipfire/zabbix_agentd/userparameters/userparameter_gateway.conf
 var/ipfire/zabbix_agentd/userparameters/userparameter_wireguard.conf
 var/ipfire/zabbix_agentd/userparameters/userparameter_locationdb.conf
+var/ipfire/zabbix_agentd/userparameters/userparameter_suricata.conf
 var/ipfire/zabbix_agentd/scripts
 var/ipfire/zabbix_agentd/scripts/ipfire_certificate_detail.sh
 var/ipfire/zabbix_agentd/scripts/ipfire_services.pl
diff --git a/config/zabbix_agentd/sudoers b/config/zabbix_agentd/sudoers
index 13edfcce9..8669b0361 100644
--- a/config/zabbix_agentd/sudoers
+++ b/config/zabbix_agentd/sudoers
@@ -13,3 +13,4 @@  zabbix ALL=(ALL) NOPASSWD: /usr/local/bin/openvpnctrl rw log, /usr/local/bin/wir
 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
+zabbix ALL=(ALL) NOPASSWD: /usr/bin/suricatasc --command=dump-counters, /usr/bin/suricatasc --command=version
\ No newline at end of file
diff --git a/config/zabbix_agentd/userparameter_suricata.conf b/config/zabbix_agentd/userparameter_suricata.conf
new file mode 100644
index 000000000..b8f8c5b98
--- /dev/null
+++ b/config/zabbix_agentd/userparameter_suricata.conf
@@ -0,0 +1,3 @@ 
+# Suricata statistics
+UserParameter=suricata.counters.get,sudo /usr/bin/suricatasc --command=dump-counters
+UserParameter=suricata.version,sudo /usr/bin/suricatasc --command=version
\ No newline at end of file
diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd
index cbf4b246c..e696828b5 100644
--- a/lfs/zabbix_agentd
+++ b/lfs/zabbix_agentd
@@ -118,6 +118,8 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 		/var/ipfire/zabbix_agentd/userparameters/userparameter_wireguard.conf
 	install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/userparameter_locationdb.conf \
 		/var/ipfire/zabbix_agentd/userparameters/userparameter_locationdb.conf
+	install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/userparameter_suricata.conf \
+		/var/ipfire/zabbix_agentd/userparameters/userparameter_suricata.conf
 
 	# Install IPFire-specific Zabbix Agent scripts
 	-mkdir -pv /var/ipfire/zabbix_agentd/scripts