Setup email alert high latency, trigger packet loss & gateway has down on mikrotik .
this time, i wrote about "make email alert for high latency gate, packet loss, and gate down". before you create scripting, you need to know about the smpt connection in your mikrotik and the scheduler to run this script.
:local date [/system clock get date]; -------> get date information on router mikrotik
to generate log information that the start of sending email
create conditions where there is a ping condition above <59ms and packet loss <10%
do email delivery if the condition in accordance with above.
comments for discussion with me about this post. if you are willing to help. please help to share with your friends. :)
please :
please do not plagiarize and acquire about this paper. appreciate any posts others have made. because every writing made is very valuable because it takes time and thought :).
:local date [/system clock get date]; -------> get date information on router mikrotik
:local
time [/system clock get time]; -------> get clock information on router mikrotik
:local
avgRtt; -------> to get an average rating ping
:local
pin -------> to get the value of packet received ping
:local
pout -------> to get the value of packet sent ping
:local
target 10.3.9.129 -------> ip address what will be target host ping
trigger with flood-ping to get the average information, send and receive
/tool flood-ping $target count=100 do={ :if ($sent = 100) do={ :set avgRtt $"avg-rtt" :set pout $sent :set pin $received }}
:local sendemail ("Send Email")
(to perform packet loss calculations based on the percentage of packets sent in comparison with received packets)
:local ploss (100 - (($pin * 100) / $pout))
(to generate information obtained from floodping calculations)
:local logmsg ("Ping Average for $target = ".[:tostr $avgRtt]."ms - packet loss: ".[:tostr $ploss]."%")
:if ([:tostr $avgRtt] = 0) do={ :set logmsg ("Ping Average for $target = FAILED, packet loss: ".[:tostr $ploss]."%") } :if (([:tostr $ploss] >= 10) || ($avgRtt >= 59)) do={ :log error $logmsg :log warning $sendemail
/tool e-mail send to="baha@tshoot-note.com" subject="[Alert Mikrotik Link to Internet]" body="$logmsg. \n\n Mohon untuk melakukan pengecekan link . Checker Ping ini berjalan setiap 10 menit. \n Apabila latency ping ke internet ping>60ms & packetloss>10%\n\nInfo \nTanggal : $date\nJam : $time" from="baha.udin@edi-indonesia.co.id" server="mail.tshoot-note.com" password="12345" user="baha" start-tls=yes port=587 }
}
comments for discussion with me about this post. if you are willing to help. please help to share with your friends. :)
please :
please do not plagiarize and acquire about this paper. appreciate any posts others have made. because every writing made is very valuable because it takes time and thought :).
Komentar
Posting Komentar