Daily email with the previous day's bandwidth usage?

Post new topic   This topic is locked: you cannot edit posts or make replies.    DD-WRT Forum Index -> General Questions
Goto page Previous  1, 2, 3, 4 ... 10, 11, 12  Next
Author Message
tc23emp
DD-WRT Novice


Joined: 23 Aug 2010
Posts: 33

PostPosted: Wed Aug 25, 2010 22:24    Post subject: Reply with quote
Yea, I suppose there are a lot more advanced things you could do, especially with a server box.

Actually, for anyone trying to keep it simple and whose information being sent is not sensitive, you can get get a free mailbox that doesn't* require SSL (e.g. gmx.com). Set up gmail to do pop3 retrieval and you shouldn't ever have to login to the other account to keep it active. The address itself won't matter since you won't be corresponding with anyone and will just be sending yourself these notifications.


Last edited by tc23emp on Thu Aug 26, 2010 14:44; edited 1 time in total
Sponsor
Bib
DD-WRT Guru


Joined: 07 Jul 2008
Posts: 629
Location: France

PostPosted: Thu Aug 26, 2010 13:26    Post subject: Reply with quote
Very interesting post guys. I wonder if this script could be tuned to just run hourly from say 6AM to 11.59PM and send a mail stating the last hour ul/dl triggered if a ul/dl threshold is reached within this hour.
The top would be it wouldn't need external storage or another box for a mail server.

_________________
): FoReVeR nEwB Sad
Bib
DD-WRT Guru


Joined: 07 Jul 2008
Posts: 629
Location: France

PostPosted: Fri Aug 27, 2010 6:57    Post subject: Reply with quote
PS: instead of using the word "bandwidth" (whose unit is Mb/s) in this thread, we should rather use "traffic" (MB), isn't it?
_________________
): FoReVeR nEwB Sad
bitlocker
DD-WRT Novice


Joined: 27 Aug 2010
Posts: 7

PostPosted: Fri Aug 27, 2010 13:48    Post subject: Reply with quote
Slightly off topic, but based on the same principal of sending an e-mail notification-

Is there any way for a script to know when a new host associates with the wireless? I would like to combine scripts so that when someone successfully authenticates with my wireless AP, an e-mail is generated.

Additionally- It seems that the Micro version of DD-WRT does not support the "sendmail" command, can anyone verify?

EDIT: To avoid hijacking this thread I have created my own here: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=477983#477983


Last edited by bitlocker on Fri Aug 27, 2010 14:40; edited 1 time in total
tc23emp
DD-WRT Novice


Joined: 23 Aug 2010
Posts: 33

PostPosted: Fri Aug 27, 2010 13:59    Post subject: Reply with quote
@Bib, Explain the common usage of bandwidth cap, even if its name should be something else. Traffic usually implies you are looking at more than just bandwidth/bit usage, but it all depends, use whatever term suits you.

Regarding hourly reports, it sounds entirely possible, but like dellsweig said, more advanced reporting calls for the use of a server running netflow or similar to communicate with the built-in SNMP, rflow, or MACupd daemons.

If you want a simple script solution, the shell scripting needed is not much more complicated than what is already in the current example. External storage is not needed because the temporary filesystem persists as long as the router doesn't reboot. If it does, that hour of reporting will be lost unless you use nvram to store a little bit of additional data. Although, I don't know how safe it is to frequently write to flash or if nvram is automatically committed before a reboot. Also, most people should be able to find a mail server besides gmail that will support non-encrypted SMTP. It is only a special case where your own mail server is needed.
tc23emp
DD-WRT Novice


Joined: 23 Aug 2010
Posts: 33

PostPosted: Fri Aug 27, 2010 14:11    Post subject: Reply with quote
EDIT: See my wiki page for the latest script example.

Last edited by tc23emp on Wed Sep 01, 2010 15:02; edited 4 times in total
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Fri Aug 27, 2010 23:40    Post subject: Reply with quote
I'm not quite following. This would be used if someone also had some other script to schedule? Also, what do you mean about easier to edit?

