Kali ini saya akan bagi tips buat monitoring Rate pada Ethernet Mikrotik lalu dilaporkan ke Telegram. OK langsung aja ya, buat scheduler isinya seperti berikut
:global perulangan
:global statusEth
:global iface "ether2-CDIX"
/int eth monitor ether2 once do={
:if ($"rate" = "100Mbps" && $perulangan <3) do={
:set statusEth 0
:set perulangan ($perulangan +1)
:log error "$iface is 100Mbps"
:local pesan "$iface is 100Mbps";
/tool fetch url="https://api.telegram.org/bot380921xxx:AAGn69QpFDuLSOQd3E3JtIJxxxxx/sendMessage?chat_id=-20353xxx&text=$pesan" keep-result=no
:if ($perulangan = 3 && $statusEth = 0) do={
:log error "$iface MASIH 100Mbps"
:local pesan "$iface MASIH 100Mbps"
/tool fetch url="https://api.telegram.org/bot380921xxx:AAGn69QpFDuLSOQd3E3JtIJxxxxx/sendMessage?chat_id=-20353xxx&text=$pesan" keep-result=no
}
} else={
:set statusEth 1
:if ($statusEth = 1 && $perulangan >= 1000) do={:set perulangan 1}
:if ($statusEth = 1 && $perulangan >= 1) do={:set perulangan ($perulangan +1)}
:if ($perulangan = 2) do={
:log warning "$iface 1Gbps"
:local pesan "Alhamdulillaah $iface 1Gbps";
/tool fetch url="https://api.telegram.org/bot380921xxx:AAGn69QpFDuLSOQd3E3JtIJxxxxx/sendMessage?chat_id=-20353xxx&text=$pesan" keep-result=no
}
}
}
0 comments:
Post a Comment