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 ... 28, 29, 30 ... 40, 41, 42  Next
Author Message
wooly
DD-WRT Novice


Joined: 06 May 2009
Posts: 29

PostPosted: Tue Nov 22, 2011 21:18    Post subject: Reply with quote
Works like a charm, thanks

Guess I didn't read enough OR all those //\\/\\/ got me confused!!

Wooly
Sponsor
Dark_Shadow
DD-WRT Guru


Joined: 31 Aug 2009
Posts: 2429
Location: Third Rock from the Sun

PostPosted: Tue Nov 22, 2011 23:21    Post subject: Reply with quote
Moleshome wrote:
wooly wrote:
As you can see a number of "60"'s have replaced characters in the original. All replaced characters existed in "USAGE_CAP"

However the part to change the ip address worked as I expected.


What if you use:

Code:
sed -e 's/\[USAGE_CAP\]/60/'  //mnt/test/test.html > /mnt/test/www/test1.html


So this is how the line shouls be in the example startup.sh?

Code:
      sed -e 's/src=.*>/src="http:\/\/192.168.1.1\/user\/user_details.js"><\/script>/' -e 's/\[USAGE_CAP\]/50/' -e 's/\[RESET_DAY\]/05/' //[DIR]/monitor.html > /[WWW DIR]/monitor.html

_________________
Peacock Thread-FAQ -- Firmware Recommendations -- dd-wrt Wiki

Testing Multiple Routers -- Bootloader Collection Project -- My Wiki
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Wed Nov 30, 2011 8:06    Post subject: Reply with quote
Dark_Shadow wrote:
Moleshome wrote:
wooly wrote:
As you can see a number of "60"'s have replaced characters in the original. All replaced characters existed in "USAGE_CAP"

However the part to change the ip address worked as I expected.


What if you use:

Code:
sed -e 's/\[USAGE_CAP\]/60/'  //mnt/test/test.html > /mnt/test/www/test1.html


So this is how the line shouls be in the example startup.sh?

Code:
      sed -e 's/src=.*>/src="http:\/\/192.168.1.1\/user\/user_details.js"><\/script>/' -e 's/\[USAGE_CAP\]/50/' -e 's/\[RESET_DAY\]/05/' //[DIR]/monitor.html > /[WWW DIR]/monitor.html


Sorry mate for the late reply

Been real busy getting a project closed off for a prod release.

Did you get your issue sorted out?

If you didnt try manually copying the html file to the www directory (dont change any values except for the ip address).

See that sorts you issue out.

Just a note, that part of the start up script is there to help, BUT the main part of it is the IP address.

I would suggest only leaving that part of the script in and removing the others (USAGE etc)

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

Optware (jffs/mnt) 4GB Flash Drive
wooly
DD-WRT Novice


Joined: 06 May 2009
Posts: 29

PostPosted: Thu Dec 01, 2011 14:47    Post subject: Reply with quote
Thanks, got it sorted as you suggested. Since then I have managed to get the BWMon page to fit nicely into the MYPage template BWMon and MyPage

Wooly
Dark_Shadow
DD-WRT Guru


Joined: 31 Aug 2009
Posts: 2429
Location: Third Rock from the Sun

PostPosted: Fri Dec 02, 2011 0:25    Post subject: Reply with quote
FezJay wrote:
Dark_Shadow wrote:


So this is how the line should be in the example startup.sh?

Code:
      sed -e 's/src=.*>/src="http:\/\/192.168.1.1\/user\/user_details.js"><\/script>/' -e 's/\[USAGE_CAP\]/50/' -e 's/\[RESET_DAY\]/05/' //[DIR]/monitor.html > /[WWW DIR]/monitor.html


Sorry mate for the late reply

Been real busy getting a project closed off for a prod release.

Did you get your issue sorted out?

If you didnt try manually copying the html file to the www directory (dont change any values except for the ip address).

See that sorts you issue out.

