Per-user Live Down/Upload Rate Monitoring [No PC needed!]

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Contributions Upload
Goto page Previous  1, 2, 3 ... 8, 9, 10, 11, 12  Next
Author Message
rizanuari
DD-WRT Novice


Joined: 17 Sep 2012
Posts: 1

PostPosted: Thu Nov 08, 2012 12:15    Post subject: Reply with quote
benawhite wrote:
MacMillan wrote:
What am I doing wrong ?


I had this same issue, and it was rooted in the missing "sort" function from atheros builds of dd-wrt.

I simply removed that as a dependency from the code, and told the browser to sort the data rather than the router.

I also added a totals line and some better styling.

I have attached the updated wrtbwmon file.
I will most likely be updating this file to add more features and better reporting in the future if there is any interest.

the .txt extension should be removed, but was required to attach file to this post


i've tried your file but when i ran it give error message:
/tmp/wrtbwmon: line 240: syntax error: unexpected end of file (expecting "done")

is there something's wrong with the code?

thx
Sponsor
madridista9
DD-WRT Novice


Joined: 14 Mar 2013
Posts: 4

PostPosted: Sat Jun 15, 2013 13:50    Post subject: will this work on e2000? Reply with quote
I have a linksys e2000 with dd wrt. will this work on it ? i am quite new to dd wrt so can get confused with all the terminology haha
nereik23
DD-WRT Novice


Joined: 29 Jun 2013
Posts: 3

PostPosted: Tue Jul 02, 2013 8:58    Post subject: Not obtaining client names from MAC_PCname.txt Reply with quote
So I have installed everything according to the instructions through the above posts. Everything is recording/ working GREAT! I would like to thank everyone involved for making this work/ and running smoothly. Took a little bit to wrap my head around it, but I eventually got there.
So I have only one concern now, that is the MAC address are showing correctly, but when I go to do the MAC_PCname.txt I am unable to get it working? I have installed the WRTBWMON and got all the data going to the USB stick but I'm not sure why its unable to pick up the MAC naming.

Im entering exactly like aa:bb:cc:dd:ee:ff,Person1 and it just doesn't seem to pick this name up. Is there anything that I missed on the config side of DD-WRT? I have DD-WRT currently installed on a Netgear WNDR4300. If there is anything suggestions to sorting this issue out it would be greatly appreciated!
Very Happy
nereik23
DD-WRT Novice


Joined: 29 Jun 2013
Posts: 3

PostPosted: Tue Jul 02, 2013 11:58    Post subject: Reply with quote
Well finally worked it out. All about the permissions of the USB stick. Quick tip, don't use telnet to do the copy and updates, use a FTP Client eg. Filezilla. All sorted, thank-you guys for this amazing software!!
John877
DD-WRT Novice


Joined: 22 Apr 2013
Posts: 21

PostPosted: Fri Jul 12, 2013 3:42    Post subject: Reply with quote
Ive done all this, so far so good. Only one issue. In spite of the users.txt file being in the right folder on the router in /jffs/ it isnt being used or something cause the table shows MAC Addresses still.
the users file is in the format:
<MAC ADDRESS>,<NAME>,
(one entry per line)

This is exactly what I have been wanting and when I saw the Netgear's crappy Traffic Meter options I knew this was my answer especially since I could never get that to even work. Thats another issue though. I'm here now on DD-WRT and love it.

This is my startup script btw
Code:

#!/bin/sh
sleep 10

 # Load database
 cp /jffs/usage.db /tmp/usage.db

 # Bandwidth Download/Upload Rate Counter
 while :
 do
 /jffs/wrtbwmon setup
 /jffs/wrtbwmon read
 sleep 9
 /jffs/wrtbwmon update /tmp/usage.db
 /jffs/wrtbwmon publish /tmp/usage.db /tmp/www/usage.html /jffs/users.txt
 done &

 # Backup usage database file
 while :
 do
 sleep 900
 cp /tmp/usage.db /jffs/usage.db
 done


Also I did have it in /tmp/ and set on the MyPage to show as well and since I moved it now when I try to change the path it seems to go ok but when I enter the "nvram commit" command (in the GUI) I get nvram locked..... error msg. If I do it in Putty I dont see a difference and it doesnt seem to work. Also tried "erase nvram" before trying to change the path and same result.
spanman
DD-WRT User


Joined: 27 Sep 2008
Posts: 446
Location: Port Of Spain

PostPosted: Fri Jul 12, 2013 11:55    Post subject: Reply with quote
You should gear away from copying the usage.db file to jffs every 900 seconds becasue that will cause wear and tear on your flash see here http://www.dd-wrt.com/wiki/index.php/Jffs

In addition your users.txt file is in the wrong format, there should't be a comma after name. It should be
mac,name
00:00:00:00:00:00,J-PC
00:00:00:00:00:01,N-PC



