I have hAP ac^2 (and hAP ac^3 lte on another location) and what to know how to send notification through internet (email, zabbix, telegram) to me when device restarted.
I try to setup email logging system+info to email, but uplink is not ready and email cannot be sent, especially with lte uplink. Maybe it is possible to add the email to a queue and send after internet is available, but I don’t know how.
Here’s my script that does exactly that. Note the time delay at the beginning. E-Mail has to already be set up.
In scheduler, there is an event that runs this script with a start time of “Startup”
:log info "Starting System Startup script"
:delay 00:00:20
:log info "Sending System startup E-Mail to primary@E-Mail"
/tool e-mail send to="primary@E-Mail" body="$[/system clock get date] at $[/system clock get time] MikroTik RB4011 router has started 20 seconds ago." \
subject="RB4011 router startup"
:delay 00:00:10
:log info "Sending System startup E-Mail to Secondary@E-Mail"
/tool e-mail send to="Secondary@E-Mail" body="$[/system clock get date] at $[/system clock get time] MikroTik RB4011 router has started 30 seconds ago." \
subject="RB4011 startup"
:log info "System Startup script completed"
It can be also done without using estimated delays in startup scheduler to be sure that sending email is executed when internet connection is established combining scheduler and netwatch.
For eg. startup scheduler script can write some file (because global variable cannot be used in this case) as flag to send email and on netwatch event when connection is up script can check if such file exists to send email, when send email command is performed without error delete file so that on next netwach event email sending will not be triggered until ROS is started again.