diff options
author | Christian Hesse <mail@eworm.de> | 2020-07-17 07:41:47 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-07-17 07:52:56 +0200 |
commit | 17e9635ca1cf676499bb2cff9470da04faa3504b (patch) | |
tree | 559fcbf911e519a2e0694f0419cd511f35d4fcb1 /check-health | |
parent | 7862ce5f1995e2c61fe93d6916d6f00c81694230 (diff) |
check-health: use $SymbolByUnicodeName
Diffstat (limited to 'check-health')
-rw-r--r-- | check-health | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/check-health b/check-health index 3710bd2..a63483e 100644 --- a/check-health +++ b/check-health @@ -13,6 +13,7 @@ :global LogPrintExit; :global SendNotification; +:global SymbolByUnicodeName; :local FormatVoltage do={ :local Voltage [ :tonum $1 ]; @@ -26,7 +27,7 @@ [ :typeof ($CheckHealthCurrent->$Voltage) ] = "num") do={ :if ($CheckHealthLast->$Voltage * (100 + $CheckHealthVoltagePercent) < $CheckHealthCurrent->$Voltage * 100 || \ $CheckHealthLast->$Voltage * 100 > $CheckHealthCurrent->$Voltage * (100 + $CheckHealthVoltagePercent)) do={ - $SendNotification ("\E2\9A\A1 Health warning: " . $Voltage) \ + $SendNotification ([ $SymbolByUnicodeName "high-voltage-sign" ] . " Health warning: " . $Voltage) \ ("The " . $Voltage . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \ "old value: " . [ $FormatVoltage ($CheckHealthLast->$Voltage) ] . "\n" . \ "new value: " . [ $FormatVoltage ($CheckHealthCurrent->$Voltage) ]); @@ -39,12 +40,12 @@ [ :typeof ($CheckHealthCurrent->($PSU . "-state")) ] = "str") do={ :if ($CheckHealthLast->($PSU . "-state") = "ok" && \ $CheckHealthCurrent->($PSU . "-state") != "ok") do={ - $SendNotification ("\E2\9D\8C Health warning: " . $PSU . " state") \ + $SendNotification ([ $SymbolByUnicodeName "cross-mark" ] . " Health warning: " . $PSU . " state") \ ("The power supply unit '" . $PSU . "' on " . $Identity . " failed!"); } :if ($CheckHealthLast->($PSU . "-state") != "ok" && \ $CheckHealthCurrent->($PSU . "-state") = "ok") do={ - $SendNotification ("\E2\9C\85 Health recovery: " . $PSU . " state") \ + $SendNotification ([ $SymbolByUnicodeName "white-heavy-check-mark" ] . " Health recovery: " . $PSU . " state") \ ("The power supply unit '" . $PSU . "' on " . $Identity . " recovered!"); } } @@ -59,13 +60,13 @@ } :if ($CheckHealthLast->$Temperature <= $CheckHealthTemperature->$Temperature && \ $CheckHealthCurrent->$Temperature > $CheckHealthTemperature->$Temperature) do={ - $SendNotification ("\F0\9F\94\A5 Health warning: " . $Temperature) \ + $SendNotification ([ $SymbolByUnicodeName "fire" ] . " Health warning: " . $Temperature) \ ("The " . $Temperature . " on " . $Identity . " is above threshold: " . \ $CheckHealthCurrent->$Temperature . "\C2\B0" . "C"); } :if ($CheckHealthLast->$Temperature > $CheckHealthTemperature->$Temperature && \ $CheckHealthCurrent->$Temperature <= $CheckHealthTemperature->$Temperature) do={ - $SendNotification ("\E2\9C\85 Health recovery: " . $Temperature) \ + $SendNotification ([ $SymbolByUnicodeName "white-heavy-check-mark" ] . " Health recovery: " . $Temperature) \ ("The " . $Temperature . " on " . $Identity . " dropped below threshold: " . \ $CheckHealthCurrent->$Temperature . "\C2\B0" . "C"); } |