Aight... I have version 2 of the monitor file i wrote. This time with graphs and more magic
I decided to take a peek at your new script/page, and compare my various other files to the latest to see if I was behind on anything.
It's all working great *except* the "Monthly Breakdown" list/graph. That displays nothing at all. The other lists/graphs are working fine though.
Any ideas why that may be? So I need to wait a few days for them to show up? I have a couple of weeks worth of data in user_details.js.
I don't know enough javascript to troubleshoot.
Brad.
Edit: Semi-fixed. At the very bottom of OrionView.js there's a line "var _resetDay = undefined", which causes the test in setMonthlyBreakdown to throw an exception out of the function. Also, I tweaked my bw_monitor.sh to pass in a variable, but I mistakenly called it "resetDay" (no underscore). Fixing those two things caused it to work.
The next problem is the userIndex/hostIndex part isn't being calculated quite right. The table changes when I change selections, but the numbers don't match the selection. Working on that next.
Edit 2: Fixed that too. In some parts you're sorting the user list (by ID), but not when populating the MonthlyBreak dropdown. I changed that code to this:
Since I can't leave well enough alone, I decided to change the chart for the Monthly Breakdown to a column chart, since that seems to make more sense to me for visualization.
In the function setMonthlyBreakdown, I changed the code that fills the chartDataTables to replace the "tot=" part (in two spots) with:
Code:
down = Number(readablizeBytes(dayTable.down, 2)[0]);
up = Number(readablizeBytes(dayTable.up, 2)[0]);
totalByDay.push([ lineDate.getDate().toString(), down, up]);
So the chartDataTables.totalByDay array gets three columns per row instead of two, and just the numeric value for the day of the month.
Then in setupCharts, I replaced the code that sets up the monthlyBreakChartObj with this:
Code:
data = new google.visualization.DataTable();
data.addColumn('string', 'Day');
data.addColumn('number', 'MB Down');
data.addColumn('number', 'MB Up');
data.addRows(chartDataTables.totalByDay);
var baroptions = {
title: 'Monthly Breakdown By Day for User/Host',
legend: {position: 'none'},
chartArea: {width: '80%', height: '80%'},
isStacked: true,
hAxis: {slantedText: false, titleTextStyle: {color: 'green'}},
vAxis: {title: 'MB', titleTextStyle: {color: 'green'}},
series: {0:{color: 'blue', visibleInLegend: false}, 1:{color: 'orange', visibleInLegend: false}}
};
monthlyBreakChartObj = monthlyBreakChartObj || new google.visualization.ColumnChart(document.getElementById('SECTION_MONTHLY_BREAKDOWN_GRAPH'));
monthlyBreakChartObj.draw(data, baroptions);
The results will look something like the attached.
One of the things I'd like to do is display the last update time on the usage page.
I found that modifying the reloadJavascript() method thusly:
Code:
outputString="_todaysDay=$today"'; var users=[]; _supportBit32='"$_supportBit32"'; _resetDay='"$_resetDay"';'
lastUpdate=$(date +"%F %T")
outputString="$outputString ""_lastUpdate='""$lastUpdate""';"
Added _lastUpdate with the time quoted when the user_details.js file was initially created. And I figured out how to display that on the page.
The problem is, intermediate updates are done via the updateJavascript() method, which uses a magic incantation (to me, anyway) of greps & seds to replace the data.
That's where I'm definitely stuck. I'm sure there must be a similar sed incantation to replace my _lastUpdate= value, but that one's beyond me.
I've gotten mine working pretty much exactly the way I want, but I had to tweak the actual shell slightly too. I'll compile some notes on exactly what I did and post my version of the files soon. Fezjay can pick & choose what he wants to put in the "official" releases.
Posted: Tue Apr 23, 2013 16:03 Post subject: I've tweak the OrionView outputs too
I want to start by saying a really big thank you to FezJay, Orionshock, bpsmicro and everyone else who has worked on this code. I can see who is downloading how much on my home network now. (The next step is to understand why my ISP's numbers are so different from mine but that is a completely different thread.)
I made a bunch of changes to the OrionView page... the biggest/most obvious being displaying the previous sections of the documment in tabs. Of course, this meant changes within the HTML, CSS & JavaScript files.
I also made minor changes in bw_monitor.sh so that the reset day is saved into the user_details.js file; and, added a new optional parameter for the bandwidth capacity and this value is also written to user_details.js
All of the updated files are included in the attached zip files. Just expand them in the usual spot (I've included an updated bw_monitor.startup script that copies all of the files to tmp/www (in the event that your router reboots)
I'm aware of two bugs at the moment
1. in the monthly breakdown graph, my dates are listed in descending order, and
2. the totals for two of my devices are swapped in the monthly breakdown table
There are also a few tweaks that I'd like to add in the near future (see the to-do tab).
Posted: Wed Apr 24, 2013 16:17 Post subject: Auto added entires sometimes have a Mac Address of 00:00...?
I've found that on my network occasionally a new device is auto-added and is recorded as having a mac address of 00:00:00:00:00:00
When I go into my users.file, I find an entry something like:
00:00:00:00:00:00,192.168.1.105,00:00:00:00:00:00,Auto-Added
It's easy enough to get the proper mac address,etc. (from the IP address) so that the users.file entry can be corrected but that still leaves funky data in user_details.js (and therefore also in the reports)
Has anyone else noticed this? Any idea why it is occurring?
I've ommited ips in between, but 00 comes before the real macid with the rest of the information, but the webpage will show 0 bytes. Atleast the information is getting collecting.
1.)check the bandwidth total per mac for the month
2.)compare with predetermined limit
3.)if over execute barebone function - admins can fill in for their own purpose, ie iptables and/or tc commands, send email notices. etc.
If someone could show me how to do the 1st part w/ 2 vars like $mac and $totalusage then I should be able to figure out the rest.
Al_c I was trying out your new reporting page but have run into a few issues.
I noticed that in the startup script it wasn't reading the correct html file and changed
sed -e 's/src=.*>/src="http:\/\/192.168.1.1\/user\/user_details.js"><\/script>/' /opt/monitor/setup/monitor.html > /tmp/www/monitor.html
to
sed -e 's/src=.*>/src="http:\/\/192.168.1.1\/user\/user_details.js"><\/script>/' /opt/monitor/setup/
OrionView-v1.1.html > /tmp/www/monitor.html
Which gives me a weebpage but the js still doesn't seem to be working, any ideas, I wondering if it is due to the reference path not being the ip of the router?
John - sorry, I've been away from the forum for a couple of days and missed your message.
The change you suggested below is actually unnecessary (as I'm no longer using the monitor.html file at all).
When the startup script is run, do the '*-v1.1.*' files get copied over to /tmp/www/ ? (i.e., OrionView-v1.1.html, OrionView-v1.1.js, OrionView-v1.1.css)
I'm not an shell expert by any stretch of the imagination. It could be that the script is crapping out because /opt/montior/setup/monitor.html does not exist on your machine... I probably have it kicking around from before my changes. If you do not have that file, try deleting or commenting out the line.
Posted: Fri May 17, 2013 19:36 Post subject: what if argument #14 is set to 0?
From the argument descriptions:
Arg 14->Auto Add MACS(Optional): Indicates if the system to auto add MAC addresses that do not exist in the users file. Default is 1 (yes)
If you set this value to 0, will it prevent the problem? However it means that you'll have to edit your users.file as new devices appear on your router.
[I'm also looking into the bw_monitor.sh code and I'm tempted to add an if statement that checks the value of the MAC address prior to inserting it into users.file.]
Last but not least, I did find a reference to an old defect (#0000683) with the following description:
0000683 [DD-WRT v23] Router (WAN) MAC set to 00:00:00:00:00:00 when 'Connect on Demand' selected - SP1 (01/27/06)
But it appears this defect was resolved 7 years ago???
Culex wrote:
Quote:
When I go into my users.file, I find an entry something like:
00:00:00:00:00:00,192.168.1.105,00:00:00:00:00:00,Auto-Added
I'm seeing it in my dnsmasq2users.file too. It's the last entry, is that the same for you?
I've ommited ips in between, but 00 comes before the real macid with the rest of the information, but the webpage will show 0 bytes. Atleast the information is getting collecting.
Posted: Sun May 19, 2013 17:24 Post subject: problem with date in version 1.3
Hi FezJay,
I really like your bandwidth monitor!
I installed version 1.3, and it was working perfectly until the second half of this month. The monitoring and db seem to be OK, but when I look at the monitor.html page it shows breakdown for the day 199 instead of 19 and 186 instead of 18 (yesterday). If I telnet to the router and use the date command from the setup instructions, it returns 18 or 19.
Do you have any idea how the date is getting corrupted with the extra digit? I looked through the html, but couldn't identify the cause.
The monthly summaries, and also the table of the days of the month are correct, it is just the current day section that is all zeros with the 199 or 186 date. The day 18 and 19 are correct in the table below with non-zero bandwidth data that looks correct.
Eric
Much respect to all that kept this code going through the years!
I have MyPage installed but would like to see how this looks on my system.
Would I need to have wrtbwmon installed before installing the OrionView v1.1?