mirror of
https://github.com/furaihan/simple-mikrotik-script.git
synced 2025-06-20 21:35:44 +02:00
added check connection function and update cpu-monitoring
This commit is contained in:
parent
f03e93151b
commit
840defec9b
2 changed files with 14 additions and 8 deletions
|
@ -15,14 +15,10 @@ foreach value in=$cpuarray do={ set totalcpuarray ($totalcpuarray + $value)}
|
|||
:put $totalcpuarray
|
||||
local avgcpu ($totalcpuarray / [:len $cpuarray])
|
||||
if ($avgcpu > 65) do={
|
||||
tool flood-ping 8.8.8.8 count=10 do={
|
||||
/if ($received > 8) do={
|
||||
set $isInternetConnected [tobool true]
|
||||
} else={
|
||||
set $isInternetConnected [tobool false]
|
||||
}
|
||||
}
|
||||
if ($isInternetConnected=true) do={
|
||||
global CheckConnection
|
||||
$CheckConnection
|
||||
global ConnectionAvailable
|
||||
if ($ConnectionAvailable=true) do={
|
||||
global CHATID
|
||||
global BOTID
|
||||
local sendToTelegram ("Mikrotik ".[/system resource get value-name=board-name]."(".[/sy id get value-name=name].") :%0A\E2\9A\A0 \E2\9A\A0 <b>CPU Load Report</b>%0AAverage: $avgcpu%25%0ACPU Samples: $cpusample%0AReboot if CPU sample show highload: $rebootIfHigh")
|
||||
|
|
10
first-setup
10
first-setup
|
@ -38,3 +38,13 @@ global ConvertUpperCase do={
|
|||
}
|
||||
:return $result
|
||||
}
|
||||
global CheckConnection do={
|
||||
global ConnectionAvailable
|
||||
tool flood-ping 8.8.8.8 count=10 do={
|
||||
/if ($received > 8) do={
|
||||
set $ConnectionAvailable [tobool true]
|
||||
} else={
|
||||
set $ConnectionAvailable [tobool false]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue