Community discussions

MikroTik App
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Netwatch?

Mon Jan 31, 2011 6:11 pm

Alright, This maybe something really simple but I think I'm goofing up something somewhere.

I want to use the Netwatch that is built into the RouterOS and I cant seem to get it to work the way I want it. I have went to the wiki and tried applying those scripts and failed. What I want to do is when a "netwatched" hardware goes down I want to have it send me an email.

So what do I need to have to make this little beast do what I need it to do?

The MikroTik I am using has a public IP on port 1 and Private 10.x.x.x's on Ports 2-5. The "netwatched" hardware is all 10.x.x.x's. I have a godaddy account with webspace/website/email.

What I was doing was logging into my godaddy account and trying to find the email sever IP and port. I Put the information in (at least what I thought was correct) and it doesnt seem to work.

Here is what I was trying to get to work
Image
(I was putting in my information and it didn't work at all)

The information I was following can be found on this website
http://gregsowell.com/?p=819
Any Ideas?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Netwatch?

Mon Jan 31, 2011 6:22 pm

First attempt sending yourself email from the CLI, and not from within a script. Is that working? If not, add a system logging item for the 'e-mails' topic and check the logs after another attempt to send and see where it fails.
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Re: Netwatch?

Mon Jan 31, 2011 6:27 pm

I have no idea how to do that :(
Im very new to these routerboards and new to this setup.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Netwatch?

Mon Jan 31, 2011 6:35 pm

/system logging
add topics=e-mail action=memory
Then run the "/tool e-mail send" command directly from a terminal and see what happens. You can then look at the logs (click the Log button in Winbox, or run "/log print") and it will give you debug output that will hopefully show where it failed.
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Re: Netwatch?

Tue Feb 01, 2011 3:56 pm

I get the following error "failure: recipient address required" Does this mean the email i have set up in the MT has incorect data?
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Netwatch?

Tue Feb 01, 2011 4:12 pm

Try placing " around your to address and from address. Sometimes the router doesn't like like certain fields without them, especially if they have special characters in them.
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Re: Netwatch?

Tue Feb 01, 2011 7:14 pm

Same error :(
I don't know if it'll make it simpler, id set up a gmail account for this if it would make this process faster. :)
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Netwatch?

Wed Feb 02, 2011 1:07 am

please post:
/tool email export
Obviously edit some things if you don't want others to see what e-mail addresses you are using :)
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Re: Netwatch?

Wed Feb 02, 2011 3:10 pm

set from="\example@example.com\" password=password123 \
server=72.***.***.80:25 username=\
"\example@example.com\"
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Netwatch?

Wed Feb 02, 2011 4:14 pm

I'm sure the '\' marks are going to mess things up, remove them. When something is in quote marks, it's taken as a literal string, so the \ marks are being interpenetrated as part of the e-mail address.
set from="example@example.com" password=password123 \
server=72.***.***.80:25 username=\
"example@example.com"
If you are ever in doubt about a command structure, try pasting it into the terminal or via SSH, the router will usually highlight syntax errors.
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Re: Netwatch?

Wed Feb 02, 2011 4:39 pm

tried that still didn't work. I am thinking the address I am using from godaddy's email maybe wrong... Is there any way I could use a gmail account for this?
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Netwatch?

Wed Feb 02, 2011 5:19 pm

Yes, you can actually make up any e-mail address you want for the stuff to be sent from if you want. You just need a legitimate to address and a SMTP server that will let you bounce the e-mails off of.

You'll have to read up on the g-mail documentation so you know what sever and ports to use since I don't think they use the standard ones for SMTP. They may have restrictions on their servers for who/what domains are allowed to send e-mails.
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Re: Netwatch?

Wed Feb 02, 2011 6:11 pm

Alright. I went to gmails website and found this;

Outgoing Mail (SMTP) Server - requires TLS or SSL: smtp.gmail.com (use authentication)
Use Authentication: Yes
Port for TLS/STARTTLS: 587
Port for SSL: 465

I have tried both ports and neither will allow me to send.

port 465 gives me the error; SMTP is not ready to send
port 587 gives me the error; Invalid FROM address.

At this point if you know a free email sever that will let me do what I need to do I'll do that just for testing until I can figure this out =\
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Re: Netwatch?

Thu Feb 03, 2011 2:59 pm

Seems like no matter what email i use I always get invaild FROM address :?
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Netwatch?

Thu Feb 03, 2011 4:44 pm

That's a little weird. I know there have been some threads about using g-mails SMTP servers to send out emails, so maybe you can try and find those and see if there's something that is missing.

There's not going to be many open e-mail servers that you can use, if they are open chances are they are a relay for spam bots and will be black listed as such. We have our own SMTP servers that I use to bounce e-mails off of the routers from for updates and such. Sometimes your ISP will give you information on a relay server that they have, so maybe you could try one of those. It all depends on what rules they have set up on their servers for what IPs, Domains, and addresses they will relay for.
 
ProCon
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Sat Sep 18, 2010 9:08 pm

Re: Netwatch?

Thu Feb 03, 2011 4:55 pm

Feklar, Thank you so much for your help. I did figure something out here. My issue was the TLS and I can use a free email provider. I just used gmail to send me an email saying "whoaza" :)

i needed to have tls=yes and use that port.

Once again thanks for all the help :)