From 19103cd3451a9a5a6be6faa8c2745754ddc40606 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 5 Jul 2022 13:23:34 +0200 Subject: netwatch-notify: rename parameter: hostname -> name Starting with RouterOS 7.4 the netwatch tool has been extended, it can now do tcp and http probes. Rename the parameter for reasonable naming with services. --- netwatch-notify | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'netwatch-notify') diff --git a/netwatch-notify b/netwatch-notify index d9b8cf0..e1c8e43 100644 --- a/netwatch-notify +++ b/netwatch-notify @@ -59,7 +59,7 @@ $ScriptLock $0; :local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ]; :if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={ - :local HostName ($HostInfo->"hostname"); + :local HostName ($HostInfo->"name"); :local Metric { "count"=0; "notified"=false }; :if ([ :typeof ($NetwatchNotify->$HostName) ] = "array") do={ @@ -72,7 +72,7 @@ $ScriptLock $0; :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") "" ] . \ + $HostInfo->"name") ("' for host '" . $HostInfo->"name") "" ] . \ "' resolves to different address " . $Resolve . ", updating.") false; /tool/netwatch/set host=$Resolve $Host; :set ($Metric->"resolve-failed") false; @@ -80,7 +80,7 @@ $ScriptLock $0; } 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; + $HostInfo->"name") ("' for host '" . $HostInfo->"name") "" ] . "' failed.") false; :set ($Metric->"resolve-failed") true; } } -- cgit v1.2.3-54-g00ecf