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 ... 9, 10, 11, 12  Next
Author Message
Antman1
DD-WRT Novice


Joined: 29 May 2009
Posts: 17

PostPosted: Wed Jul 11, 2012 19:13    Post subject: Reply with quote
yeah I'm on comcast. I got it. I for got to add the command to cron after I loaded the new firmware. Thank you so much for all your help.
Sponsor
Antman1
DD-WRT Novice


Joined: 29 May 2009
Posts: 17

PostPosted: Wed Jul 11, 2012 19:42    Post subject: Reply with quote
Well after I added the lines:
Code:
5 0 * * * root /tmp/custom.sh bwmail
*/5 * * * * root /tmp/custom.sh wlclient


to cron it sent me an email saying:
Code:
Totals for Yesterday
Incoming: 0 MB
Outgoing: 0 MB

Totals for Month to Date
Incoming: 2 MB
Outgoing: 0 MB

but I tried the command to send a test and it never does. Will the script automatically send me an email each day of the prev day usage? Also I put the script in the "Save Startup" area.
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Wed Jul 11, 2012 19:55    Post subject: Reply with quote
Yes. Note that you just flashed the router, so there is no previous day's usage. Nvram was wiped.

You only need the first cron line. The second one is only for another part (wlclient) of the original script that you may not have even implemented (it's a separate function), though if you did, leave it in, but it's not really part of this thread.

You want to save the script in the custom script section.

If you ever want to test from telnet, this will work:
sh -x custom.sh bwmail
jimford
DD-WRT User


Joined: 20 May 2012
Posts: 71

PostPosted: Sat Jul 14, 2012 19:14    Post subject: Reply with quote
Antman1 wrote:
ok sendmail doesn't give me that error now. but I tried "sendmail -S"smtp.comcast.net" -f"sender@comcast.net" -F"DD-WRT" -d"comcast.net" -s"Bandwidth Report" -m"test" me@gmail.com" and it did not send me an email. I put my comcast email in the sender email and my email in the me@gmail.com spot.


I'm getting much the same thing, but in addition the -F and -s flags are getting an illegal flag error. I'm also trying the command on the terminal command line in the hope that I can get errors shown. My sendmail is the one in busybox, which doesn't appear to support the -F and -s flags. Are there any other versions of sendmail supplied with DD-WRT?

I'm using DD-WRT v24-sp2 (06/08/12) mini - build 19342 on a Buffalo WHR-HP-G54

I'd really like to get this working!

Jim
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Sat Jul 14, 2012 19:22    Post subject: Reply with quote
Yes, that's because you're using a modern version of BusyBox in that version, and sendmail was fundamentally changed. You have to go back a few pages in the thread for that discussion. Don't worry, someone figured it out and came up with a very nice script.
jimford
DD-WRT User


Joined: 20 May 2012
Posts: 71

PostPosted: Mon Jul 16, 2012 19:15    Post subject: Reply with quote
rseiler wrote:
Yes, that's because you're using a modern version of BusyBox in that version, and sendmail was fundamentally changed. You have to go back a few pages in the thread for that discussion. Don't worry, someone figured it out and came up with a very nice script.


Yes - found it, and changed the sendmail command to reflect my set-up. I changed it to:

cat /tmp/bwmsg.txt | sendmail -S $my_smtp -f $my_mail_addr > $logfile 2>&1

and it was enough.

I initially tried to run the script in the web interface command window, but it didn't work. The bwmsg.txt file was created, but nothing was emailed. I then copied the file to /tmp and ran it from there in a terminal window using telnet. It worked fine. I've now moved the script to a small jffs directory so it will survive a router reboot.

Thanks for the help!

Jim
jimford
DD-WRT User


Joined: 20 May 2012
Posts: 71

PostPosted: Wed Jul 18, 2012 11:43    Post subject: Reply with quote
The emails I get start with the message:

"" is connected to "dd-wrt - - 00:0D:0B:97:6A:E9" at this time.

What should be within the starting double quotes? The variable in the script states wl0.1_ssid, but there's never any value for this on my DD-WRT installation. What sort of connection is wl0.1_ssid referring to?

Jim
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Wed Jul 18, 2012 16:07    Post subject: Reply with quote
I don't use that part of the script, so I never tried to figure it out, but based on the context I'm guessing that it's trying to show the host name (machine name) of the connected wireless user. Unfortunately, in DD-WRT, that's often just an asterisk.
Lights_On
DD-WRT User


Joined: 21 Jul 2012
Posts: 53

PostPosted: Sat Jul 21, 2012 23:31    Post subject: macignore Reply with quote
Hi All,

great script many thnaks.

having trouble getting macignore="mac_address" to work - should it be "mac_address mac_address mac_address" or "mac_address" "mac_address" "mac_address"

many thnaks.
techo91
DD-WRT Novice


Joined: 30 Dec 2008
Posts: 8

PostPosted: Sat Jul 28, 2012 13:12    Post subject: Reply with quote
Great script I've got it working. What if I want to add the current wan info into the mail? Things i can get from nvram:

wl0_ssid
wan_get_dns
wan_gateway
wan_dns
wan_ipaddr

How to properly add them to the script so they appear in the email?
thhv
DD-WRT Novice


Joined: 05 Sep 2011
Posts: 4

PostPosted: Mon Oct 22, 2012 10:39    Post subject: Reply with quote
Hi
I have this Router:
Router Model TP-Link TL-WR1043ND
Firmware Version DD-WRT v24-sp2 (08/07/10) std - build 14896
BusyBox v1.13.4 (2010-08-07 06:53:22 CEST) built-in shell (ash)

The wl command is not present:
ash: wl: not found
(In line 46 of the script)
Code:
Line 46: maclist=$(wl -i $(nvram get wl0_ifname) assoclist | cut -d" " -f2


Does anyone no the equivalent command for this firmware?
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Mon Oct 22, 2012 16:47    Post subject: Reply with quote
That's really strange, since it definitely should be there in a std version from 2010 (I'm looking at one a little older right now, and it's there). If you open telnet, login, and type wl, it doesn't show wl's usage?

BTW, you probably know this, but that section of the script is not necessary to get a bandwidth report from the router, so if that's all you're looking to do, you're OK.
thhv
DD-WRT Novice


Joined: 05 Sep 2011
Posts: 4

PostPosted: Mon Oct 22, 2012 20:40    Post subject: Reply with quote
Hi
I found some kind of answer in this topic:
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=464858

The equivalent wl command for Atheros-based routers is wl_atheros

I replaced the command in the script and the output email was generated:

Unknown at 00:15:B3:08:C9:0B
pc1.private.lan (192.168.1.197) at 00:23:24:11:C8:D8 [ether] on br0

I guess it looks okay?
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Mon Oct 22, 2012 20:44    Post subject: Reply with quote
Ah, Atheros, I wouldn't have thought of that. It's definitely in Broadcom-based ones of the same vintage.

Looks like you got it working.
rseiler
DD-WRT Guru


Joined: 01 Oct 2007
Posts: 622

PostPosted: Sun Dec 02, 2012 8:22    Post subject: Reply with quote
Has anyone else who's using Comcast's SMTP been getting this sort of thing tacked onto the end of mails over the last week or two? It's this:
http://en.wikipedia.org/wiki/DomainKeys_Identified_Mail

But I don't know if there's anything to be done about it.

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
s=q20121106; t=1354435505;
bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=;
h=Received:Received:From:Subject:To;
b=PG1g03k+kw+Q+q0MZISA22H4EYT5KSpeXJ4GZEG5H/wYECQYRW+pUkxCTPzhVB1Mb
EJ/FtDrpwxe1FoQ4hjvaq89mp+2v6Avb9ieRL7TrMbAC7igzfGBgWvtWskelQo8fxX
nIwQEjHlg4pofQCqKtJDeXnHvRqrs1a5+dNm1HHYeYB5JVf2oZsAtufW7HT4wZ2h1n
/2Zzg7q0wreyF5/sYZXWZcfrrzgnf85BMl+tZTdal
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12  Next Display posts from previous:    Page 10 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