From: Robin Roevens <robin.roevens@disroot.org>
To: development@lists.ipfire.org
Cc: Robin Roevens <robin.roevens@disroot.org>
Subject: [PATCH 2/6] zabbix_agentd: Add ARPing method for checking Internet Gateway
Date: Thu, 17 Jul 2025 19:52:01 +0200 [thread overview]
Message-ID: <20250717180805.5754-3-robin.roevens@disroot.org> (raw)
In-Reply-To: <20250717180805.5754-1-robin.roevens@disroot.org>
Since some ISP's block ICMP ping to their gateway ARPing can be an alternative.
This change adds arping alternatives for the regular (icmp) ping checks:
- ipfire.net.gateway.arping: Check if the Internet Gateway is reachable via ARPing
- ipfire.net.gateway.arpingtime: Measure the time it takes to ARPing the Internet Gateway
Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
---
config/rootfiles/packages/zabbix_agentd | 1 +
config/zabbix_agentd/sudoers | 3 ++-
config/zabbix_agentd/userparameter_gateway.conf | 12 ++++++++++++
config/zabbix_agentd/userparameter_ipfire.conf | 4 ----
lfs/zabbix_agentd | 2 ++
5 files changed, 17 insertions(+), 5 deletions(-)
create mode 100644 config/zabbix_agentd/userparameter_gateway.conf
diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packages/zabbix_agentd
index ffa66f307..cc75a49bd 100644
--- a/config/rootfiles/packages/zabbix_agentd
+++ b/config/rootfiles/packages/zabbix_agentd
@@ -21,6 +21,7 @@ var/ipfire/zabbix_agentd/userparameters
var/ipfire/zabbix_agentd/userparameters/userparameter_pakfire.conf
var/ipfire/zabbix_agentd/userparameters/userparameter_ipfire.conf
var/ipfire/zabbix_agentd/userparameters/userparameter_ovpn.conf
+var/ipfire/zabbix_agentd/userparameters/userparameter_gateway.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 78e175980..921e20c89 100644
--- a/config/zabbix_agentd/sudoers
+++ b/config/zabbix_agentd/sudoers
@@ -8,6 +8,7 @@
# To add more sudo rights to zabbix agent, you should modify the sudoers file zabbix_agentd_user
#
Defaults:zabbix !requiretty
-zabbix ALL=(ALL) NOPASSWD: /opt/pakfire/pakfire status, /usr/sbin/fping, /usr/local/bin/getipstat, /bin/cat /var/run/ovpnserver.log
+zabbix ALL=(ALL) NOPASSWD: /opt/pakfire/pakfire status, /usr/sbin/fping, /usr/sbin/arping, /usr/local/bin/getipstat
+zabbix ALL=(ALL) NOPASSWD: /bin/cat /var/run/ovpnserver.log
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
diff --git a/config/zabbix_agentd/userparameter_gateway.conf b/config/zabbix_agentd/userparameter_gateway.conf
new file mode 100644
index 000000000..cfae001ae
--- /dev/null
+++ b/config/zabbix_agentd/userparameter_gateway.conf
@@ -0,0 +1,12 @@
+# Parameters to monitor Internet gateway connectivity
+#
+# ICMP Ping
+# Internet Gateway ping timings, can be used to measure "Internet Line Quality"
+UserParameter=ipfire.net.gateway.pingtime,sudo /usr/sbin/fping -c 3 gateway 2>&1 | tail -n 1 | awk '{print $NF}' | cut -d '/' -f2
+# Internet Gateway availability, can be used to check Internet connection
+UserParameter=ipfire.net.gateway.ping,sudo /usr/sbin/fping -q -r 3 gateway; [ ! $? == 0 ]; echo $?
+# ARP Ping
+# Internet Gateway ping timings, can be used to measure "Internet Line Quality" when ICMP ping is not available
+UserParameter=ipfire.net.gateway.arpingtime,sudo /usr/sbin/arping -i red0 -c 3 gateway | awk 'match($0, /time=([0-9\.]+) (\w+)$/, arr) { n++; if (arr[2] == "usec") { arr[1]/=1000; }; sum+=arr[1] } END { print sum / n }'
+# Internet Gateway availability, can be used to check Internet connection when ICMP ping is not available
+UserParameter=ipfire.net.gateway.arping,sudo /usr/sbin/arping -q -c 3 gateway; [ ! $? == 0 ]; echo $?
diff --git a/config/zabbix_agentd/userparameter_ipfire.conf b/config/zabbix_agentd/userparameter_ipfire.conf
index c8ead1608..e88c20298 100644
--- a/config/zabbix_agentd/userparameter_ipfire.conf
+++ b/config/zabbix_agentd/userparameter_ipfire.conf
@@ -1,9 +1,5 @@
# Parameters for monitoring IPFire specific metrics
#
-# Internet Gateway ping timings, can be used to measure "Internet Line Quality"
-UserParameter=ipfire.net.gateway.pingtime,sudo /usr/sbin/fping -c 3 gateway 2>&1 | tail -n 1 | awk '{print $NF}' | cut -d '/' -f2
-# Internet Gateway availability, can be used to check Internet connection
-UserParameter=ipfire.net.gateway.ping,sudo /usr/sbin/fping -q -r 3 gateway; [ ! $? == 0 ]; echo $?
# Firewall Filter Forward chain drops in bytes/chain (JSON), can be used for discovery of firewall chains and monitoring of firewall hits on each chain
UserParameter=ipfire.net.fw.hits.raw,sudo /usr/local/bin/getipstat -xf | grep "/\* DROP_.* \*/$" | awk 'BEGIN { ORS = ""; print "["} { printf "%s{\"chain\": \"%s\", \"bytes\": \"%s\"}", separator, substr($11, 6), $2; separator = ", "; } END { print"]" }'
# Number of currently Active DHCP leases
diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd
index c2b8533b4..ebd184628 100644
--- a/lfs/zabbix_agentd
+++ b/lfs/zabbix_agentd
@@ -112,6 +112,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
/var/ipfire/zabbix_agentd/userparameters/userparameter_ipfire.conf
install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/userparameter_ovpn.conf \
/var/ipfire/zabbix_agentd/userparameters/userparameter_ovpn.conf
+ install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/userparameter_gateway.conf \
+ /var/ipfire/zabbix_agentd/userparameters/userparameter_gateway.conf
# Install IPFire-specific Zabbix Agent scripts
-mkdir -pv /var/ipfire/zabbix_agentd/scripts
--
2.50.1
--
Dit bericht is gescanned op virussen en andere gevaarlijke
inhoud door MailScanner en lijkt schoon te zijn.
next prev parent reply other threads:[~2025-07-17 18:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 17:51 [PATCH 0/6] zabbix_agentd: More functionality + CRITICAL OpenVPN fixes Robin Roevens
2025-07-17 17:52 ` [PATCH 1/6] zabbix_agentd: Update to 7.0.16 (LTS) Robin Roevens
2025-07-17 17:52 ` Robin Roevens [this message]
2025-07-17 17:52 ` [PATCH 3/6] zabbix_agentd: Add WireGuard specific monitoring items Robin Roevens
2025-07-17 17:52 ` [PATCH 4/6] zabbix_agentd: Add LocationDB functionality Robin Roevens
2025-07-17 17:52 ` [PATCH 5/6] zabbix_agentd: Openvpn-2.6: fix pid name for services stats Robin Roevens
2025-07-17 17:52 ` [PATCH 6/6] zabbix_agentd: Openvpn-2.6: use the helper binary to read the status log 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=20250717180805.5754-3-robin.roevens@disroot.org \
--to=robin.roevens@disroot.org \
--cc=development@lists.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