]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
zabbix_agentd: Add IPS throughput and guardian blocked IP count items
authorRobin Roevens <robin.roevens@disroot.org>
Tue, 5 Nov 2024 22:36:18 +0000 (23:36 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Wed, 18 Dec 2024 07:27:06 +0000 (08:27 +0100)
- Adds Zabbix Agent userparameter `ipfire.ips.throughput.get` for the agent to get details about IPS throughput bypassed/scanned/whitelisted in bytes (JSON)
- Adds Zabbix Agent userparameter `ipfire.guardian.blocked.count` for the agent to get the number of currently blocked IP's by Addon: Guardian.

Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
config/zabbix_agentd/userparameter_ipfire.conf

index cc0bd9f8e9a9d1a67a0af5efc72136a17e064c99..c8ead1608e5a57db7dd114551ced4ccc0633c92a 100644 (file)
@@ -11,4 +11,12 @@ UserParameter=ipfire.dhcpd.clients,grep -s -E 'lease|bind' /var/state/dhcp/dhcpd
 # Number of Captive Portal clients
 UserParameter=ipfire.captive.clients,awk -F ',' 'length($2) == 17 {sum += 1} END {if (length(sum) == 0) print 0; else print sum}' /var/ipfire/captive/clients
 # Services list and state
-UserParameter=ipfire.services.get,sudo /var/ipfire/zabbix_agentd/scripts/ipfire_services.pl
\ No newline at end of file
+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 "}"}'
+# 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.guardian.blocked.count[]:ipfire.guardian.blocked.count
\ No newline at end of file