Just a note, that part of the start up script is there to help, BUT the main part of it is the IP address.

I would suggest only leaving that part of the script in and removing the others (USAGE etc)


The line I posted worked, however my monitor hung on the 29th, just manually reset it today.

_________________
Peacock Thread-FAQ -- Firmware Recommendations -- dd-wrt Wiki

Testing Multiple Routers -- Bootloader Collection Project -- My Wiki
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Fri Dec 02, 2011 4:59    Post subject: Reply with quote
Mmmmm

Did you set the reset day to the 29th?

You are probably using the latest script version as well I assume.

The latest version is still a work in progress and I am still testing it.

I re-wrote the check next day functionality.

It could be this is not working. Ill find out tomorrow night if its not working as mine will reset tomorrow.

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

Optware (jffs/mnt) 4GB Flash Drive
Dark_Shadow
DD-WRT Guru


Joined: 31 Aug 2009
Posts: 2429
Location: Third Rock from the Sun

PostPosted: Fri Dec 02, 2011 5:43    Post subject: Reply with quote
FezJay wrote:
Mmmmm

Did you set the reset day to the 29th?

You are probably using the latest script version as well I assume.

The latest version is still a work in progress and I am still testing it.

I re-wrote the check next day functionality.

It could be this is not working. Ill find out tomorrow night if its not working as mine will reset tomorrow.
Nope got it set for the first. Yes i am using v1.2
_________________
Peacock Thread-FAQ -- Firmware Recommendations -- dd-wrt Wiki

Testing Multiple Routers -- Bootloader Collection Project -- My Wiki
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Mon Dec 05, 2011 4:56    Post subject: Reply with quote
Dark_Shadow wrote:
Nope got it set for the first. Yes i am using v1.2


Just found out that version 1.2 script is buggered. It causes the router to reboot as it gets locked into a loop or somthing.

I have reverted the Version 1.2 bw_monitor.sh file to version 1.1's (with some fixes around getting the next day).

So everyone re-download the current bw_monitor.sh file (either 1.1 or 1.2).

Ill have some time over the holiday break to have another go at it (my boarders are leaving so I can test it properly).

Cheers

FezJay

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

Optware (jffs/mnt) 4GB Flash Drive
wooly
DD-WRT Novice


Joined: 06 May 2009
Posts: 29

PostPosted: Sat Dec 10, 2011 15:23    Post subject: Reply with quote
I have been playing around with the script recently and think I may have discovered a typo in line 622 of the latest script

currentScript=`echo "$currentScript" | sed "s/$replaceToday/$replaceNewDay"/`

Should it not be
currentScript=`echo "$currentScript" | sed s/"$replaceToday/$replaceNewDay"/`

Given my total lack of scripting knowledge I may be out to lunch in this ..................

wooly
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Tue Dec 13, 2011 4:57    Post subject: Reply with quote
wooly wrote:
I have been playing around with the script recently and think I may have discovered a typo in line 622 of the latest script

currentScript=`echo "$currentScript" | sed "s/$replaceToday/$replaceNewDay"/`

Should it not be
currentScript=`echo "$currentScript" | sed s/"$replaceToday/$replaceNewDay"/`

Given my total lack of scripting knowledge I may be out to lunch in this ..................

wooly


Hey wooly

Both ways should work. If you look at the script I have instances where I have mixed them up (Mainly cause I was still learning as I was developing this script).

I think the fully enclosed expression sed "s/blah/blah" is the cleanest option

Mind you, what I have learnt about firmware, one expression may not work on all versions of the same firmware lol

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

Optware (jffs/mnt) 4GB Flash Drive
wooly
DD-WRT Novice


Joined: 06 May 2009
Posts: 29

PostPosted: Wed Dec 14, 2011 17:06    Post subject: Reply with quote
Thanks FezJay. Having been sidelined with a bad cough/cold recently I have been playing around with the start up script. (Hope I am not stepping on toes Question )

