Kiougar / luci-wrtbwmon

Bandwidth tracker for OpenWRT that uses wrtbwmon
https://github.com/pyrovski/wrtbwmon
MIT License
319 stars 56 forks source link

Negative download/upload speeds on devices hopping between vlans #7

Closed fakuivan closed 7 years ago

fakuivan commented 7 years ago

I've setup a guest network using VLANs (based on this guide) that has down/up limits that prevents it from saturating the whole internet link. Sometimes if one of my devices is saturating the link I preffer to move it to the gest network so I can still use the internet on the internal network. All of these devices have their hostname and local IP set on the DHCP section.

For some reason, these devices show negative values on the speed meter: negative speeds And speed values fluctuate even though the first one is connected to the internal VLAN and the other two are turned off.

Versions:


root@router:~# opkg list-installed | grep wrtb
luci-wrtbwmon - 0.3.1
wrtbwmon - 0.36```
Kiougar commented 7 years ago

Hmm, I think the speed calculation is using the old data the device had, before the IP change.

Can you post the contents of the db file here? You can replace the MAC addresses with unique names so that I can compare them. For example replace every 00:aa:bb:cc:dd with user1, every dd:cc:bb:aa:00 with user2, and so on.

fakuivan commented 7 years ago

Ok, here's the database

#device,ip,iface,in,out,total,first_date,last_date
dev1,192.168.110.101,br-lan,1551098,188042,1739140,12-04-2017_00:49:29,12-04-2017_17:16:18
dev2,192.168.110.110,br-lan,4500358893,99097865,4599456758,12-04-2017_20:22:47,13-04-2017_14:29:24
dev3,192.168.110.102,br-lan,293368683,1568206287,1861574970,11-04-2017_23:02:04,14-04-2017_14:52:52
dev2,192.168.1.104,br-guests,310499412,9989258,320488670,12-04-2017_21:17:13,12-04-2017_23:41:52
dev5,192.168.110.103,br-lan,152183,226751,378934,11-04-2017_23:02:04,14-04-2017_15:06:17
dev6,192.168.110.112,br-lan,41256627,11377979,52634606,11-04-2017_23:02:04,13-04-2017_14:29:24
dev7,192.168.110.200,br-lan,0,0,0,12-04-2017_23:20:47,12-04-2017_23:20:47
dev8,192.168.110.113,br-lan,291642931,13528331,305171262,12-04-2017_19:23:56,13-04-2017_14:29:24
dev9,192.168.110.114,br-lan,163674222,40706909,204381131,11-04-2017_23:02:04,13-04-2017_14:29:24
dev10,192.168.110.202,br-lan,0,0,0,11-04-2017_23:02:04,11-04-2017_23:02:04
dev11,192.168.1.132,br-guests,2408939,403644,2812583,13-04-2017_01:08:27,13-04-2017_14:29:25
dev12,192.168.110.115,br-lan,42223578,159755193,201978771,11-04-2017_23:02:04,13-04-2017_14:29:24
dev13,192.168.110.108,br-lan,12398259564,566290904,12964550468,05-04-2017_11:57:47,14-04-2017_15:06:36
dev14,192.168.110.116,br-lan,2694859742,79088761,2773948503,05-04-2017_11:57:47,13-04-2017_14:29:24
dev11,192.168.110.109,br-lan,11382191265,426970123,11809161388,05-04-2017_11:57:47,14-04-2017_14:27:39
dev15,192.168.1.119,br-guests,334254256,18087090,352341346,12-04-2017_20:19:10,14-04-2017_14:27:39
dev16,192.168.110.134,br-lan,2492987,1477935,3970922,12-04-2017_22:03:40,13-04-2017_14:29:25
dev15,192.168.110.119,br-lan,3368901716,324227940,3693129656,12-04-2017_17:16:18,14-04-2017_15:06:33
dev17,192.168.110.137,br-lan,2402420804,44886554,2447307358,11-04-2017_23:02:04,14-04-2017_14:27:39
dev18,192.168.110.129,br-lan,55606,44502,100108,11-04-2017_23:02:04,14-04-2017_14:27:39

I made a simple table on google docs with some accents to make the thing more readable.

Kiougar commented 7 years ago

I made a new release that hopefully fixes the issue. I cannot test it myself so let me know if it works!

We can close the issue if we know it's resolved.

fakuivan commented 7 years ago

Nope :/ the it keeps showing negative speeds for the devices that went from one vlan to the other. I just noticed that hostnames change too, when I hop from the internal vlan to the guests vlan the the hostname previously assigned to that device on the internal change to the one (now newly assigned).

Versions:

root@router:~# opkg list-installed | grep wrtb
luci-wrtbwmon - 0.4
wrtbwmon - 0.36
Kiougar commented 7 years ago

If you open the developer tools of your browser you can type values in the console. It should display an array. Can you paste that array here?

fakuivan commented 7 years ago

Could you elaborate more on that? I don't do much FE web development. I have chrome and edge installed.

Kiougar commented 7 years ago

Using Chrome:

  1. While on the Usage page
  2. Type Ctrl+Shift+I to open the Developer Tools
  3. Select the Console tab
  4. Type in the console the following: values

It should display a long text. You can select and copy that text and paste it here.

fakuivan commented 7 years ago

I got some unexpected results:

> values
function values(object) { [Command Line API] }
> values(window) //I tried this one too
VM115:1 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
(anonymous) @ VM115:1
[function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, function, Object, Object, function, 198, 197, true, 5, function, Window, null, Window, 0, Window, false, Location, Window, Window, document, "", History, BarProp, BarProp, BarProp, BarProp, BarProp, BarProp, "", null, Navigator, ApplicationCache, External, Screen, 791, 950, 0, 0, 0, 0, 0, 0, 1920, 1040, 1, Navigator, 0, 0, "", "", StyleMedia, null, null, null, null, null, null, null, null, null, null…]

console

Versions:

Google Chrome   57.0.2987.133 (Build oficial) (64 bits)
Kiougar commented 7 years ago

Sorry for the late response.

I see. Well there is another way to get the values:

  1. While you have the developer tools opened, click on the Network tab.
  2. Then click on the XHR tab.
  3. A row should appear every 5 seconds (depending on the interval of auto-refresh). Right-click on the latest row and select Copy -> Copy response.

Keep in mind that the response contains MAC addresses, so if you want to replace them, please, use the same names you used on your spreadsheet.

fakuivan commented 7 years ago

Ooh... The 2f68342f7dd9936b541ac9af85ad2be834638639 patch actually worked. I restarted the service but I didn't actually rebooted the router. I think I had to clear the webserver cache. Thanks a lot for the help! 👍

Feel free to close this 🥇 .

Versions:

root@router:~# opkg list-installed | grep wrtb
luci-wrtbwmon - 0.4
wrtbwmon - 0.36
Kiougar commented 7 years ago

Glad to hear that it worked! 👍