check-health: give error on messing health values

This commit is contained in:
Christian Hesse 2020-10-16 21:35:44 +02:00
parent 8b2df7abd0
commit 3e72d1ec0b

View file

@ -22,6 +22,10 @@
:local CheckHealthCurrent [ / system health get ]; :local CheckHealthCurrent [ / system health get ];
:if ([ :len $CheckHealthCurrent ] = 0) do={
$LogPrintExit error ("Your device does not provide any health values.") true;
}
:foreach Voltage in={ "battery"; "psu1-voltage"; "psu2-voltage"; "voltage" } do={ :foreach Voltage in={ "battery"; "psu1-voltage"; "psu2-voltage"; "voltage" } do={
:if ([ :typeof ($CheckHealthLast->$Voltage) ] = "num" && \ :if ([ :typeof ($CheckHealthLast->$Voltage) ] = "num" && \
[ :typeof ($CheckHealthCurrent->$Voltage) ] = "num") do={ [ :typeof ($CheckHealthCurrent->$Voltage) ] = "num") do={