dd-wrt - Bandwidth Usage Monitor

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3, ... 40, 41, 42  Next
Author Message
yzy-oui-fi
DD-WRT Guru


Joined: 03 Mar 2009
Posts: 2826
Location: France

PostPosted: Thu Oct 28, 2010 16:21    Post subject: Reply with quote
do a "chmod +X" on this file.
_________________
DD-WRT WDS MESH + DASHBOARD (fr), DD-WRT network setting tool (tools.yzy-oui-fi.com), Wifi Business and IT guy After hours, My Blog, Free DD-WRT VPN Community(www.wrt-pptp-ww.com), DD-WRT pré-réglés pour réseau outdoor(hotspot.yzy-oui-fi.com), Nouveau Forum DD-WRT francophone
Sponsor
bpsmicro
DD-WRT User


Joined: 07 Oct 2010
Posts: 159

PostPosted: Thu Oct 28, 2010 16:26    Post subject: Reply with quote
On bw_monitor.sh? That didn't help. If I do an "ls -l" the attributes for that file are "-rwxrwxrwx". What does the "+X" do?
yzy-oui-fi
DD-WRT Guru


Joined: 03 Mar 2009
Posts: 2826
Location: France

PostPosted: Thu Oct 28, 2010 16:44    Post subject: Reply with quote
this turn the file executable
_________________
DD-WRT WDS MESH + DASHBOARD (fr), DD-WRT network setting tool (tools.yzy-oui-fi.com), Wifi Business and IT guy After hours, My Blog, Free DD-WRT VPN Community(www.wrt-pptp-ww.com), DD-WRT pré-réglés pour réseau outdoor(hotspot.yzy-oui-fi.com), Nouveau Forum DD-WRT francophone
bpsmicro
DD-WRT User


Joined: 07 Oct 2010
Posts: 159

PostPosted: Thu Oct 28, 2010 16:49    Post subject: Reply with quote
That's what I thought. So it *is* executable according to the attributes. But having made that mistake more than once before, it's still a valid thing to check first. :-)

I'm beginning to wonder if the Buffalo-specific dd-wrt is coming into play. On my router the '/bin/sh' command is linked to 'busybox'. Is that normal for dd-wrt?

Brad.
yzy-oui-fi
DD-WRT Guru


Joined: 03 Mar 2009
Posts: 2826
Location: France

PostPosted: Thu Oct 28, 2010 16:49    Post subject: Reply with quote
oops, i didn't noticed that you found a syntax error in the code. forget the chmod.

this error means there is probablty a bracket mistake in the code

_________________
DD-WRT WDS MESH + DASHBOARD (fr), DD-WRT network setting tool (tools.yzy-oui-fi.com), Wifi Business and IT guy After hours, My Blog, Free DD-WRT VPN Community(www.wrt-pptp-ww.com), DD-WRT pré-réglés pour réseau outdoor(hotspot.yzy-oui-fi.com), Nouveau Forum DD-WRT francophone
bpsmicro
DD-WRT User


Joined: 07 Oct 2010
Posts: 159

PostPosted: Thu Oct 28, 2010 20:00    Post subject: Reply with quote
Here's what I think, and a shell expert may have some thoughts...

The script has a bunch of variables at the top, followed by a series of methods, followed by the "main" code at the bottom.

It almost looks as though the Buffalo edition of sh is choking when it sees the first method. Or, more accurately, the opening brace of the method. It doesn't seem to understand what that is, and then chokes.

I don't know enough about shell scripts to know if this is a likely scenario, or even how I might prove/disprove the theory. I've been doing some Googling, but no obvious alternatives yet.

Brad.
yzy-oui-fi
DD-WRT Guru


Joined: 03 Mar 2009
Posts: 2826
Location: France

PostPosted: Thu Oct 28, 2010 20:09    Post subject: Reply with quote
I guess the best is to wait for FezJay reply(he designed the script), because i actualy do not have time to look at this bash script for debugging.
_________________
DD-WRT WDS MESH + DASHBOARD (fr), DD-WRT network setting tool (tools.yzy-oui-fi.com), Wifi Business and IT guy After hours, My Blog, Free DD-WRT VPN Community(www.wrt-pptp-ww.com), DD-WRT pré-réglés pour réseau outdoor(hotspot.yzy-oui-fi.com), Nouveau Forum DD-WRT francophone
bpsmicro
DD-WRT User


