mirror of
https://github.com/furaihan/simple-mikrotik-script.git
synced 2025-06-24 15:08:40 +02:00
code cleanup
This commit is contained in:
parent
b0755b9d0e
commit
4963691fa6
2 changed files with 5 additions and 8 deletions
|
@ -15,9 +15,8 @@ foreach value in=$cpuarray do={ set totalcpuarray ($totalcpuarray + $value)}
|
||||||
:put $totalcpuarray
|
:put $totalcpuarray
|
||||||
local avgcpu ($totalcpuarray / [:len $cpuarray])
|
local avgcpu ($totalcpuarray / [:len $cpuarray])
|
||||||
if ($avgcpu > 65) do={
|
if ($avgcpu > 65) do={
|
||||||
global CheckConnection
|
:global ConnectionAvailable
|
||||||
$CheckConnection
|
$ConnectionAvailable
|
||||||
global ConnectionAvailable
|
|
||||||
if ($ConnectionAvailable=true) do={
|
if ($ConnectionAvailable=true) do={
|
||||||
global CHATID
|
global CHATID
|
||||||
global BOTID
|
global BOTID
|
||||||
|
|
|
@ -3,11 +3,9 @@
|
||||||
:global CHATID ("-4936xxx")
|
:global CHATID ("-4936xxx")
|
||||||
#Change telegram bot id below with your own
|
#Change telegram bot id below with your own
|
||||||
:global BOTID ("62xxxxxxxx:AAExxxx")
|
:global BOTID ("62xxxxxxxx:AAExxxx")
|
||||||
:global GetMacVendor
|
:global GetMacVendor do={
|
||||||
:set GetMacVendor do={
|
|
||||||
local MacAddress [:tostr $1]
|
|
||||||
:do {
|
:do {
|
||||||
local result ([/tool fetch mode=https http-method=get url=("https://api.macvendors.com/".[:pick [:tostr $MacAddress] 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 "Error! this probably cause from unknown vendor or a connection problem"
|
||||||
|
@ -48,7 +46,7 @@
|
||||||
:set internet false;
|
:set internet false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
:return $internet
|
:return [:tobool $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