aboutsummaryrefslogtreecommitdiffstats
path: root/netwatch-notify
diff options
context:
space:
mode:
Diffstat (limited to 'netwatch-notify')
-rw-r--r--netwatch-notify32
1 files changed, 17 insertions, 15 deletions
diff --git a/netwatch-notify b/netwatch-notify
index e82cea6..34a9e8f 100644
--- a/netwatch-notify
+++ b/netwatch-notify
@@ -66,21 +66,23 @@ $ScriptLock $0;
:set $Metric ($NetwatchNotify->$HostName);
}
- :if ([ :typeof ($HostInfo->"resolve") ] = "str" && [ $DNSIsResolving ] = true) do={
- :do {
- :local Resolve [ :resolve ($HostInfo->"resolve") ];
- :if ($Resolve != $HostVal->"host") do={
- $LogPrintExit2 info $0 ("Name '" . $HostInfo->"resolve" . [ $IfThenElse ($HostInfo->"resolve" != \
- $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={
- :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;
+ :if ([ :typeof ($HostInfo->"resolve") ] = "str") do={
+ :if ([ $DNSIsResolving ] = true) do={
+ :do {
+ :local Resolve [ :resolve ($HostInfo->"resolve") ];
+ :if ($Resolve != $HostVal->"host") do={
+ $LogPrintExit2 info $0 ("Name '" . $HostInfo->"resolve" . [ $IfThenElse ($HostInfo->"resolve" != \
+ $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={
+ :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;
+ }
}
}
}