The majority of the changes require the user to fill in data for a number of parameters which are then carried through to the monitor.html and monitor.sh files. Really just a continuation of what you were doing. Once I found out how to pass more than 9 parameters live became a little simpler!!

A couple of changes are needed in the monitor.html and monitor.sh files

The start of the new start file is shown below. If you have no objection AND there is a demand, I'll clean stuff up a little and put it on here.


Wooly

Quote:
#!/bin/sh
# Enter the 17 Script Arguments for monitor.sh as per the wiki
UPD_INT=10
PUB_ITRN=3
BUP_ITRN=30
RESET_DAY=8
USR_PATH=/mnt/monitor/users.file
BUP_USG_PATH=/mnt/monitor/history/usage.backup
BUP_HIST_PATH=/mnt/monitor/history/
MAC_USG_PATH=/mnt/monitor/mac_usage.db
JAVA_OUT_PATH=/mnt/www/
USG_RST=1
JAVA_HIST=0
KEEP_JAVA=1
REC_DAILY_USG=1
AUTO_ADD_MAC=1
ADD32_SUPT=0
SHOW_MAC=1
LOG_PATH=/mnt/monitor/logs/log
#Enter data to be placed into the Monitor.html file, RESET_DAY data is taken from above
ROUTER_URL=10.1.1.1
USAGE_CAP=90
#Enter path and script name to run the monitor script
RUN_MON_SH=/mnt/monitor/monitor.sh
#These are the orininal variables
MONITOR_LOCK_FILE=/tmp/monitor-started.lock
MONITOR_STOP_FILE=/tmp/monitor-stop
MONITOR_STOPPED_FILE=/tmp/monitor-stopped
orionshock
DD-WRT Novice


Joined: 29 Apr 2011
Posts: 43

PostPosted: Mon Dec 26, 2011 18:27    Post subject: Reply with quote
wooly wrote:
Thanks FezJay. Having been sidelined with a bad cough/cold recently I have been playing around with the start up script. (Hope I am not stepping on toes Question )

The majority of the changes require the user to fill in data for a number of parameters which are then carried through to the monitor.html and monitor.sh files. Really just a continuation of what you were doing. Once I found out how to pass more than 9 parameters live became a little simpler!!

A couple of changes are needed in the monitor.html and monitor.sh files

The start of the new start file is shown below. If you have no objection AND there is a demand, I'll clean stuff up a little and put it on here.


Wooly

Quote:
#!/bin/sh
# Enter the 17 Script Arguments for monitor.sh as per the wiki
UPD_INT=10
PUB_ITRN=3
BUP_ITRN=30
RESET_DAY=8
USR_PATH=/mnt/monitor/users.file
BUP_USG_PATH=/mnt/monitor/history/usage.backup
BUP_HIST_PATH=/mnt/monitor/history/
MAC_USG_PATH=/mnt/monitor/mac_usage.db
JAVA_OUT_PATH=/mnt/www/
USG_RST=1
JAVA_HIST=0
KEEP_JAVA=1
REC_DAILY_USG=1
AUTO_ADD_MAC=1
ADD32_SUPT=0
SHOW_MAC=1
LOG_PATH=/mnt/monitor/logs/log
#Enter data to be placed into the Monitor.html file, RESET_DAY data is taken from above
ROUTER_URL=10.1.1.1
USAGE_CAP=90
#Enter path and script name to run the monitor script
RUN_MON_SH=/mnt/monitor/monitor.sh
#These are the orininal variables
MONITOR_LOCK_FILE=/tmp/monitor-started.lock
MONITOR_STOP_FILE=/tmp/monitor-stop
MONITOR_STOPPED_FILE=/tmp/monitor-stopped


I've been doing this for a while now tbh... I just used the full names & _ for spaces. Using full words help understand what's going on Smile
FezJay
DD-WRT User


