From 96621e01cb6e0331fc9e2e4b90610fb7c210aab7 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 6 May 2021 15:17:05 +0200 Subject: netwatch-notify: log failed resolve just once --- netwatch-notify | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/netwatch-notify b/netwatch-notify index 3d0bd91..27afd70 100644 --- a/netwatch-notify +++ b/netwatch-notify @@ -42,10 +42,14 @@ $HostInfo->"hostname") ("' for host '" . $HostInfo->"hostname") "" ] . \ "' resolves to different address " . $Resolve . ", updating.") false; / tool netwatch set host=$Resolve $Host; + :set ($Metric->"resolve-failed") false; } } on-error={ - $LogPrintExit2 warning $0 ("Resolving name '" . $HostInfo->"resolve" . [ $IfThenElse ($HostInfo->"resolve" != \ - $HostInfo->"hostname") ("' for host '" . $HostInfo->"hostname") "" ] . "' failed.") false; + :if ($Metric->"resolve-failed" != true) do={ + $LogPrintExit2 warning $0 ("Resolving name '" . $HostInfo->"resolve" . [ $IfThenElse ($HostInfo->"resolve" != \ + $HostInfo->"hostname") ("' for host '" . $HostInfo->"hostname") "" ] . "' failed.") false; + :set ($Metric->"resolve-failed") true; + } } } @@ -113,5 +117,6 @@ "count"=($Metric->"count"); "notified"=($Metric->"notified"); "parent"=($Metric->"parent"); + "resolve-failed"=($Metric->"resolve-failed"); "since"=($Metric->"since") }; } -- cgit v1.2.3-54-g00ecf