Also you will notice changes were made to startup script for mypage the usage.html is no longer published as /tmp/www/usage.html but as /tmp/usage.html http://www.dd-wrt.com/phpBB2/viewtopic.php?p=468131#468131

_________________
Buffalo WZR-600DHP - 23838
TP Link WDR3600 - 21676
Linksys WRT54G-TM - 12548 (NEWD Eko Mega)


Last edited by spanman on Fri Jul 12, 2013 18:42; edited 1 time in total
John877
DD-WRT Novice


Joined: 22 Apr 2013
Posts: 21

PostPosted: Fri Jul 12, 2013 17:21    Post subject: Reply with quote
Thanks for that, small oversight regarding the MyPage html file, woops

I have since changed the backups to 12 hours instead so hopefully that is less of a strain.

Ive also changed the users.txt file format and some are working but some arent. Its odd.
spanman
DD-WRT User


Joined: 27 Sep 2008
Posts: 446
Location: Port Of Spain

PostPosted: Fri Jul 12, 2013 18:41    Post subject: Reply with quote
I still suggest you avoid writing to jffs and use your ftp server instead. That way you can backup more frequently and there is no wear and tear on flash.

Just my thought.

I don't know why some users are showing and why some aren't. Maybe and End of Line (EOL) issue in the users.txt file I don't know.

_________________
Buffalo WZR-600DHP - 23838
TP Link WDR3600 - 21676
Linksys WRT54G-TM - 12548 (NEWD Eko Mega)
John877
DD-WRT Novice


Joined: 22 Apr 2013
Posts: 21

PostPosted: Fri Jul 12, 2013 18:55    Post subject: Reply with quote
Now after some tinkering and stuff after I had it partially working, now the www usage file isnt updating, the mypage one shows mac addresses again or those odd numbers instead and also doesnt seem to update now.

I had an idea after it got all messed up maybe the reason some were still showing MAC addresses instead is cause they werent active machines at the time on the network. wish i had thought of that before more tinkering lol

whats the EOL issue you mention ?
spanman
DD-WRT User


Joined: 27 Sep 2008
Posts: 446
Location: Port Of Spain

PostPosted: Fri Jul 12, 2013 19:17    Post subject: Reply with quote
Forget about EOL, I don't think that relevant for the users.txt file.
_________________
Buffalo WZR-600DHP - 23838
TP Link WDR3600 - 21676
Linksys WRT54G-TM - 12548 (NEWD Eko Mega)
John877
DD-WRT Novice


Joined: 22 Apr 2013
Posts: 21

PostPosted: Sun Jul 14, 2013 19:29    Post subject: Reply with quote
Seemed to have gotten it working now.

Cleared everything back out, undid the MyPage tab and everything, didnt need it anyway. Removed the startup script and files and restarted the router. Went back in and added just the wrtbwmon file and startup script. Restarted again, the usage.html file didnt generate, so I ran the commands in putty, then the html file generated. made the users/txt file all lowercase as was mentioned to me some routers wont see capitals. waited a while and restarted the router again to verify everything worked as it should.

Magically everything is working now so it seems.

A couple MAC addresses arent resolving to the names though but the rest are. Im just wondering if maybe the device has to be actually active or something for it to get picked up again or if maybe theres a character limit on the names and it ignores the name if it exceeds it. I dunno.

I am kinda wondering now though if theres a way to sort the table of names so that say PersonA is before PersonB instead of vice versa for example.
CM000n
DD-WRT Novice


Joined: 18 Jul 2013
Posts: 46
Location: DE, Karlsruhe

PostPosted: Tue Jul 30, 2013 11:17    Post subject: Reply with quote
spanman wrote:
I still suggest you avoid writing to jffs and use your ftp server instead. That way you can backup more frequently and there is no wear and tear on flash.[...]


What do you mean with ftp server?
Because I'm very interested in this script but using a D-Link DIR-615 RevD (build 22118) which seems to has no opportunity for using jffs, a sdcard or an external usb-drive.

Would it be possible to store the required script files on the ftp-server of my webhoster and access them via web?

.::edit::.

Found the post of fatusik on page 5 of this tread. Now I use the same startup script as he. But it soesn'nt seem to work for me Sad

My startup code now look like this:

sleep 10
wget ftp://xyz.de/dir-615/wrtbwmon -O /tmp/wrtbwmon && chmod +x /tmp/wrtbwmon
wget ftp://xyz.de/dir-615/usage.sh -O /tmp/usage.sh && chmod +x /tmp/usage.sh
wget ftp://xyz.de/dir-615/usage.db -O /tmp/usage.db