Joined: 11 Sep 2010
Posts: 176

PostPosted: Tue Dec 27, 2011 7:55    Post subject: Reply with quote
wooly wrote:
Thanks FezJay. Having been sidelined with a bad cough/cold recently I have been playing around with the start up script. (Hope I am not stepping on toes Question )

The majority of the changes require the user to fill in data for a number of parameters which are then carried through to the monitor.html and monitor.sh files. Really just a continuation of what you were doing. Once I found out how to pass more than 9 parameters live became a little simpler!!

A couple of changes are needed in the monitor.html and monitor.sh files
...


Hey Wooly

Not stepping on anyones toes buddy. In fact any help is appreciated. I am sure there are better more effective and efficient ways of doing most of the stuff i am doing in my script.

If you would like, I could add you as a source editor of the project? Just need your email (not too sure if it needs to be a gmail account).

Im using subversion as the source control (pretty easy to setup and use).

Another option is, you send me the source code changes you have made and I add them to subversion.

In any case I will create a major version in the trunk naming it after the dev.

e.g. V1.0_wooly

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

Optware (jffs/mnt) 4GB Flash Drive
wooly
DD-WRT Novice


Joined: 06 May 2009
Posts: 29

PostPosted: Fri Dec 30, 2011 20:06    Post subject: Reply with quote
Hi FezJay

Just finished playing around and adding a couple of lines of text that display % of days from current period that have been used and % of GB used.

Just want to add 1 more piece to colour code the text to show whether usage is ahead of the availability or behind it. Probably be a couple of weeks before I get anything to you as we are taking the trailer down to Tx (away from the snow hopefully). Once settled in I'll send you stuff to look at. If it's worth including, feel free to do so, but be warned .... it's my first attempt at javascript, it may not be pretty.

Wooly
ragemachinexrt
DD-WRT Novice


Joined: 21 Nov 2011
Posts: 2

PostPosted: Wed Feb 01, 2012 8:18    Post subject: Reply with quote
Hello
I see this listed on the broadcom section but could it also work for an atheros based unit? I have a WNDR3700v2 running DD-WRT v24-sp2 (06/14/11) std - build 17201 and would love to have this or a tracker with similiar detail running. I just have the full version of DD-WRT running, I did not add optware, would prefer not to if I don't have to. With a flash drive mounted as /opt I followed the guide, the startup script runs without error and I get a blank template when I go to http://192.168.1.1/user/monitor.html
showing 0 bytes used and no users listed.
what format does entries into users.file need to be in for my static IP/Mac assignments instead of using dnsmasq.conf? I have static entries for my equipment and the network printer, all the rest are DHCP, mostly guests <20 clients.

Here is how I set up my startup file

#!/bin/sh
MONITOR_LOCK_FILE=/tmp/monitor-started.lock
MONITOR_STOP_FILE=/tmp/monitor-stop
MONITOR_STOPPED_FILE=/tmp/monitor-stopped
while [ ! -f $MONITOR_LOCK_FILE ] && [ ! -f $MONITOR_STOP_FILE ]; do
if [ ! -f /tmp/www/monitor.html ]; then
sed 's/src=.*>/src="http:\/\/192.168.1.1\/user\/user_details.js"><\/script>/' /opt/monitor.html > /tmp/www/monitor.html
fi
/opt/bw_monitor.sh 30 3 30 4 /tmp/dnsmasq.conf /opt/mac_usage.backup /opt/history/ /tmp/mac_usage.db /tmp/www/ 1 0 0 1 1 1 0 /opt/tmp/bw_monitor.log
if [ ! -f $MONITOR_LOCK_FILE ]; then
sleep 10
fi
done


I created all the files in /opt it asks for. The script when ran only creates monitor-started.lock but not mac_usage.db in /tmp.
Goto page Previous  1, 2, 3 ... 28, 29, 30 ... 40, 41, 42  Next Display posts from previous:    Page 29 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