aboutsummaryrefslogtreecommitdiffstats
path: root/netwatch-notify
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-05-06 12:55:05 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-05-06 15:11:05 +0200
commitcfb31e844c39089046de1fc7021d5dedef14c145 (patch)
tree12f421b5e8d2df7345040dc3b108de4149cac427 /netwatch-notify
parent9d19313eee7e647a7f094aa01f40f179bfd23b0b (diff)
netwatch-notify: support dynamic address updatechange-50
Diffstat (limited to 'netwatch-notify')
-rw-r--r--netwatch-notify15
1 files changed, 15 insertions, 0 deletions
diff --git a/netwatch-notify b/netwatch-notify
index 9cb99bb..50441a9 100644
--- a/netwatch-notify
+++ b/netwatch-notify
@@ -33,6 +33,21 @@
:set $Metric ($NetwatchNotify->$HostName);
}
+ :if ([ :typeof ($HostInfo->"resolve") ] = "str") 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;
+ }
+ } on-error={
+ $LogPrintExit2 warning $0 ("Resolving name '" . $HostInfo->"resolve" . [ $IfThenElse ($HostInfo->"resolve" != \
+ $HostInfo->"hostname") ("' for host '" . $HostInfo->"hostname") "" ] . "' failed.") false;
+ }
+ }
+
:if ($HostVal->"status" = "up") do={
:local Count ($Metric->"count");
:if ($Count > 0) do={