aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-05-06 15:17:05 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-05-06 15:34:04 +0200
commit96621e01cb6e0331fc9e2e4b90610fb7c210aab7 (patch)
treec6707700b1d4fb5ce33974ce088c0fd0140f68ef
parent0b1bb0f2b2b388c3fb591e1872c18779bf034415 (diff)
netwatch-notify: log failed resolve just once
-rw-r--r--netwatch-notify9
1 files 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") };
}