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


Joined: 04 Aug 2014
Posts: 1

PostPosted: Fri Aug 08, 2014 3:30    Post subject: getting error after using easy setup Reply with quote
Using the easy setup gives me these errors. I am getting stats on /user/usage.html but nothing on MyPage.

Getting these errors using USB map like the instructions
/tmp/mnt/sda1


cat: can't open '/tmp/in_21652.tmp': No such file or directory
cat: can't open '/tmp/out_21652.tmp': No such file or directory
sh: 0: unknown operand
cat: can't open '/tmp/in_21911.tmp': No such file or directory
cat: can't open '/tmp/out_21911.tmp': No such file or directory
sh: 0: unknown operand
cat: can't open '/tmp/in_21911.tmp': No such file or directory
cat: can't open '/tmp/out_21911.tmp': No such file or directory
sh: 0: unknown operand
cat: can't open '/tmp/in_21911.tmp': No such file or directory
cat: can't open '/tmp/out_21911.tmp': No such file or directory
sh: 0: unknown operand
cat: can't open '/tmp/in_21911.tmp': No such file or directory
cat: can't open '/tmp/out_21911.tmp': No such file or directory
sh: 0: unknown operand
Sponsor
ronaldol
DD-WRT User


Joined: 28 Apr 2011
Posts: 60

PostPosted: Tue Aug 12, 2014 14:12    Post subject: usage.html empty Reply with quote
I'm getting the errors below and can't display any rate on the usage.html

The file usage.db are updated with the new values, but the usage.html are still empty.

BUFFALO WZR-300HP - factory DD-WRT
Firmware Version
DD-WRT v24SP2-MULTI (07/09/12) std - build 19438

Any help? Thanks...

=========< MESSAGES >==========

Examples :
/tmp/wrtbwmon setup
/tmp/wrtbwmon update /tmp/usage.db offpeak
/tmp/wrtbwmon publish /tmp/usage.db /www/user/usage.htm /jffs/users.txt
Note : [user_file] is an optional file to match users with their MAC address
Its format is : 00:MA:CA:DD:RE:SS,username , with one entry per line
cat: can't open '/tmp/in_6700.tmp': No such file or directory
cat: can't open '/tmp/out_6700.tmp': No such file or directory
sh: 0: unknown operand
DEBUG : New traffic for 00:1f:d0:f3:ed:4e since last update : 425k:15k
DEBUG : New traffic for e0:69:95:e8:ca:9d since last update : 2k:6k
DEBUG : New traffic for 00:27:0e:08:da:46 since last update : 0k:3k
cat: can't open '/tmp/in_6700.tmp': No such file or directory
cat: can't open '/tmp/out_6700.tmp': No such file or directory
sh: 0: unknown operand
DEBUG : New traffic for 00:1f:d0:f4:b5:c1 since last update : 0k:1k
/tmp/wrtbwmon: line 202: sort: not found
Usage : /tmp/wrtbwmon {setup|update|publish} [options...]
Options :
/tmp/wrtbwmon setup
/tmp/wrtbwmon update database_file [offpeak]
/tmp/wrtbwmon publish database_file path_of_html_report [user_file]
Examples :
/tmp/wrtbwmon setup
/tmp/wrtbwmon update /tmp/usage.db offpeak
/tmp/wrtbwmon publish /tmp/usage.db /www/user/usage.htm /jffs/users.txt
Note : [user_file] is an optional file to match users with their MAC address
Its format is : 00:MA:CA:DD:RE:SS,username , with one entry per line
LinoX
DD-WRT Novice


Joined: 20 Sep 2014
Posts: 7

PostPosted: Sat Sep 20, 2014 20:49    Post subject: I made a revised (and fixed) version of the script Reply with quote
it has proper bandwidth calculation and name resolution.
It's simpler and less error prone.

To use it add:
Code:

while :
do
sleep 10
/jffs/wrtbwmon setup
/jffs/wrtbwmon update
/jffs/wrtbwmon publish
done

to the startup commands.

The script can be invoked via SSH too (without errors) and defaults to /tmp if output files are not specified.
OLD DB is NOT compatible and must be deleted if you use my version of the script.

Bye.
bardamatic
DD-WRT Novice


Joined: 23 Aug 2014
Posts: 1

PostPosted: Fri Nov 07, 2014 7:53    Post subject: Reply with quote
LinoX,