Joined: 07 Oct 2010
Posts: 159

PostPosted: Thu Oct 28, 2010 21:15    Post subject: Reply with quote
Progress! I started messing with a test script, copying over bits of bw_monitor to see if I could spot the problem.
In the end, if I made a new, empty file and copied/pasted the entire contents of my bw_monitor, then copied that to the router, it magically started to work.
It seems that the downloaded copy was somehow "damaged" in a way that wasn't obvious when staring at it in gedit.

It's still not fully functional. I can see mac_usage.db being updated, and the /tmp/www folder now contains the html file and the user_details.js file, and I can see *it* being updated too. But looking at monitor.html in the browser it still contains no actual data.
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Fri Oct 29, 2010 4:49    Post subject: Reply with quote
bpsmicro wrote:
Progress! I started messing with a test script, copying over bits of bw_monitor to see if I could spot the problem.
In the end, if I made a new, empty file and copied/pasted the entire contents of my bw_monitor, then copied that to the router, it magically started to work.
It seems that the downloaded copy was somehow "damaged" in a way that wasn't obvious when staring at it in gedit.

It's still not fully functional. I can see mac_usage.db being updated, and the /tmp/www folder now contains the html file and the user_details.js file, and I can see *it* being updated too. But looking at monitor.html in the browser it still contains no actual data.


Interesting

I run each one before I check any code in.

I develop the script outside the router in notepad++ and copy and paste the code over into a new file (using the vim editor).

I then run chmod +x on it and then sh -n to check for syntax errors. It would seem manually copying over the contents into a new file is getting rid of any unsupported characters (introduced by notepad++), opposed to downloading the file and using it straight out of subversion (which must contain hidden invalid characters).

I found the issue, I am using windows character encoding s for line ends. I have since changed this to UNIX.

Looks like I will need to use a different type of encoding via notepad ++.

The html browser is looking for the JS file by this http://192.168.1.1/user/user_details.js. You will have to update this in the HTML if this is not correct for you.

Thats probably a feature I should add, allow a user to set this path via script arguments. I think I will Smile.

The current code is 0.8 and has some fixes in there as well. (also updated ALL files for unix Wink).

This is great, as I said im SH newbie as well and all my development experience is .NET and Windows Based.

This feedback is in-valuable to me as I just dont know what can go wrong, hence why I want people to get it down and use it.

I want people to list issues or question about missing information. I want this to be an easy 2-3 step process and then your away laughing.

At the moment, I have 2 people testing this who are at 2 ends of the linux experience level spectrum.

This is exactly what I need. Ill use all these issues and create a comprehensive installation doc for it.

_________________
dd-wrt eko/V24-K26 15508
Belkin F7D4301
8MB Flash
64MB RAM

Optware (jffs/mnt) 4GB Flash Drive
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Fri Oct 29, 2010 7:08    Post subject: Reply with quote
Ill be around off and on for the next 4-5 hours.

If you have any issues post them and ill answer as soon as I can.

Cheers

A

_________________
dd-wrt eko/V24-K26 15508
Belkin F7D4301
8MB Flash
64MB RAM

Optware (jffs/mnt) 4GB Flash Drive
yzy-oui-fi
DD-WRT Guru


Joined: 03 Mar 2009
Posts: 2826
Location: France

