Community discussions

MikroTik App
 
User avatar
katem07
just joined
Topic Author
Posts: 17
Joined: Mon Apr 10, 2017 11:35 am
Location: SAR
Contact:

Ethernet Port Rate Reporter - Useful Script for Telegram

Tue Apr 23, 2019 6:03 pm

Hey All,This is a simple script u can schedule it every while of time to detect your Ethernet port rate status

And to report u the situation of it by your Telegram Group
# Look also at viewtopic.php?t=138170

1- To Detect if there is 10Mbps Ethernet Rate
#Edit Here Only Identify Telegram Values
:local server ([/system identity get name])
:local botid "XXXXXXXX"
:local chatid "-XXXXXXX"

#Start Monitoring of All Ethernet Ports
/interface ethernet monitor [find] once do={

:if ($"rate" = "10Mbps") do={
/tool fetch "https://api.telegram.org/$botid/sendmessage?chat_id=$chatid&text=$server%0APort $name Rate is $rate" keep-result=no;};
}


Now if u have a 1Gpbs Ethernet u wish to keep monitoring it,Use this method
#Edit Here to Identify Telegram Values
:local server ([/system identity get name])
:local botid "XXXXXXXX"
:local chatid "-XXXXXXX"

#Start Monitoring of All Ethernet Ports
#Edit The X to the desired Ethernet port Name
/interface ethernet monitor [find name=X] once do={

:if ($"rate" != "1Gbps") do={
/tool fetch "https://api.telegram.org/$botid/sendmessage?chat_id=$chatid&text=$server%0APort $name Rate is $rate" keep-result=no;};
}

I wish it could help u :)

Many thanks for this guy who guide me to the right way to complete it memberlist.php?mode=viewprofile&u=97351

Ahmed Mouselly
Regards.
 
gargola
newbie
Posts: 42
Joined: Tue Nov 20, 2012 12:05 am

Re: Ethernet Port Rate Reporter - Useful Script for Telegram

Sat Mar 21, 2020 3:02 am

Thanks a lot Katem.

It helped me out to do my script, the truth is that I don't know what I''m doing, but this is how I made it work.
#Start Monitoring of All Ethernet Ports
#Edit The X to the desired Ethernet port Name

/interface ethernet monitor etherX once do={

:if ($"rate" != "1Gbps") do={

/tool e-mail send to=example@example.com from=routername@example.com port=587 server=smtp-relay.gmail.com start-tls=yes subject="WAN PORT 100Mbps" body="WAN port went down to 100Mbps at your router"};
}
I don't have telegram, so i'm using my smtp relay in google apps to send emails from my routers.

Who is online

Users browsing this forum: No registered users and 26 guests