Thanks for this new version. I am having a little trouble deploying it. Maybe I don't understand the instructions well.

On the first page of this post for deploying the original script it says:

Code:

sleep 10

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

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

# Backup usage database file
while :
do
sleep 900
cp /tmp/usage.db /mmc/usage.db
done
# If you want to run other codes below this line, use "done &" instead of just "done" on the line above


Are you saying to replace part of this with your code? Can you be specific about which part to replace?

To run your version should it look like this:
Code:

while :
do
sleep 10
/jffs/wrtbwmon setup
/jffs/wrtbwmon update
/jffs/wrtbwmon publish
done &

# Backup usage database file
while :
do
sleep 900
cp /tmp/usage.db /mmc/usage.db
done
# If you want to run other codes below this line, use "done &" instead of just "done" on the line above


My question is that your calls to wrtbwmon to update or publish don't reference any files. Should I put the same as from the first post, or is this built in to the script?

Thanks for clarification.
vortex05
DD-WRT User


Joined: 14 Mar 2014
Posts: 189

PostPosted: Fri Nov 28, 2014 19:41    Post subject: Re: I made a revised (and fixed) version of the script Reply with quote
LinoX wrote:
it has proper bandwidth calculation and name resolution.
It's simpler and less error prone.

To use it add:
Code:

while :
do
sleep 10
/jffs/wrtbwmon setup
/jffs/wrtbwmon update
/jffs/wrtbwmon publish
done

to the startup commands.

The script can be invoked via SSH too (without errors) and defaults to /tmp if output files are not specified.
OLD DB is NOT compatible and must be deleted if you use my version of the script.

Bye.


Is your new script compatable with the old script's commands? I might just build a new tar file and offer it up as a package like I did last time.

Although this time around I may just put things on github to make everyone's life easier.

Yeah I couldn't get the script to work it won't generate a usage.html file.... I'll have to debug it later.
timeshadowrider
DD-WRT Novice


Joined: 04 Dec 2014
Posts: 1

PostPosted: Thu Dec 04, 2014 9:05    Post subject: Firmware: DD-WRT v24SP2-MULTI (11/04/12) std Buffalo Reply with quote
vortex05 wrote:
Alright I'm going to help all the newbs out.

I've given you guys an installer!

How to use?
Step 1.
Extract the zip to the root directory (or anywhere you wish) onto either:

a USB flash formatted to ext2 (recommended)
a SD card formatted on the mmc partition
a CIFS mount usually found in /tmp/mnt/smbshare on the router

Step 2.
run the installer (in this example we are in the sda1 usb storage but you can run it from anywhere you do not have to be in the same path as the installer to run this

root@router/tmp/mnt/sda1/#sh ./installer.sh

Step 3.
depending on where you have it installed you want to point to it in the gui on startup of that device for example if you are using usb storage and it automounts to /tmp/mnt/sda1/ you should set the startup script to /tmp/mnt/sda1/startup.sh

Done

Notes: You can place this on jffs storage however because I did not disable the backup job to jffs this will cause wear on your flash and is not recommended.

install.sh sets the correct permissions for the package and setups your "my page" tab it does not matter where you are install.sh looks for where it is in the file system to get the correct paths

startup.sh is portable it also is able to determine it's script directory from the script's path.

You should not move bwmon or rename it this is dependent you must update startup.sh however startup.sh will still work as long as bwmon is in the same folder it is.

MAC-PCnames.txt is setup with an example to help you along with figuring this out. You should use a Unix compatable text editor like notepad++ that understand Unix style EOL otherwise this functionality won't work.

If I have a bug please let me know I will try and update the scripts if there is an issue.

The recommended options for install is to USB storage, SD Storage or network CIFS storage. Be sure to use the automatically run script on mount for a hassle free startup and point to startup.sh


I cant get this to install with:

root@router/tmp/mnt/sda1/#sh ./installer.sh

Help, Thanks!
vortex05
DD-WRT User


Joined: 14 Mar 2014
Posts: 189

PostPosted: Mon Dec 08, 2014 16:02    Post subject: Reply with quote
Are you getting any errors?

is /tmp/mnt/sda1 writeable from the FS perspective?

I may be wrong but your USB drive must be formatted in EXT* fs. At least that's how I run mine. NTFS may be fine the executable flags may not be markable on fat.
vortex05
DD-WRT User


Joined: 14 Mar 2014
Posts: 189

PostPosted: Mon Dec 08, 2014 17:27    Post subject: Reply with quote
Also I'm working on a different version of this bandwidth monitor that should be more efficient (in theory).

I've noticed that having this integrated into mypage actually causes DDWRT to execute the SH script to generate the page every time which is actually pretty heavy my alternative version offloads everything to the browser as much as possible and does a few more fancy things with html css and javascript as a result.

One issue at the moment I'm facing right now is for bandwidth rates I would like to have the router be able to give me the counters when a request is made rather than the current strategy of statically logging every 10 seconds.

I'm also looking into the divide logging step I don't know if doing a divide by 1000 to convert from bytes to KB every 10 seconds is necessary and it's probably more expensive than if that was just an add.

Anyways those that are interested in tracking development the fork is taking shape on github https://github.com/vortex-5/ddwrt-bwmon I'm getting around to writing the documentation the install.sh works as before except you will have to visit http://router_url/user/bwmon.html As a cautionary point I would say this isn't quite ready for in the wild yet so there maybe bugs. There are provisions made for mobile as well so it doesn't look all funny when you get it on your mobile (another reason for no longer integrating with mypage).

Oh and to start bandwidth monitoring this time you type startup.sh it will take care of cleaning up existing processes so if you execute startup multiple times it will clean up old processes and ensure you don't accidentally start bwmon multiple times.

I haven't tar'ed it up yet as I'm field testing it to check for stability. But if you're feeling adventurous I've put it up for everyone to see.
tsgill
DD-WRT Novice


Joined: 12 May 2015
Posts: 1

PostPosted: Thu May 21, 2015 17:56    Post subject: Reply with quote
vortex05 wrote:
Also I'm working on a different version of this bandwidth monitor that should be more efficient (in theory).

I've noticed that having this integrated into mypage actually causes DDWRT to execute the SH script to generate the page every time which is actually pretty heavy my alternative version offloads everything to the browser as much as possible and does a few more fancy things with html css and javascript as a result.

One issue at the moment I'm facing right now is for bandwidth rates I would like to have the router be able to give me the counters when a request is made rather than the current strategy of statically logging every 10 seconds.

I'm also looking into the divide logging step I don't know if doing a divide by 1000 to convert from bytes to KB every 10 seconds is necessary and it's probably more expensive than if that was just an add.

Anyways those that are interested in tracking development the fork is taking shape on github https://github.com/vortex-5/ddwrt-bwmon I'm getting around to writing the documentation the install.sh works as before except you will have to visit http://router_url/user/bwmon.html As a cautionary point I would say this isn't quite ready for in the wild yet so there maybe bugs. There are provisions made for mobile as well so it doesn't look all funny when you get it on your mobile (another reason for no longer integrating with mypage).

Oh and to start bandwidth monitoring this time you type startup.sh it will take care of cleaning up existing processes so if you execute startup multiple times it will clean up old processes and ensure you don't accidentally start bwmon multiple times.

I haven't tar'ed it up yet as I'm field testing it to check for stability. But if you're feeling adventurous I've put it up for everyone to see.


Hi Vortex05

i looked at your work. Looks awesome. Is it possible to run it from the router itself then using an USB stick?
euphoria360
DD-WRT Novice


Joined: 05 Aug 2014
Posts: 7

PostPosted: Wed Apr 27, 2016 7:21    Post subject: Reply with quote
Thus is a very nice script. wrtbwmon is very efficient and using it doesnt make any problems for router. I like tje modification of original script very much since watching speed usage is important too.

Unfortunately I have a problem using this script on my router:

I am using OpenWRT and i downloaded yyour script, but when i try to run it, I get "error nvram not found". since this script was modified for dd wrt maybe thats the reason.

I also downloaded and installed latest version provided by pyrovski according to this help:
https://wiki.openwrt.org/doc/howto/wrtbwmon
which works flawlessly, but the catch is it doesnt show speed (bitrate per second).

So here are my questions:
Is there anyway to use your script on openwrt 15.05.1 (chaos calmer)?

is there a way to add your speed functionality to pyrovski version?

if both are negative, are there any other solutions which give me bandwidth rate usage per ip(mac)?
saraara
DD-WRT Novice


Joined: 14 Aug 2016
Posts: 1

PostPosted: Sun Aug 14, 2016 19:01    Post subject: Reply with quote
can't download file
Goto page Previous  1, 2, 3 ... 10, 11, 12 Display posts from previous:    Page 12 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