From 6307f7de289b93b91619f56c4c71cc622f94c6c0 Mon Sep 17 00:00:00 2001 From: furaihan Date: Tue, 1 Sep 2020 13:16:20 +0700 Subject: [PATCH] minor changes --- cpu-monitoring | 2 ++ data-usage-to-telegram | 5 ++--- first-setup | 4 ++-- quad9-doh => quad9-doh.rsc | 0 4 files changed, 6 insertions(+), 5 deletions(-) rename quad9-doh => quad9-doh.rsc (100%) diff --git a/cpu-monitoring b/cpu-monitoring index 06923c9..c4c140d 100644 --- a/cpu-monitoring +++ b/cpu-monitoring @@ -6,11 +6,13 @@ local setup do={ global 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 for i from=1 to=[$cpusample -1] do={ $setup } local totalcpuarray 0 +#calculating the average foreach value in=$cpuarray do={ set totalcpuarray ($totalcpuarray + $value)} :put $totalcpuarray local avgcpu ($totalcpuarray / [:len $cpuarray]) diff --git a/data-usage-to-telegram b/data-usage-to-telegram index e04df64..726fd47 100644 --- a/data-usage-to-telegram +++ b/data-usage-to-telegram @@ -1,6 +1,5 @@ -global CheckConnection -$CheckConnection -global ConnectionAvailable +:global ConnectionAvailable +$ConnectionAvailable if ($ConnectionAvailable=true) do={ global CHATID global BOTID diff --git a/first-setup b/first-setup index cc34d88..f6e2f9c 100644 --- a/first-setup +++ b/first-setup @@ -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") return $result } on-error={ - return "Error! this probably cause from unknown vendor or a connection problem" + return "vendor not found" } } #source: https://s.id/q4f-O @@ -46,7 +46,7 @@ :set internet false; } } - :return [:tobool $internet] + :return $internet } #This script is inspired by TSOKOTSA's script published in the Mikrotik forum :global GenerateRandomString do={ diff --git a/quad9-doh b/quad9-doh.rsc similarity index 100% rename from quad9-doh rename to quad9-doh.rsc