Community discussions

MikroTik App
 
Alex920807
just joined
Topic Author
Posts: 2
Joined: Tue Jan 05, 2021 12:14 am

Netwatch Email contents script help  [SOLVED]

Tue Jun 01, 2021 10:06 pm

Hey All.

I'm quite new to the scripting side of router os.

I would like an email to be sent with the subject of that email being link is up at time xxxx.
then the body of the email to have the log file attached or printed.

currently, my script is as follows.

on the up
:global myVarDownTime
:log error "WAN link is up."
/tool e-mail send to="My Email address" subject="$[/system identity get name] WAN Link is up on $[/system clock get time]."


this works perfectly and am receiving the email however when I try to add the log file the email will not send and no error message is reported

any help would be appreciated.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Netwatch Email contents script help

Thu Jun 03, 2021 9:10 pm

You show what works, and ask help about what hidden not work?

No answer or sarcastic reply to your question? How to write posts
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19106
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Netwatch Email contents script help

Fri Jun 04, 2021 3:13 am

Simply add this to the end of the netwatch script after the email
:log info "My Connection is now UP"

Also my script is similar but not quite the same.
:local sub1 ([/system clock get time])
/tool e-mail send from="myemail@addresss.ca" body="At $sub1 WAN Link is Up[" subject="Wan Link is Up-QUAD9" to="myemail@address.ca"
:log info "My Connection is Back Up!"
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1070
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Netwatch Email contents script help

Wed Jun 09, 2021 10:46 am

You may be interested in my script "Notify on host up and down".
It gives some extra functionality (like simple state machine and dependencies) and sends nicely formatted notifications via e-mail, telegram and matrix.
Screenshot_2021-06-09_09-45-08.png
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: MTNick and 19 guests