Closed Wrechid closed 5 years ago
I have noticed if you let the tool run for too long it might overflow the calculation this for me usually happens after more than a month without clearing the stats. You do that with clean.sh
Yes, I have clean.sh crontab for the 1st of each month... My monthly data usage is anywhere from 600gb to 900gb... But I never see GB increments on the webpage...
Hmm.... that's strange I'm seeing a montlhy data usage of 450GB - 600GB it doesn't feel like you are too far off data range wise.
You can try patching the bwmon.js page to rescale the numbers so you'll see the correct GB/MB but I haven't seen a lot of other users with this problem potentially this is dependent on the router?
I was thinking that it was specific router and dd-wrt version problem... Can you point me in the direction of where in bwmon.js is scale control...? I am a little savvy in script, I should be able to figure it out... :)
Actually it shouldn't be hard at all the $scope.CONVERSION_FACTOR
is a constant at the top of the file in case it needed adjustment later: https://github.com/vortex-5/ddwrt-bwmon/blob/master/bwmon/www/bwmon.js#L10
It is used later on when determining the initial kbps measurement which all subsequent sizes are based off of.
https://github.com/vortex-5/ddwrt-bwmon/blob/master/bwmon/www/bwmon.js#L520 getSize is the function that puts a kbps / mbps to the numbers and scales it worst case you would have to modify this function so the numbers look right based on what your router is outputting. That said it looks like $scope.CONVERSION_FACTOR
is used in here exclusively so basically my previous statement is true adjusting $scope.CONVERSION_FACTOR
alone should give you different units.
Effectively the numbers on the router are in some unit usually in KB your ISP numbers are in KiB basically that conversion factor at the top helps move between the two. However in the event your router is in some other unit finding the correct conversion factor will also help the script determine what is a KB.
Basically getSize is a function that scales the numbers and attaches a unit the rest of the script doesn't necessarily know what the units are .
One thing to look out for the rate calculations were using a similar conversion however because it's supporting php poll at any time to get more responsive rates it's using a slightly different calculation https://github.com/vortex-5/ddwrt-bwmon/blob/master/bwmon/www/bwmon.js#L287 you may need to match the rate calculations.
Seeing this I might just turn conversion factor into just the numerator part so it can be changed universally. I have 2 min maybe I can do that now....
There done the script is more consistently using the conversion factor.
In my case the 8 used in the rates should be the same as the 8 in the conversion factor. If you are getting odd numbers on the rates maybe you should return those lines back to before the last commit as I sort of changed them without being able to test them.
That said in my case the values would be identical so everything will continue working as it did.
I haven't really thought this through so there might be a chance that tweaking the CONVERSION_FACTOR alone might not be sufficient.
Data usage reports MB on the webpage, but my isp is reporting similar numbers in GB...