Community discussions

MikroTik App
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2477
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Email alert by bad ping latency

Tue Nov 07, 2017 12:22 am

[code:local Themes "Monitor IP delay to alarm threshold"
#Set the monitored IP address
:local addre 192.168.88.1;
#Set the delay
:local ms 200;
:local avgRtt;
/tool flood-ping $addre count=10 do={
:if ($sent = 10) do={
:set avgRtt $"avg-rtt"
}}
:if ($avgRtt >= $ms) do={
#Send mail Where set i the TLS mode on this script?
/tool e-mail send server=<Server IP> port=587 user=<user> password=<pass> to=to@mail.com from=from@mail.com subject=$Themes body=("Monitoring IP:$addre\ndelay:$avgRtt ms")
:log err "Message has been sent";
}][/code]

I have that see in the forum but i don't find it, ik will add TLS description.
Who can help me please
[code:local Themes "Monitor IP delay to alarm threshold"
#Set the monitored IP address
:local addre 192.168.88.1;
#Set the delay
:local ms 200;
:local avgRtt;
/tool flood-ping $addre count=10 do={
:if ($sent = 10) do={
:set avgRtt $"avg-rtt"
}}
:if ($avgRtt >= $ms) do={
#Send mail Where set i the TLS mode on this script?
/tool e-mail send server=<Server IP> port=587 user=<user> password=<pass> to=to@mail.com from=from@mail.com subject=$Themes body=("Monitoring IP:$addre\ndelay:$avgRtt ms")
:log err "Message has been sent";
 
Miracle
Member Candidate
Member Candidate
Posts: 106
Joined: Fri Sep 11, 2015 9:04 am

Re: Email alert by bad ping latency

Tue Nov 07, 2017 7:49 am

 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1841
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Email alert by bad ping latency

Tue Nov 07, 2017 8:39 am

[code:local Themes ".....
Edit your post and adde a ] to the [code

You can also change server setting for email from:
/tool e-mail send server=<Server IP> port=587 user=<user> password=<pass> to=to@mail.com from=from@mail.com subject=$Themes body=("Monitoring IP:$addre\ndelay:$avgRtt ms")
:log err "Message has been sent";
To:
/tool e-mail send to=to@mail.com subject=$Themes body=("Monitoring IP:$addre\ndelay:$avgRtt ms")
:log err "Message has been sent";
Add all email settings including TLS so all script uses the same her:
Tools->Email or terminal
/tool e-mail set address=<Server IP> port=587 start-tls=yes from=from@mail.com user=<user> password=<pass>
 
How to use Splunk to monitor your MikroTik Router(s)

MikroTik->Splunk
 
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2477
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Email alert by bad ping latency

Tue Nov 07, 2017 6:57 pm

Sorry it don't work :(
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2477
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Email alert by bad ping latency

Fri Nov 10, 2017 3:59 pm

Anybody?
 
stoser
Member Candidate
Member Candidate
Posts: 120
Joined: Sun Aug 21, 2016 12:04 am

Re: Email alert by bad ping latency

Fri Nov 10, 2017 5:47 pm

I am not really sure what you are asking, or what behavior your are experiencing. Will need more information. Is the email not being sent correctly? Are you referring to the TLS property of the email tool? Does the mail.com server return an error?
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2477
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Email alert by bad ping latency

Sat Nov 11, 2017 2:02 am

The email will not be sent
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1841
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Email alert by bad ping latency

Sat Nov 11, 2017 8:32 am

1. Has it ever worked?

2. Are you using gmail?
If so, have you configured google to accept gmail relay, if not, it does not work.
 
How to use Splunk to monitor your MikroTik Router(s)

MikroTik->Splunk
 
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2477
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Email alert by bad ping latency

Sat Nov 11, 2017 11:56 am

It has worked but only at last bugfix.
I use my email information from Telenet (Belgium)
Thanks for your reply
 
stoser
Member Candidate
Member Candidate
Posts: 120
Joined: Sun Aug 21, 2016 12:04 am

Re: Email alert by bad ping latency

Sat Nov 11, 2017 5:51 pm

If this problem started recently, but was working before, perhaps your provider Telenet changed something or added a requirement similar to the gmail relay requirement mentioned by @Jotne. I can tell you that I have not had a problem with gmail or zoho mail up to and including 6.40.4, running on a RB3011.

My config is similar to the one suggested by @plisken, but one of the problems I had initially was with the TLS setting. With ZOHO mail I had to select start-tls=tls-only in the Email Setting. Selecting tls=yes in the send email tool DID NOT WORK. Try selecting "tls-only" instead of "yes" when setting up the email settings. Here's the settings that I use for Zoho mail (start-tls=yes fails with, but start-tls=tls-only works) This is my config:

/tool e-mail set address=<server IP> from="<From User Text>" password=\
<password> port=<port number> start-tls=tls-only user=user@mail.com

/tool e-mail send to="<Send To address>" subject=<"Subject text"> body="<Body Text>"

Hope this helps,
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2477
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Email alert by bad ping latency

Wed Nov 15, 2017 3:29 am

I have tried with gmail but it does not work.
Nobody can improve that script pleace
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1841
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Email alert by bad ping latency

Wed Nov 15, 2017 8:24 am

Are you able to send email from the MikroTik?
Tools->Email->Send Email
At the same time open your Log to see what going on.
If you can not send email from there, then the error is not in the script.
 
How to use Splunk to monitor your MikroTik Router(s)

MikroTik->Splunk
 
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2477
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Email alert by bad ping latency

Mon Feb 05, 2018 6:49 pm

Yes i can email send from the Mikrotik to Gmail and recieve the test email thats works
 
mendocino
just joined
Posts: 9
Joined: Wed Jul 31, 2013 11:40 pm

Re: Email alert by bad ping latency

Fri Mar 01, 2019 7:00 pm

Hello, a question how can I do it so that I can do it on a specific WAN, I have 2 wan and I would like it to be indicated when there is latency in 2. Greetings

Who is online

Users browsing this forum: aTan and 45 guests