When Mikrotik Closes, Ship Log/sms/mail – Era Tool Middle

#Transmitting Uptime Data to the Variable

:native UPTIME [/system resource get uptime]

#Uptime Restrict is transferred to the Variable (this time is as much as you as you need.)

:native UPTIMELIMIT “00:05:00”

# Date, Time knowledge is transferred to variables.

:native date;

:native time;

:set date [/system clock get date];

:set time [/system clock get time];

# If Uptime knowledge is under the desired prohibit, log ‘details about this topic is transferred and sms / mail is distributed.


:log error “ALARM: Router Rebooted. Present uptime standing $ UPTIMELIMIT Minute, Sms and Mail Sending.”;

# Products and services are looking ahead to a short while to load.

:prolong 161s

# GMAIL Setup

: native gmailid [email protected]

: native GMAILPASS “GmailPassword”

: world gmailsmtp

: set gmailsmtp [: resolve “smtp.gmail.com”];

: native COMPANY “Through Techsoftcenter”

# SMSCompany Configuration

# You want to get your SMSCompany account.

: native SMSURL “api.companysms.com”

: native KID “companyusername”

: native KPASS “companysifre”

Telephone numbers to be despatched

: native cell1 “0493021909”

: native cell2 “0493xxxxxxx”

:world WAN1IP

:world WAN2IP

# 2 PPPOE Connection is checked. If it receives a rope, its knowledge is transferred to the variable to ship mail.

# If there’s no pppoe connection, log is famous in this topic, it stops the method.

if ([/ interface get ADSL_1 disabled] = sure) do = {: log error “ADSL_1 Connection Disabled”}

else = {[: global WAN1IP [/ ip address get [find where interface = ADSL_1] deal with];]}

if ([/ interface get ADSL_2 disabled] = sure) do = {: log error “ADSL_2 Connection is Disable”}

else = {[: global WAN2IP [/ ip address get [find where interface = ADSL_2] deal with];]}

# Mail recipients are outlined. Defines 2 mail accounts.

: native mailsendto

: set mailsendto adminemailaccount@gmail.com

: native mailsendto2

: set mailsendto2 technicalemailaccount@gmail.com

# Set E mail Topic

: native es “$ [/ system identity get name] $ [/ system clock get date] $ [/ system clock get time] $ FIRM MICROTIC Reboot! New IPs $ WAN1IP $ WAN2IP General $ UPTIME energetic”

# Set E mail Frame

: native eb “$ [/ system identity get name] $ [/ system clock get date] $ [/ system clock get time] $ FIRM MIKROTIK Has Been Reboot! New IPs $ WAN1IP $ WAN2IP General $ UPTIME Lively” n n Present Uptime Period $ UPTIME n n Powered Through Techsoftcenter!

# In the end ship electronic mail to each amind electronic mail addresses

/instrument email ship to=$mailsendto topic=$es start-tls=sure frame=$eb password=$GMAILPASS

/instrument email ship to=$mailsendto2 topic=$es frame=$eb start-tls=sure password=$GMAILPASS

: log caution “Email about Reboot ...

: log caution “Sms Despatched About Reboot.

# SMS Sending Operation

/instrument fetch url=”http://$SMSURL/v1/send-sms/get/?username=$KID&password=$KPASS&receipents=$cell1 $cell2&textual content=$COMPANY MIKROTIK Router Reboot has been and now sum $date $time New energetic threads $WAN1IP $WAN2IP [$COMPANY ByTechsoftcenter]”

# If the Uptime Point in time has been exceeded (if sms mail has been despatched inside the first specified length, alarm passive standing and data is entered so as to not ship mail once more.

} else = {

: log error “Device $ UPTIMELIMIT has been energetic for a while. No sms mail is needed.”


Leave a Reply

Your email address will not be published. Required fields are marked *