From 23c5c461a6a3a6eb26df0e34b67bf537287c096a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 15 Nov 2023 15:02:39 +0100 Subject: check-health: use $HumanReadableNum for RAM utilization --- check-health.rsc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'check-health.rsc') diff --git a/check-health.rsc b/check-health.rsc index 3ada4c8..e7977f7 100644 --- a/check-health.rsc +++ b/check-health.rsc @@ -22,6 +22,7 @@ :global Identity; :global FormatLine; +:global HumanReadableNum; :global IfThenElse; :global LogPrintExit2; :global ScriptLock; @@ -57,9 +58,9 @@ $ScriptLock $0; $SendNotification2 ({ origin=$0; \ subject=([ $SymbolForNotification "card-file-box,chart-increasing" ] . "Health warning: RAM utilization"); \ message=("The RAM utilization on " . $Identity . " is at " . $CheckHealthRAMUtilization . "%!\n\n" . \ - [ $FormatLine "total" (($Resource->"total-memory" / 1024 / 1024) . " MiB") ] . "\n" . \ - [ $FormatLine "used" ((($Resource->"total-memory" - $Resource->"free-memory") / 1024 / 1024) . " MiB") ] . "\n" . \ - [ $FormatLine "free" (($Resource->"free-memory" / 1024 / 1024) . " MiB") ]) }); + [ $FormatLine "total" ([ $HumanReadableNum ($Resource->"total-memory") 1024 ] . "iB") ] . "\n" . \ + [ $FormatLine "used" ([ $HumanReadableNum ($Resource->"total-memory" - $Resource->"free-memory") 1024 ] . "iB") ] . "\n" . \ + [ $FormatLine "free" ([ $HumanReadableNum ($Resource->"free-memory") 1024 ] . "iB") ]) }); :set CheckHealthRAMUtilizationNotified true; } :if ($CheckHealthRAMUtilization < 70 && $CheckHealthRAMUtilizationNotified = true) do={ -- cgit v1.2.3-54-g00ecf