From 17e9635ca1cf676499bb2cff9470da04faa3504b Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 17 Jul 2020 07:41:47 +0200 Subject: check-health: use $SymbolByUnicodeName --- check-health | 11 ++++++----- 1 file 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"); } -- cgit v1.2.3-54-g00ecf