1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

check-health: use $HumanReadableNum for RAM utilization

This commit is contained in:
Christian Hesse
2023-11-15 15:02:39 +01:00
parent 5f457e5c37
commit 23c5c461a6

View File

@ -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={