diff options
author | Christian Hesse <mail@eworm.de> | 2021-04-27 21:43:22 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2021-04-28 13:58:37 +0200 |
commit | baed8b5cfd7245efef3432182a53c63651aa744a (patch) | |
tree | 46ff4d0c1520a581cf6a953a3c9c979e478ac926 /check-health | |
parent | ebd3dbedcbe5c71dde258a5e05a531ad8c70983f (diff) |
check-health: pass origin to $SendNotification2
Diffstat (limited to 'check-health')
-rw-r--r-- | check-health | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/check-health b/check-health index dba24d8..ec89545 100644 --- a/check-health +++ b/check-health @@ -42,7 +42,8 @@ [ :typeof $Voltage ] = "num") do={ :if ($CheckHealthLast->$Name * (100 + $CheckHealthVoltagePercent) < $Voltage * 100 || \ $CheckHealthLast->$Name * 100 > $Voltage * (100 + $CheckHealthVoltagePercent)) do={ - $SendNotification2 ({ subject=([ $SymbolForNotification "high-voltage-sign" ] . "Health warning: " . $Name); \ + $SendNotification2 ({ origin=$0; \ + subject=([ $SymbolForNotification "high-voltage-sign" ] . "Health warning: " . $Name); \ message=("The " . $Name . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \ "old value: " . [ $FormatVoltage ($CheckHealthLast->$Name) ] . "\n" . \ "new value: " . [ $FormatVoltage $Voltage ]) }); @@ -56,12 +57,14 @@ [ :typeof $PSU ] = "str") do={ :if ($CheckHealthLast->$Name = "ok" && \ $PSU != "ok") do={ - $SendNotification2 ({ subject=([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name); \ + $SendNotification2 ({ origin=$0; \ + subject=([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name); \ message=("The power supply unit '" . $Name . "' on " . $Identity . " failed!") }); } :if ($CheckHealthLast->$Name != "ok" && \ $PSU = "ok") do={ - $SendNotification2 ({ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \ + $SendNotification2 ({ origin=$0; \ + subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \ message=("The power supply unit '" . $Name . "' on " . $Identity . " recovered!") }); } } @@ -81,14 +84,16 @@ } :if ($Temperature > $CheckHealthTemperature->$Name && \ $CheckHealthTemperatureNotified->$Name != true) do={ - $SendNotification2 ({ subject=([ $SymbolForNotification "fire" ] . "Health warning: " . $Name); \ + $SendNotification2 ({ origin=$0; \ + subject=([ $SymbolForNotification "fire" ] . "Health warning: " . $Name); \ message=("The " . $Name . " on " . $Identity . " is above threshold: " . \ $Temperature . "\C2\B0" . "C") }); :set ($CheckHealthTemperatureNotified->$Name) true; } :if ($Temperature <= ($CheckHealthTemperature->$Name - $CheckHealthTemperatureDeviation) && \ $CheckHealthTemperatureNotified->$Name = true) do={ - $SendNotification2 ({ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \ + $SendNotification2 ({ origin=$0; \ + subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \ message=("The " . $Name . " on " . $Identity . " dropped below threshold: " . \ $Temperature . "\C2\B0" . "C") }); :set ($CheckHealthTemperatureNotified->$Name) false; |