From patchwork Fri Jun 5 21:28:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 9913 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1 raw public key) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R12" (not verified)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4gXF1B6nS9z3wrb for ; Fri, 05 Jun 2026 21:28:46 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [IPv6:2001:678:b28::201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (Client CN "mail02.haj.ipfire.org", Issuer "E8" (not verified)) by mail01.ipfire.org (Postfix) with ESMTPS id 4gXF1B4HvTz10R for ; Fri, 05 Jun 2026 21:28:46 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4gXF1B3b1Gz30Sf for ; Fri, 05 Jun 2026 21:28:46 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1 raw public key) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R12" (not verified)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4gXF176zcSz2xP7 for ; Fri, 05 Jun 2026 21:28:43 +0000 (UTC) Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4gXF163Kdkz6X for ; Fri, 05 Jun 2026 21:28:42 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=i3Zf+UVB; dmarc=pass (policy=reject) header.from=disroot.org; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1780694922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=1xXt06ClrWpFEuS21CHOIktl0bV5rW3gGz8Bwtuw4wc=; b=VZSK7OW8eIwmpVdDyaBd5SfiTjaU9Nl2tRFZ02T1vS/FziNteMKhjyNU7dyG3Tnzz7QweT lqXNTro9szg5jQ2spAlr84ePfkjsn7HMw+kJSLVOMVYX7QbaWOBgbBmmtZNBTwTXaranI9 zIJ5658Z4RClyrI3QFEsfIQ+rlu7CwXWbE4SIwfnVeYp/Lsh0jtMKBrG7kzBqFqAL+7v6g n6Rx/g7Ksj7tc+M2uvA5vxor+JqP0EEn9psRhhRW9jPt8boaq1dIZW6drdOIIk9OguzYLw XUdbPMgjmQIb6LX2AIkNOXiCbUOnbnR56/2PSXzA2HZwOo8JGwTXA3Z9xG51lQ== ARC-Seal: i=1; a=rsa-sha256; d=lists.ipfire.org; s=202003rsa; cv=none; t=1780694922; b=ZYnJU7sTgwAGth9N/1f4915iM436Ux32Yl4JBp7nTf1+PhwVR2VvtAv62FwSdkY3aosfii umkxrAAPfaikiuyo/sDq3+jrQ3gXeN88lpd9lEHSLKkhF5+VV1pC13PsHG/uy4koAIv9zz oi/gLOjN71kmjTyeiwLSayACmFts91FFoop5o0cz2UW4sl69Uu++JjE3ryb92yCksy+LCR 9umFbzJAiSYSZ5JRAEsJGr6ECglpJAlsk8I5zuTtcArBBBu/6thJeE0ttTvXSRxG7Vm6ru CpMVM5JSgPfxF346tt64OQ/gqpwnUsgeaoNMK/FJmUowolauskuyq89bFa5KrQ== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=i3Zf+UVB; dmarc=pass (policy=reject) header.from=disroot.org; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id C5C0D26E6B for ; Fri, 5 Jun 2026 23:28:41 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Nds5DDqnFZXg for ; Fri, 5 Jun 2026 23:28:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1780694921; bh=xTpdqh4Hw2xU+5UAbiuRpJZYQeeDr+uRbDrIycRh9vA=; h=From:To:Cc:Subject:Date; b=i3Zf+UVBIrCCmhWb18M9IDeKTNzYFdbCiZg6ZN5W0N3AIHKqxn2s3tIgtevO8TGFq 6cSo8rJMJj8whOo62MbYDRdj3Eg/0NYs1+OPON9qqI/ByenjzVsF8s7PpGRjzjzFwH eJXLyULO/VCo5HzHSCLZESsvhaFl6a02gEYbtFIssWfNcS8NZjoi4lGWuShUEYfh5p GHHN4q5z7AI78TX17xUeHcQCUjCHMFYh/3fLcX/0cdierSAO3EfvT8+XF1zPL19RDm bBEsRxqqzCLRwKICo3WurBRO57zNpa0WxN3XKR94DCjDr19VVmYRg4zUzVR1YckCdX eaat9hp114nkQ== Received: from chojin.roevenslambrechts.be (chojin.roevenslambrechts.be [192.168.0.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (no client certificate requested) (Authenticated sender) by hachiman (MailScanner Milter) with SMTP id A0D2A54160D; Fri, 5 Jun 2026 23:28:38 +0200 (CEST) From: Robin Roevens To: development@lists.ipfire.org Cc: Robin Roevens Subject: [PATCH] zabbix_agentd: Fix gateway ping errorhandling Date: Fri, 5 Jun 2026 23:28:30 +0200 Message-ID: <20260605212830.1067298-1-robin.roevens@disroot.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 X-RoevensLambrechts-MailScanner-ID: A0D2A54160D.AD543 X-RoevensLambrechts-MailScanner: Found to be clean X-RoevensLambrechts-MailScanner-From: robin.roevens@disroot.org X-RoevensLambrechts-MailScanner-Watermark: 1781299719.36081@6nmpg/MkcDrzrSOLdJrJQQ X-Rspamd-Server: mail01.haj.ipfire.org X-Rspamd-Queue-Id: 4gXF163Kdkz6X X-Rspamd-Action: no action X-Spamd-Result: default: False [-2.52 / 11.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,reject]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; R_SPF_ALLOW(-0.20)[+a]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; IP_REPUTATION_HAM(-0.01)[asn: 50673(0.00), country: NL(-0.01), ip: 178.21.23.139(0.00)]; DKIM_REPUTATION(0.00)[0]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; RCVD_COUNT_THREE(0.00)[3]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; DKIM_TRACE(0.00)[disroot.org:+] Fixed gateway ping items: * ipfire.net.gateway.pingtime: now always returns 0 when fping does not return the expected stats * ipfire.net.gateway.ping: prevent possible stderr messages from slipping in the output * ipfire.net.gateway.arpingtime: now always return 0 when arping does not return the expected stats. * ipfire.net.gateway.arping: now effectively returns 0 when arping fails. Previously this returned the arping error making Zabbix fail to detect gateway down events. Signed-off-by: Robin Roevens --- config/zabbix_agentd/userparameter_gateway.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/zabbix_agentd/userparameter_gateway.conf b/config/zabbix_agentd/userparameter_gateway.conf index cfae001ae..6f8d84c7b 100644 --- a/config/zabbix_agentd/userparameter_gateway.conf +++ b/config/zabbix_agentd/userparameter_gateway.conf @@ -2,11 +2,11 @@ # # 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 +UserParameter=ipfire.net.gateway.pingtime,output=$(sudo /usr/sbin/fping -c 3 gateway 2>&1) && echo "$output" | tail -n 1 | grep -q "xmt/rcv/%loss" && echo "$output" | tail -n 1 | awk '{print $NF}' | cut -d '/' -f2 || echo "0" # 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 $? +UserParameter=ipfire.net.gateway.ping,sudo /usr/sbin/fping -q -r 3 gateway 2>/dev/null; [ ! $? == 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 }' +UserParameter=ipfire.net.gateway.arpingtime,sudo /usr/sbin/arping -i red0 -c 3 gateway 2>/dev/null | awk 'match($0, /time=([0-9\.]+) (\w+)$/, arr) { n++; if (arr[2] == "usec") { arr[1]/=1000; }; sum+=arr[1] } END { if (n > 0) print sum / n; else print "0" }' # 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 $? +UserParameter=ipfire.net.gateway.arping,sudo /usr/sbin/arping -q -c 3 gateway 2>/dev/null; [ ! $? == 0 ]; echo $?