Community discussions

 
aosiqing
just joined
Topic Author
Posts: 8
Joined: Thu Jan 22, 2015 4:24 pm

Hello, everyone, my ROS is far away, the power of ROS is cut off by the bad guys. I want to add a script to detect ROS

Thu Sep 19, 2019 8:23 pm

Hello, everyone, my ROS is far away, the power of ROS is cut off by the bad guys. I want to add a script to detect ROS on ros. If ROS restart, I will send an email to my mailbox. How to create this script, thank you, I am Chinese, English is not good, if there are great God pictures and texts, it will be very grateful.
 
Exiver
Member Candidate
Member Candidate
Posts: 113
Joined: Sat Jan 10, 2015 6:45 pm

Re: Hello, everyone, my ROS is far away, the power of ROS is cut off by the bad guys. I want to add a script to detect R

Fri Sep 20, 2019 12:02 pm

You could use the Scheduler:
https://wiki.mikrotik.com/wiki/Manual:System/Scheduler

Setup a scheduler like this:
add name=reboot-notification start-time=startup interval=0 on-event="/tool e-mail send from=\"admin@yourmikrotik.com\" to=\"notifications@yourdomain.com\" subject=\"Device rebootet\" body=\"Router XYZ rebootet. Please check\""
You need to make sure, sending emails is possible - as well as you should set your from and to-address and the body and subject you want to send to yourself.
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 1717
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Hello, everyone, my ROS is far away, the power of ROS is cut off by the bad guys. I want to add a script to detect R

Fri Sep 20, 2019 6:00 pm

Run such script when rebooted
#
:local loctoemail "destination@address.com"
#
:local locident [/system identity get name]
:local locmachine  [/system resource get architecture-name]
:local locversion [/system resource get version]
:local loctime [/system clock get time]
:local locdate [/system clock get date]
/tool e-mail send to="$loctoemail" subject=("Rebooted: $locident ($locmachine/$locversion) @ $locdate $loctime")
Real admins use real keyboards.
 
aosiqing
just joined
Topic Author
Posts: 8
Joined: Thu Jan 22, 2015 4:24 pm

Re: Hello, everyone, my ROS is far away, the power of ROS is cut off by the bad guys. I want to add a script to detect R

Sat Sep 21, 2019 6:55 am

You could use the Scheduler:
https://wiki.mikrotik.com/wiki/Manual:System/Scheduler

Setup a scheduler like this:
add name=reboot-notification start-time=startup interval=0 on-event="/tool e-mail send from=\"admin@yourmikrotik.com\" to=\"notifications@yourdomain.com\" subject=\"Device rebootet\" body=\"Router XYZ rebootet. Please check\""
You need to make sure, sending emails is possible - as well as you should set your from and to-address and the body and subject you want to send to yourself.
Thank you, but I found a problem that ROS did not have a network when sending email immediately after restart. It took several seconds for the network to link. How to set up a network state to send this email to monitor restart?
 
Miracle
Member Candidate
Member Candidate
Posts: 106
Joined: Fri Sep 11, 2015 9:04 am

Re: Hello, everyone, my ROS is far away, the power of ROS is cut off by the bad guys. I want to add a script to detect R

Sat Sep 21, 2019 7:19 am

Some uptime monitor service: uptimerobot.com pingdom.com...
Use them to monitor your ddns address, they can send email, sms, app arlert.
 
aosiqing
just joined
Topic Author
Posts: 8
Joined: Thu Jan 22, 2015 4:24 pm

Re: Hello, everyone, my ROS is far away, the power of ROS is cut off by the bad guys. I want to add a script to detect R

Sat Sep 21, 2019 9:29 am

Some uptime monitor service: uptimerobot.com pingdom.com...
Use them to monitor your ddns address, they can send email, sms, app arlert.
how TO do? i cannot,thinks
 
marting
Member Candidate
Member Candidate
Posts: 164
Joined: Thu Aug 21, 2014 2:07 pm

Re: Hello, everyone, my ROS is far away, the power of ROS is cut off by the bad guys. I want to add a script to detect R

Thu Sep 26, 2019 4:09 pm

Either ping some address in the internet until it is available or simply wait a few seconds before the email:

:delay 15
#mail....

Who is online

Users browsing this forum: No registered users and 9 guests