mirror of
https://github.com/furaihan/simple-mikrotik-script.git
synced 2025-06-21 05:45:43 +02:00
minor changes
This commit is contained in:
parent
1208be7fc0
commit
6307f7de28
4 changed files with 6 additions and 5 deletions
|
@ -6,11 +6,13 @@ local setup do={
|
||||||
global cpuarray
|
global cpuarray
|
||||||
set cpuarray ([/system resource get value-name=cpu-load],$cpuarray)
|
set cpuarray ([/system resource get value-name=cpu-load],$cpuarray)
|
||||||
}
|
}
|
||||||
|
#Change the value below to change the number of CPU load sample to average
|
||||||
local cpusample 20
|
local cpusample 20
|
||||||
for i from=1 to=[$cpusample -1] do={
|
for i from=1 to=[$cpusample -1] do={
|
||||||
$setup
|
$setup
|
||||||
}
|
}
|
||||||
local totalcpuarray 0
|
local totalcpuarray 0
|
||||||
|
#calculating the average
|
||||||
foreach value in=$cpuarray do={ set totalcpuarray ($totalcpuarray + $value)}
|
foreach value in=$cpuarray do={ set totalcpuarray ($totalcpuarray + $value)}
|
||||||
:put $totalcpuarray
|
:put $totalcpuarray
|
||||||
local avgcpu ($totalcpuarray / [:len $cpuarray])
|
local avgcpu ($totalcpuarray / [:len $cpuarray])
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
global CheckConnection
|
:global ConnectionAvailable
|
||||||
$CheckConnection
|
$ConnectionAvailable
|
||||||
global ConnectionAvailable
|
|
||||||
if ($ConnectionAvailable=true) do={
|
if ($ConnectionAvailable=true) do={
|
||||||
global CHATID
|
global CHATID
|
||||||
global BOTID
|
global BOTID
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
local result ([/tool fetch mode=https http-method=get url=("https://api.macvendors.com/".[:pick [:tostr $1] 0 8 ]) as-value output=user ]->"data")
|
local result ([/tool fetch mode=https http-method=get url=("https://api.macvendors.com/".[:pick [:tostr $1] 0 8 ]) as-value output=user ]->"data")
|
||||||
return $result
|
return $result
|
||||||
} on-error={
|
} on-error={
|
||||||
return "Error! this probably cause from unknown vendor or a connection problem"
|
return "vendor not found"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#source: https://s.id/q4f-O
|
#source: https://s.id/q4f-O
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
:set internet false;
|
:set internet false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
:return [:tobool $internet]
|
:return $internet
|
||||||
}
|
}
|
||||||
#This script is inspired by TSOKOTSA's script published in the Mikrotik forum
|
#This script is inspired by TSOKOTSA's script published in the Mikrotik forum
|
||||||
:global GenerateRandomString do={
|
:global GenerateRandomString do={
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue