diff options
author | Christian Hesse <mail@eworm.de> | 2023-01-20 14:24:20 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-01-20 23:13:27 +0100 |
commit | 75bd14267e7a5507e0d58b9945dbb24e5d831af8 (patch) | |
tree | 1a9b59bf9eb675ba57a5c55693364aad77ab6fe2 /check-health | |
parent | 2694f8d2b1d15d16fa5f062612dd7fcf2d392ea8 (diff) |
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%.
---- ✂️ ----
Diffstat (limited to 'check-health')
-rw-r--r-- | check-health | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/check-health b/check-health index e754d69..3957ad1 100644 --- a/check-health +++ b/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 ]; |