]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
zabbix_agentd: Add ARPing method for checking Internet Gateway
authorRobin Roevens <robin.roevens@disroot.org>
Thu, 17 Jul 2025 17:52:01 +0000 (19:52 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Jul 2025 10:08:53 +0000 (10:08 +0000)
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>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/rootfiles/packages/zabbix_agentd
config/zabbix_agentd/sudoers
config/zabbix_agentd/userparameter_gateway.conf [new file with mode: 0644]
config/zabbix_agentd/userparameter_ipfire.conf
lfs/zabbix_agentd

index ffa66f30718d137515d3a1013c4de9206d0a3793..cc75a49bd82d7f8b4b4be6f1430da195c786f988 100644 (file)
@@ -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
index 78e175980a0777e1db67437811b58b57f0862901..921e20c894d88d94f33878aed9b2fe931162d42d 100644 (file)
@@ -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 (file)
index 0000000..cfae001
--- /dev/null
@@ -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 $?
index c8ead1608e5a57db7dd114551ced4ccc0633c92a..e88c202985faa9e841bae383bd3bc8aab457aebf 100644 (file)
@@ -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
index c2b8533b4632b1be55a601b010ff3d5029ece5ff..ebd184628fc774739c965734f78bd8af6f72f7fe 100644 (file)
@@ -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