mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-04 10:15:05 +02:00
check-health: monitor CPU load
---- ✂️ ---- 🧮️📈️ Health warning: CPU load The average CPU load on MikroTik is at 76%! ---- ✂️ ---- 🧮️📉️ Health recovery: CPU load The average CPU load on MikroTik decreased to 64%. ---- ✂️ ----
This commit is contained in:
parent
2694f8d2b1
commit
75bd14267e
10 changed files with 30 additions and 7 deletions
16
check-health
16
check-health
|
@ -10,6 +10,8 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:global CheckHealthCPULoad;
|
||||
:global CheckHealthCPULoadNotified;
|
||||
:global CheckHealthLast;
|
||||
:global CheckHealthTemperature;
|
||||
:global CheckHealthTemperatureDeviation;
|
||||
|
@ -43,6 +45,20 @@
|
|||
|
||||
$ScriptLock $0;
|
||||
|
||||
:set CheckHealthCPULoad (($CheckHealthCPULoad * 4 + [ /system/resource/get cpu-load ] * 10) / 5);
|
||||
:if ($CheckHealthCPULoad > 750 && $CheckHealthCPULoadNotified != true) do={
|
||||
$SendNotification2 ({ origin=$0; \
|
||||
subject=([ $SymbolForNotification "abacus,chart-increasing" ] . "Health warning: CPU load"); \
|
||||
message=("The average CPU load on " . $Identity . " is at " . ($CheckHealthCPULoad / 10) . "%!") });
|
||||
:set CheckHealthCPULoadNotified true;
|
||||
}
|
||||
:if ($CheckHealthCPULoad < 650 && $CheckHealthCPULoadNotified = true) do={
|
||||
$SendNotification2 ({ origin=$0; \
|
||||
subject=([ $SymbolForNotification "abacus,chart-decreasing" ] . "Health recovery: CPU load"); \
|
||||
message=("The average CPU load on " . $Identity . " decreased to " . ($CheckHealthCPULoad / 10) . "%.") });
|
||||
:set CheckHealthCPULoadNotified false;
|
||||
}
|
||||
|
||||
:foreach Voltage in=[ /system/health/find where type="V" ] do={
|
||||
:local Name [ /system/health/get $Voltage name ];
|
||||
:local Value [ /system/health/get $Voltage value ];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue