vortex-5 / ddwrt-bwmon

An Individual Bandwidth Monitor For DD-WRT
171 stars 37 forks source link

Upload & Download Rate are always 0 Kbps #21

Closed SyntaxUnknown closed 8 years ago

SyntaxUnknown commented 8 years ago

Thank you for putting this together!!

I got it installed and it seems to be tracking the Totals (Total, Up, and Down), but the DN and UP Rate columns are always 0, even with long running downloads taking place. I see the grand totals changing for the device, but nothing on the rate.

Is there something that can be done?

vortex-5 commented 8 years ago

You're actually the first user to encounter this so perhaps we can do some diagnostic on this.

Which version are you running the standard version or the version served with lighttpd (if you run lighttpd the script will detect this and automatically switch to this better version).

If you are running the Lighttpd version please check that you have an file located:

RouterIP:81/bwreader.php

This file should update with each refresh.

If you are running the standard version check to see that you have the following files

RouterIP/user/usage.js RouterIP/user/usage_stats.js

Both files are there one is the snapshot taken last cycle and one is the snapshot taken this cycle this is how bandwidth is calculated for the standard mode since you don't know when the script is run.

On the router the files will be in the following directories

for Lighttpd /jffs/www/bwreader.php

for normal mode: /tmp/www/usage.js /tmp/www/usage_stats.js

SyntaxUnknown commented 8 years ago

Thanks for getting back to me!

I'm running the Lighttpd version and bwreader.php is there.

I pulled up the F12 tools on the browser and noticed that all the requests to bwreader.php were coming back as cached. So, in a separate tab, I loaded up bwreader.php and did a ctrl-F5 on it (force refresh) and every time I did that, the numbers in bwmon.html would correctly show and highlight.

So, I realized I was running this in MS Edge, so I fired up Chrome and there was no caching of bwreader.php and the page displayed correctly.

I guess it's just a caching issue. I noticed that the bwreader requests aren't including a no-cache header, so maybe that would fix it? You could also add a random number to the end of the request to also force a fresh copy to download.

It's a great tool....thanks again for putting this together!

vortex-5 commented 8 years ago

Actually from my professional experience most no-cache headers don't work for IE. The only way to get that to work is to generate a random GUID you attach to the end of the filename I.E. if you request files like this:

http://--something--/bwreader.php?nocache=SOMERANDOMNUMBER it is how we do it at my work.

I have not tested this tool in Edge only in Firefox and Chrome so consider yours a first.

Yeah I was right IE requires some special no cache tag:

https://support.microsoft.com/en-us/kb/234067

<HTML><HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD><BODY>
</BODY>
</HTML>

I'll patch this into the current version give me an hour.

vortex-5 commented 8 years ago

Yeah I just tried this Edge is still retarded following the MSDN article and adding those meta tags does nothing IE still caches.

vortex-5 commented 8 years ago

I'll see if I can add some no cache generation to the code with the guid I was trying to avoid this since it makes everything look dirty and modern browsers weren't having this IE specific ugly behavior.

vortex-5 commented 8 years ago

K done the patch drafting up a release.

vortex-5 commented 8 years ago

Please test the new release instructions are updated on the main repository they are the same except the version number.

You can overwrite your existing bwmon with the one provided in the new releases.

https://github.com/vortex-5/ddwrt-bwmon/releases

1.6.3 is released to address the issue you were having.

vortex-5 commented 8 years ago

I'll be leaving this issue open until you report back. In my tests Edge now works but each person's environment is different.

SyntaxUnknown commented 8 years ago

That fixed it! Thanks for the quick turn around!

vortex-5 commented 8 years ago

I delt with this kind of problem a lot at work specifically related to IE so I know a thing or two about this dumb caching issue.

This was a very minor fix didn't affect the overall way the script works I have another major change planned but when I make major changes I tend to be overly cautious with the release schedule. Some people have expressed that they now use this regularly so they'd rather have better tested updates than wild releases without much QA.