netwatch-notify: also support the name from property

This commit is contained in:
Christian Hesse 2022-07-05 16:36:00 +02:00
parent 5767fceb39
commit 8e6eff30db

View file

@ -12,6 +12,7 @@
:global NetwatchNotify; :global NetwatchNotify;
:global EitherOr;
:global IfThenElse; :global IfThenElse;
:global IsDNSResolving; :global IsDNSResolving;
:global LogPrintExit2; :global LogPrintExit2;
@ -61,7 +62,7 @@ $ScriptLock $0;
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ]; :local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
:if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={ :if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={
:local Name ($HostInfo->"name"); :local Name [ $EitherOr ($HostInfo->"name") ($HostVal->"name") ];
:local Metric { "count"=0; "notified"=false }; :local Metric { "count"=0; "notified"=false };
:if ([ :typeof ($NetwatchNotify->$Name) ] = "array") do={ :if ([ :typeof ($NetwatchNotify->$Name) ] = "array") do={