BTW, I noticed that when you save traffic, the script is written out with it. That caught me by surprise. The Save button must look for "traff-" and save everything with it. Not much to be done about that, and it's easy to remember to edit it out before restoring.
tc23emp
DD-WRT Novice


Joined: 23 Aug 2010
Posts: 33

PostPosted: Fri Aug 27, 2010 23:57    Post subject: Reply with quote
It's just that the script is written out (in the web interface) where you can edit it in it's true form rather than being enclosed in the original echo/pipe statement. Making the custom script field re-usable was just a bonus.

What do you mean by save traffic? Maybe there is a way to avoid that.
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Sat Aug 28, 2010 0:08    Post subject: Reply with quote
I see now, great.

I meant the Save feature in Status/WAN, where you can save/restore your traffic. The code behind that must grab everything with "traff-" in it, which your script probably unavoidably must also invoke because it's interested in the same data. You can run this in telnet to see, or save traffic in Status/WAN:
nvram show | grep traff-
tc23emp
DD-WRT Novice


Joined: 23 Aug 2010
Posts: 33

PostPosted: Sat Aug 28, 2010 0:25    Post subject: Reply with quote
Added a workaround, see above.
jinjorge
DD-WRT User


Joined: 09 Nov 2009
Posts: 61

PostPosted: Sun Aug 29, 2010 23:18    Post subject: Reply with quote
@tc23emp Thanks for sharing this script and to all that helped along the way, this is awesome!!!

I'll report back on how things go.

J

_________________
WRT320N - 15230M NEWD-2 K2.6 Eko
RT-N16 - 15280M NEWD-2 K2.6 Eko - mega
bitlocker
DD-WRT Novice


Joined: 27 Aug 2010
Posts: 7

PostPosted: Tue Aug 31, 2010 17:40    Post subject: Reply with quote
I'm not receiving any e-mails either, verified the logon data multiple times. I'm trying to just run the command from a laptop running ubuntu to see if the server is returning any errors, but sendmail itself is saying "illegal option - - S". Captital "S" is the SMTP argument, so I don't see how that could be wrong.
tc23emp
DD-WRT Novice


Joined: 23 Aug 2010
Posts: 33

PostPosted: Tue Aug 31, 2010 17:58    Post subject: Reply with quote
The sendmail arguments are specific to the DD-WRT busybox version of sendmail. The rest should be generic.

On a side note, if you look at my wiki page, you will see I switched from using startup crontab to cron_jobs. The crontab file mysteriously reset on me without the router rebooting, so this other cron method may be more reliable.
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Wed Sep 01, 2010 6:23    Post subject: Reply with quote
What wiki? Can you post it here?

I'm using v1 on a router and received this report at the turn-of-the-month. Did you see anything similar?

Quote:
0:3 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:Totals for Yesterday
Incoming: 0 0 MB
Outgoing: 0 MB

Totals for Month to Date
Incoming: 0 MB
Outgoing: 3 MB
[0:3]


There was normal bandwidth on the 31st, not zero, and I'm not sure why it grabbed the entire string of empty data for the new month. Also, the bottom half appears to be listing the bandwidth totals for the new month, when it should be for August, right? I'm not sure why it has [0:3] at the bottom when there's normally nothing after the Outgoing line. Lots of fun things!
tc23emp
DD-WRT Novice


Joined: 23 Aug 2010
Posts: 33

PostPosted: Wed Sep 01, 2010 13:36    Post subject: Reply with quote
It was posted above: http://www.dd-wrt.com/wiki/index.php/User:Tc23emp

Actually, there is a bug in the script for end of the month, working on a fix now...

There is nothing wrong on your side.
Goto page Previous  1, 2, 3, 4 ... 10, 11, 12  Next Display posts from previous:    Page 3 of 12
Post new topic   This topic is locked: you cannot edit posts or make replies.    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum