had this working on a Dlink 835 which is Atheros but it never servives a reboot. Damn, wish i bought a Bcm cause bandwidth managment is a neccesity with teenagers nowadays. Plus Telus is invoking restrictions as of Feb. 1. Gonna be an interesting month here in Canada
How long does it take for the stats to initially show up once this is complete? I have successfully added the page to my router, but Clients, Active Protocols, and Active Connections only ever say CALCULATING ...
I have enabled QOS for both WAN and LAN and set the uplink and downlink limits.
Port error: Could not establish connection. Receiving end does not exist. miscellaneous_bindings:236
chromeHidden.Port.dispatchOnDisconnect miscellaneous_bindings:236
Uncaught ReferenceError: ASSURED is not defined
(anonymous function)
(anonymous function) qos_conntrack.js:377
request.onreadystatechange common.js:836
Joined: 26 Sep 2007 Posts: 67 Location: Fresno, CA
Posted: Sun Apr 28, 2013 3:10 Post subject:
There's a little bug in traffic_monitor.sh with the latest DD-WRT version. My router's information:
Router Model: Buffalo WZR-HP-AG300H
Firmware Version: DD-WRT v24-sp2 (04/15/13) std - build 21286
Kernel Version: Linux 3.8.7 #224 Mon Apr 15 04:19:40 CEST 2013 mips
Symptom: only the addresses that end in a last-byte beginning in the last-byte of the router IP will be counted. For example, if the router is 192.168.5.1 (as is mine), only addresses 192.168.5.1, 192.168.5.10-19, and 192.168.5.100-199 will be monitored. The rest will not be visible in the MyPage listing.
Cause: A syntax error in the "awk" command in line 4 of traffic_monitor.sh causes it to recognize and store a bad subnet prefix. In the script, mine was stored as, quote, "192.168.5.1." (with a dot at the end). I didn't understand "awk" going into this debugging, but I did a "man" and figured out that "BEGIN" and "END" are needed to initialize the capture (of "nvram get") then process the output at the end - not all at once.
Reformat the awk with beginning and ending brackets:
Code:
LAN_TYPE=$(nvram get lan_ipaddr | awk 'BEGIN { FS = "."; } END { print $1"."$2 }')
Then all addresses are shown.
I was trying to track down a bandwidth hog on my home network, and when I updated the firmware to the latest revision, RFlow was gone - which I just set-up! So I Googled around a bit and found it was removed due to bugs, and I was left without a solution. This page came up but does not provide a download link in the post without being logged-in to this forum! There is literally no attachment visible (or screenshot) on the original post without logging in. Then everything is visible Google users are hence screwed. I think it would be helpful if you could post it somewhere like Dropbox, or post a bold message that we have to log in/register to download the script.
Thanks for this awesome tool! It's definitely the cleanest interface I could imagine for what I want to do with it! _________________
Then the list will show all DNS names for current leases - much easier to track down computer names!
Also, if I could completely disable the listing of active connections by default, I would. It's giving me a JavaScript error (unknown function "ASSURED") which seems to be related to mis-interpreting the "traffic.asp" fields. Not a JavaScript/object-oriented geek, so I couldn't follow all the parameters around to debug that... I just disabled the update in the code by commenting it out on the router side... _________________
Joined: 26 Sep 2007 Posts: 67 Location: Fresno, CA
Posted: Sun Apr 28, 2013 9:05 Post subject:
And a little further, repairing the connection-table parsing and making it "self-aware" of changes to the ip_conntrack syntax.
This is a big one. It replaces the block of "if conntrack = 19 / else" completely, and is a complete rewrite of the code used to generate the ip_conntrack entry in traffic.asp.
Here's the code (with a few original lines above and below):
Code:
#awk 'BEGIN { printf "{hosts::"} { printf "'\''%s'\'','\''%s'\'',",$1,$2; } END { print "'\''<% show_wanipinfo(); %>'\''}"}' /tmp/hosts >> /tmp/traffic.dat
cp /proc/net/ip_conntrack /tmp/ipconntrack
awk 'BEGIN {
printf "{ip_conntrack::";
}
{
src=""; dst=""; sport=""; dport="";
for ( x = 2; x <= NF; x++ ) {
split($x,pairs,"=");
if (pairs[1] == "src") if (src=="") src=pairs[2];
if (pairs[1] == "dst") if (dst=="") dst=pairs[2];
if (pairs[1] == "sport") if (sport=="") sport=pairs[2];
if (pairs[1] == "dport") if (dport=="") dport=pairs[2];
if (pairs[1] == "bytes") bytes=pairs[2];
}
printf "'\''%s'\'','\''%s'\'','\''%s'\'','\''%s'\'','\''%s'\'',bytes=%s,",$1,src,sport,dst,dport,bytes;
}
END {
print "'\''-'\''}"
}' /tmp/ipconntrack >> /tmp/traffic.dat
iptables -L RRDIPT -vnx -t filter | grep ${LAN_TYPE} | awk 'BEGIN { printf "{bw_table::" } { if (NR % 2 == 1) printf "'\''%s'\'','\''%s'\'',",$8,$2; else printf "'\''%s'\'',",$2;}' >> /tmp/traffic.dat
It:
- First makes a temp copy of the ip_conntrack file. Doing awk from a proc file is really sketchy since the "proc" file may change while it's being processed, and screw everything up.
- Uses a for loop to process the parameters *ANYWHERE* they happen to be in the line. The for loop is the first implementation I've seen yet of a "dynamic" field addressing scheme (i.e. "$x" to scan/process each field), so that was fun.
- Uses awk variables to "construct" each connection parameter
- Is intelligent enough to realize that ip_conntrack seems to have multiple "src=" and "dst=" parameters for each connection entry, which defies all laws of programming... weird.
- Builds each connection entry in the traffic.asp file with a fixed set of parameters, so JavaScript parsing errors are all but impossible.
@Falcon4
Does this script need 'warming up' before displaying any data or really real time ?, mine always shows Calculating while i have checked in top, the script already running, . Would you mind posting your modified files?.
The error i've got is "Uncaught ReferenceError: ASSURED is not defined : MyPage.Asp:1" (chrome), from firefox "ReferenceError: ASSURED is not defined @ http://192.168.1.1/user/qos_conntrack.js:377" referring to this line " eval('setCONTable(' + u.ip_conntrack + ')'); ".
below is the edited files based on your advices and others. Would you mind posting your modified files?
Joined: 26 Sep 2007 Posts: 67 Location: Fresno, CA
Posted: Fri Jun 28, 2013 5:35 Post subject:
Mine stopped working too - I made some more adjustments then eventually gave up on this script when the router became unstable each day. Running a process in the background for monitoring this information, and creating iptables rules for each connection is an absolutely absurd way to monitor traffic. I just went back to hoping something better will come along soon and turned off the custom page completely... /sigh
Also, the ASSURED error is due to mis-interpreting the fields of the utility output it's using to get its information. In my patched code, there's a more intelligent method of detecting this information, but it's been a while since I looked at it, and I'd suspect your code isn't patched properly to use that new interpreter for it. "ASSURED" is a value in a column right next to the one it's supposed to be reading - so it grabs that value instead of the correct value (which I think is the number of bytes transmitted). _________________
Howdy Guys. I'd like to try this out on my dd-wrt router.
I have a Linksys WRT54G-TM that is running v24-sp2 (07/22/09) mega.
I started down the install but got stuck right quick at the UNZIP command. My firmware does not have the unzip command.
Any suggestions how I get around that? I saw where someone used something move the files across after unzipping them on his windows box.
I have windows, mac os, an FTP site at my ISP, etc at my disposal.
Also, is this software: QoS IP Connection Tracking / Bandwidth Monitor still valid and active or are others using other things? I am mainly interested in tracking bandwidth up/down from my ISP/WAN and seeing which devices on my network are responsible for how much each month.
Any suggestions how I get around that? I saw where someone used something move the files across after unzipping them on his windows box.
I have windows, mac os, an FTP site at my ISP, etc at my disposal.
If you don't want to use opkg to install unzip, then you could enable ssh and use scp to transfer the extracted files over. For instance, WinSCP is a nice GUI implementation of the protocol.
Although I suggest that you use the first method, as you want to have usb storage to make the script permanent and it really only takes a few more commands to install unzip from there.
Note: The above will still work as I wanted to make sure the original poster's instructions was backwards compatible it will default to 1 in this situation. So you don't have to update your startup script if you don't want to.
Note this is a modification to version 13c I skipped version 13d because there were some severe bugs in that one.
Rather than get everyone to modify there traffic_monitor.sh I have uploaded mine as version 0.13e for evaluation.
Summary the refresh interval of the traffic monitor now obeys the global refresh interval set for the UI of the router under admin auto-refresh interval.
Joined: 07 Dec 2010 Posts: 131 Location: Sheffield, UK
Posted: Sat Aug 09, 2014 18:59 Post subject:
Sorry about that, I migrated my whole site over to SSL forgetting all about this.
It should download okay now although bear in mind I cannot provide any support setting it up as I do not use DD-WRT any more.
I have also added the modified 13e from above so that its easier to install if someone wants to use that version instead. That of course would be http://csdprojects.co.uk/DD-WRT/qos_conntrack_0.13e.zip _________________ 2xWZR-HP-G300NH(B) (B0 B0) DD-WRT v24-sp2 (06/14/11) std 17201
One antenna swapped for an RP-SMA connector and 14dB external Yagi.
http://csdprojects.co.uk/ddwrt/