Saturday, August 8, 2020

Ethernet Monitor Telegram

:global identity [/system identity get name ]

:global perulangan

:global statusEth

:global iface "ether1"


/int eth monitor $iface once do={

   :if ($"rate" = "100Mbps") do={:set statusEth 0; :set perulangan ($perulangan +1)}

   :if ($"rate" = "100Mbps" && $perulangan =3) do={

       :local pesan "[$identity] %0A$iface = 100Mbps"

       :log error "$iface 100Mbps";

       /tool fetch url="https://api.telegram.org/bot380921546:AAFNlaaxhI063wPAZC-3oNJlefBHz3XgyfI/sendMessage?chat_id=-203533762&text=$pesan" keep-result=no

       /tool fetch url="https://api.telegram.org/bot478500121:AAGnvRMmFHjV25Otf-iUbuN9R1RwjAAM5s8/sendMessage?chat_id=445109932&text=$pesan" keep-result=no

       }

   :if ($"rate" = "1Gbps") do={:set statusEth 1; :set perulangan ($perulangan +1)}

   :if ($"rate" = "1Gbps" && $perulangan =3) do={

       :local pesan "[$identity] %0A$iface = 1Gbps"

       :log warning "$iface 1Gbps"

       /tool fetch url="https://api.telegram.org/bot380921546:AAFNlaaxhI063wPAZC-3oNJlefBHz3XgyfI/sendMessage?chat_id=-203533762&text=$pesan" keep-result=no

       /tool fetch url="https://api.telegram.org/bot478500121:AAGnvRMmFHjV25Otf-iUbuN9R1RwjAAM5s8/sendMessage?chat_id=445109932&text=$pesan" keep-result=no

       }

   :if ($perulangan = 1000 && $statusEth =0 ) do={

       :local pesan "[$identity] %0ACuma Ngabari aja boss%0A$iface = 100Mbps"

       :log warning "Cuma Ngabari, $iface = 100Mbps"

       /tool fetch url="https://api.telegram.org/bot380921546:AAFNlaaxhI063wPAZC-3oNJlefBHz3XgyfI/sendMessage?chat_id=-203533762&text=$pesan" keep-result=no

       /tool fetch url="https://api.telegram.org/bot478500121:AAGnvRMmFHjV25Otf-iUbuN9R1RwjAAM5s8/sendMessage?chat_id=445109932&text=$pesan" keep-result=no

       :set perulangan 1

       }

   }


No comments:

Post a Comment