PostPosted: Fri Oct 29, 2010 8:22    Post subject: Reply with quote
bpsmicro, you said you used gedit to modify the script, so i presume you could be a Debian our Ubuntu user(I'm Ubuntu user). I have noticed one curious thing when i browse files with nautilus (through sshfs) and edit files included in writable directories of a dd-wrt-box with gedit, it seems that i couldn't modify and save files this way(don't ask me why). So i modify files on my computer, then move it to the dd-wrt box or directly get it from a webserver via wget.

Note: You could use Filezilla (which include sshfs client) to upload, Download, or edit files included in DD-WRT box

_________________
DD-WRT WDS MESH + DASHBOARD (fr), DD-WRT network setting tool (tools.yzy-oui-fi.com), Wifi Business and IT guy After hours, My Blog, Free DD-WRT VPN Community(www.wrt-pptp-ww.com), DD-WRT pré-réglés pour réseau outdoor(hotspot.yzy-oui-fi.com), Nouveau Forum DD-WRT francophone


Last edited by yzy-oui-fi on Fri Oct 29, 2010 8:54; edited 2 times in total
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Fri Oct 29, 2010 8:43    Post subject: Reply with quote
I should also mention somthing about specifying directories into the script.

For parameters that require a directory only (no file name included) they must be in the following way

/mnt/monitor/ - see how it has the last / at the end.

What the code does is assume that this is passed through, so I simply add the file name to the end of it.

For example history files.

_historyPath=/mnt/monitor/history/

the code does this cp $_macUsage $_historyPath'fileName'

I dont add slashes, this is supplied by the user.

Also, yes the system creates the backup file.

This will be created when the backup is first run which is every 'N' iteration of the update (set by the user through scrip parameters),

_________________
dd-wrt eko/V24-K26 15508
Belkin F7D4301
8MB Flash
64MB RAM

Optware (jffs/mnt) 4GB Flash Drive
bpsmicro
DD-WRT User


Joined: 07 Oct 2010
Posts: 159

PostPosted: Fri Oct 29, 2010 10:57    Post subject: Reply with quote
Thanks for the note on the History path. I think I need to fix that in my startup script.

And yzy, what I currently have is Ubuntu 10.10 in a virtual machine, with a share that I connect to from the router as /tmp/smbshare.
I download/edit/whatever all the files on the Ubuntu VM, and then telnet into the router and simply 'cp -f -p' from the smbshare to /mnt/mmc.

The only quirk is that the day counter seems stuck at 1 (meaning, the "Daily Breakdown") list is sticking everything at Day 1. The history path issue may be the cause of that, so I'll take a peek after my morning coffee. :-)

Brad.
yzy-oui-fi
DD-WRT Guru


Joined: 03 Mar 2009
Posts: 2826
Location: France

PostPosted: Fri Oct 29, 2010 11:17    Post subject: Reply with quote
bpsmicro wrote:

And yzy, what I currently have is Ubuntu 10.10


Welcome abord ! Smile

_________________
DD-WRT WDS MESH + DASHBOARD (fr), DD-WRT network setting tool (tools.yzy-oui-fi.com), Wifi Business and IT guy After hours, My Blog, Free DD-WRT VPN Community(www.wrt-pptp-ww.com), DD-WRT pré-réglés pour réseau outdoor(hotspot.yzy-oui-fi.com), Nouveau Forum DD-WRT francophone
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Fri Oct 29, 2010 12:47    Post subject: Reply with quote
Lol, oops my bad

I have not be very clear on the setup.

Yeah, one of the side effects of leaving it as the defaults (for the optional ones) is that I record everythiong under day 1. This was for those people that didn have access to much space.

Basically what you are seeing is what the wrtbwmon script does, records usage regardless of what day.

To enable daily usage you have to pass through the last optional parameter as 1.

This should be your startup script.

I have modifed it for you, but I have everything enabled and I store the usage data in memory only. If you want this, instead of supplying /tmp/mac_usage.db, pass through 1 instead.

Also note I am using the default javascript output path which in this case is triggerd by no value being supplied (system defaults it to /tmp/www/).

What I need to do is create a nice diagram which illustrates exactly what option does what.

#!/bin/sh
while [ ! -f /tmp/monitor-started.lock ] && [ ! -f /tmp/monitor-stop ]; do
cp /mnt/monitor/setup/monitor.html /tmp/www/monitor.html
/mnt/monitor/setup/bw_monitor.sh 30 3 30 4 /mnt/monitor/setup/users.file /mnt/monitor/mac_usage.backup /mnt/monitor/history/ /tmp/mac_usage.db '' 1 1 0 0 1
if [ ! -f /tmp/monitor-started.lock ]; then
sleep 10
fi
done

_________________
dd-wrt eko/V24-K26 15508
Belkin F7D4301
8MB Flash
64MB RAM

Optware (jffs/mnt) 4GB Flash Drive
Goto page Previous  1, 2, 3, ... 40, 41, 42  Next Display posts from previous:    Page 2 of 42
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware 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