check-health.d/temperature: use script name for origin in notification

This commit is contained in:
Christian Hesse 2025-08-23 23:24:29 +02:00
parent 907358cb85
commit 62ca30b5d3

View file

@ -11,7 +11,8 @@
:global CheckHealthPlugins; :global CheckHealthPlugins;
:set ($CheckHealthPlugins->[ :jobname ]) do={ :set ($CheckHealthPlugins->[ :jobname ]) do={
:local FuncName [ :tostr $0 ]; :local FuncName [ :tostr $0 ];
:local ScriptName [ :tostr $1 ];
:global CheckHealthLast; :global CheckHealthLast;
:global CheckHealthTemperature; :global CheckHealthTemperature;
@ -54,7 +55,7 @@
} }
:if ($Value > $CheckHealthTemperature->$Name && \ :if ($Value > $CheckHealthTemperature->$Name && \
$CheckHealthTemperatureNotified->$Name != true) do={ $CheckHealthTemperatureNotified->$Name != true) do={
$SendNotification2 ({ origin=$FuncName; \ $SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "fire" ] . "Health warning: " . $Name); \ subject=([ $SymbolForNotification "fire" ] . "Health warning: " . $Name); \
message=("The " . $Name . " on " . $Identity . " is above threshold: " . \ message=("The " . $Name . " on " . $Identity . " is above threshold: " . \
$Value . "\C2\B0" . "C") }); $Value . "\C2\B0" . "C") });
@ -62,7 +63,7 @@
} }
:if ($Value <= ($CheckHealthTemperature->$Name - $CheckHealthTemperatureDeviation) && \ :if ($Value <= ($CheckHealthTemperature->$Name - $CheckHealthTemperatureDeviation) && \
$CheckHealthTemperatureNotified->$Name = true) do={ $CheckHealthTemperatureNotified->$Name = true) do={
$SendNotification2 ({ origin=$FuncName; \ $SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
message=("The " . $Name . " on " . $Identity . " dropped below threshold: " . \ message=("The " . $Name . " on " . $Identity . " dropped below threshold: " . \
$Value . "\C2\B0" . "C") }); $Value . "\C2\B0" . "C") });