mirror of
https://github.com/furaihan/simple-mikrotik-script.git
synced 2025-06-21 05:45:43 +02:00
update cpu-monitoring to use local variable
This commit is contained in:
parent
b1fe41c7b9
commit
a0af6921c4
1 changed files with 5 additions and 7 deletions
|
@ -1,16 +1,14 @@
|
|||
global cpuarray ([/system resource get value-name=cpu-load])
|
||||
local cpuarray
|
||||
local isInternetConnected
|
||||
local rebootIfHigh false
|
||||
local setup do={
|
||||
delay 950ms;
|
||||
global cpuarray
|
||||
set cpuarray ([/system resource get value-name=cpu-load],$cpuarray)
|
||||
}
|
||||
set cpuarray ([/system resource get value-name=cpu-load])
|
||||
#Change the value below to change the number of CPU load sample to average
|
||||
local cpusample 20
|
||||
for i from=1 to=[$cpusample -1] do={
|
||||
$setup
|
||||
delay 950ms;
|
||||
set cpuarray ([/system resource get value-name=cpu-load],$cpuarray)
|
||||
}
|
||||
put $cpuarray
|
||||
local totalcpuarray 0
|
||||
#calculating the average
|
||||
foreach value in=$cpuarray do={ set totalcpuarray ($totalcpuarray + $value)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue