mirror of
https://github.com/furaihan/simple-mikrotik-script.git
synced 2025-06-20 21:35:44 +02:00
11 lines
847 B
Text
11 lines
847 B
Text
:global ConnectionAvailable
|
|
$ConnectionAvailable
|
|
if ($ConnectionAvailable=true) do={
|
|
global CHATID
|
|
global BOTID
|
|
local wan [/ip arp get number=[find where address=[/ip route get number=[find where dst-address="0.0.0.0/0" && active=yes ] gateway]] interface]
|
|
local SendTelegram ("<b>Daily Data Usage Report:</b>%0A"."WAN Interface: $wan%0A"."Upload Usage:".([/interface get $wan tx-byte] / 1024 / 1024 / 1024)." GB%0ADownload Usage: ".([/interface get $wan rx-byte] / 1024 / 1024 / 1024)." GB%0ATotal: ".(([/interface get $wan tx-byte] / 1024 / 1024 / 1024) + ([/interface get $wan rx-byte] / 1024 / 1024 / 1024))." GB")
|
|
/tool fetch url="https://api.telegram.org/bot$BOTID/sendMessage\?chat_id=$CHATID&text=$SendTelegram&parse_mode=html" keep-result=no;
|
|
} else={
|
|
log warning message="Cannot send message to telegram. is internet connected?"
|
|
}
|