while :
do
/tmp/wrtbwmon setup
/tmp/wrtbwmon read
sleep 9
/tmp/wrtbwmon update /tmp/usage.db
/tmp/wrtbwmon publish /tmp/usage.db /tmp/www/usage.html /ftp://xyz.de/dir-615/users.txt
done &

while :
do
sleep 900
cd /tmp/ && ftpput -u USERNAME -p PASSWORD xyz.de/dir-615/usage.db usage.db
done



But every time when i go to the usage page under http://MYROUTER-IP/user/usage.html i just get a blank page Sad

Is the problem maybe that I have to insert a password to get access to my webhoster ftp server? Because I can't create a anonymous ftp User. But where (in the wget command?) and how do I have to insert the ftp username and password?

.::edit2::.

Ok, solved the Problem with the username/password, by insert them into the ftp link.

But I still got only a blank page Crying or Very sad
Tried it in the meantime also with my WNR2000. But I get the same result there..blank page
ijamjl
DD-WRT Novice


Joined: 15 Aug 2013
Posts: 8

PostPosted: Thu Aug 22, 2013 23:11    Post subject: Reply with quote
Okay, so I figured out for the most part how to get this thing working. However, I still have one issue and one question:

1. Although I already manually created the MAC-PCname.txt file, the page is still displaying MAC addresses. I'm not sure how I can make it display the host name instead.

2. My script is:
Code:
sleep 10

# Load database
cp /mnt/usage.db /tmp/usage.db

# Bandwidth Download/Upload Rate Counter
while :
do
/mnt/sda1/wrtbwmon setup
/mnt/sda1/wrtbwmon read
sleep 9
/mnt/sda1/wrtbwmon update /tmp/usage.db
/mnt/sda1/wrtbwmon publish /tmp/usage.db /tmp/usage.html /mnt/sda1/MAC-PCname.txt
done &

# Backup usage database file
while :
do
sleep 900
cp /tmp/usage.db /mnt/usage.db
done


Would I be able to change the sleep 10 to sleep 3, so that it refreshes every 3 seconds? Can changing it to 3 seconds potentially harm anything? I was reading that writing too much would wear out the memory, but I'm not sure if my set up is jffs (I think that's the one that should be avoided for overwriting). Also, I'm using a 4GB USB, in case if it wasn't clear.


Last edited by ijamjl on Sun Aug 25, 2013 5:46; edited 1 time in total
ijamjl
DD-WRT Novice


Joined: 15 Aug 2013
Posts: 8

PostPosted: Sun Aug 25, 2013 4:30    Post subject: Reply with quote
Sorry for bump but would appreciate help. Edited above post, now that I have a better idea of how to use this thing.
John877
DD-WRT Novice


Joined: 22 Apr 2013
Posts: 21

PostPosted: Wed Aug 28, 2013 12:51    Post subject: Reply with quote
ijamjl wrote:
Sorry for bump but would appreciate help. Edited above post, now that I have a better idea of how to use this thing.


I am by no means an expert myself as I am still fairly new to this but I have gotten this working.

1. Try naming it users.txt. thats what ive done and it works. dont know if theres something with maybe using the - in the filename or not. also make sure the users.txt file is in same folder as wrtbwmon.
2. as for changing sleep 9 to sleep 3 that wont make the page refresh in 3 seconds as opposed to 9, that is a delay between those commands in the script. from my understanding you dont want that to be too quick either or it wont work cause the reading might not have been fully done yet for it to write to the db file.

as for your last comment about the excessive writing, that is true as it will wear out the flash memory that is built into the router. i have mine set to back up every 2 hours, some might say that that is a bit too frequent but meh its better than the original like 15 seconds of Kodis script Very Happy
In order to have the page refresh faster, look in wrtbwmon file and scroll down to where it says Create HTML Page and look close to the end of it where it has the refresh code. theres somewhere it says var seconds=11 id imagine change that to 3-4 and it should refresh faster. I havent tried it so if it doesnt work then just change it back.

Also for reference this is the startup script I am using.
Code:

#!/bin/sh
sleep 10

# Load database
cp /jffs/usage.db /tmp/usage.db

# Bandwidth Download/Upload Rate Counter
while :
do
/jffs/wrtbwmon setup
/jffs/wrtbwmon read
sleep 10
/jffs/wrtbwmon update /tmp/usage.db
/jffs/wrtbwmon publish /tmp/usage.db /tmp/www/usage.html /jffs/users.txt
done &

# Backup usage database file every 2 hours
while :
do
sleep 7200
cp /tmp/usage.db /jffs/usage.db
done


Also check this post........
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=494846#494846


Last edited by John877 on Wed Aug 28, 2013 13:14; edited 1 time in total
Goto page Previous  1, 2, 3 ... 8, 9, 10, 11, 12  Next Display posts from previous:    Page 9 of 12
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Contributions Upload 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 cannot attach files in this forum
You cannot download files in this forum