From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 2/2] zabbix_agentd: Add IPS throughput and guardian blocked IP count items Date: Tue, 05 Nov 2024 23:36:18 +0100 Message-ID: <20241105223618.4086546-2-robin.roevens@disroot.org> In-Reply-To: <20241105223618.4086546-1-robin.roevens@disroot.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5739021720773094267==" List-Id: --===============5739021720773094267== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable - Adds Zabbix Agent userparameter `ipfire.ips.throughput.get` for the agent t= o get details about IPS throughput bypassed/scanned/whitelisted in bytes (JSO= N) - Adds Zabbix Agent userparameter `ipfire.guardian.blocked.count` for the age= nt to get the number of currently blocked IP's by Addon: Guardian. Signed-off-by: Robin Roevens --- config/zabbix_agentd/userparameter_ipfire.conf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/zabbix_agentd/userparameter_ipfire.conf b/config/zabbix_a= gentd/userparameter_ipfire.conf index cc0bd9f8e..c8ead1608 100644 --- a/config/zabbix_agentd/userparameter_ipfire.conf +++ b/config/zabbix_agentd/userparameter_ipfire.conf @@ -11,4 +11,12 @@ UserParameter=3Dipfire.dhcpd.clients,grep -s -E 'lease|bin= d' /var/state/dhcp/dhcpd # Number of Captive Portal clients UserParameter=3Dipfire.captive.clients,awk -F ',' 'length($2) =3D=3D 17 {sum= +=3D 1} END {if (length(sum) =3D=3D 0) print 0; else print sum}' /var/ipfire= /captive/clients # Services list and state -UserParameter=3Dipfire.services.get,sudo /var/ipfire/zabbix_agentd/scripts/i= pfire_services.pl \ No newline at end of file +UserParameter=3Dipfire.services.get,sudo /var/ipfire/zabbix_agentd/scripts/i= pfire_services.pl +# IPS throughput bypassed/scanned/whitelisted in bytes/type (JSON) +UserParameter=3Dipfire.ips.throughput.get,sudo /usr/local/bin/getipstat -xm = | awk 'BEGIN{ORS=3D"";print "{"}/Chain IPS/{f=3D1}/BYPASSED/&&f{printf "\"byp= assed\":%s",$2}/SCANNED/&&f{printf ",\"scanned\":%s",$2}/WHITELISTED/&&f{prin= tf ",\"whitelisted\":%s",$2}/^$/{f=3D0}END{print "}"}' +# Addon: Guardian: Number of currently blocked IP's +UserParameter=3Dipfire.guardian.blocked.count,sudo /usr/local/bin/getipstat = | awk 'BEGIN{ORS=3D"";c=3D0}/Chain GUARDIAN/{f=3D1}/DROP/&&f{c++}/^$/{f=3D0}E= ND{print c}' +# +# Allow item key to be called with (unused) parameters. This allows the #SIN= GLETON method of discovering this item only when specific service is active +Alias=3Dipfire.ips.throughput.get[]:ipfire.ips.throughput.get +Alias=3Dipfire.guardian.blocked.count[]:ipfire.guardian.blocked.count \ No newline at end of file --=20 2.47.0 --===============5739021720773094267==--