aristocratos / bashtop

Linux/OSX/FreeBSD resource monitor
Apache License 2.0
10.79k stars 552 forks source link

[BUG] How is network traffic monitored? Sometimes it doesn't detect anything #174

Open turkeyphant opened 4 years ago

turkeyphant commented 4 years ago

Describe the bug

I can be transferring huge amounts up and down and the network section for the correct interface (eth0) shows no traffic whatsover.

To Reproduce

Seems to happen about 40% of the time. Relaunching makes no difference.

Expected behavior

Sometimes it reports network traffic fine.

Screenshots

this is network traffic reported by netdata image

this is network traffic reported by bashtop image

Info (please complete the following information):

aristocratos commented 4 years ago

All network info is collected from /proc/net/dev when using linux in both psutil and /proc methods.

You're not running bashtop sandboxed or something like that?

Otherwise i would try tail -f /proc/net/dev while downloading something or running a speed test, to see if there's something going wrong in there.

tail is not going to work i realized. But running cat /proc/net/dev a couple of times during and comparing.

aristocratos commented 4 years ago

Are you running multiple network monitor software? Was thinking that it might not get access possibly if something else is constantly reading from /proc/net/dev.

turkeyphant commented 4 years ago

cat /proc/net/dev seems to work correctly:

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
veth8c6beaf:  255826    3231    0    0    0     0          0         0 10670107    8992    0    0    0     0       0          0
virbr0-nic:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
vethf1662aa: 8485780   68613    0    0    0     0          0         0  7904265   51598    0    0    0     0       0          0
veth71c7b58:       0       0    0    0    0     0          0         0   644158    3162    0    0    0     0       0          0
veth872dba4: 854998684  412575    0    0    0     0          0         0 32927229  421036    0    0    0     0       0          0
vethf70b4d3:    1236      18    0    0    0     0          0         0   644754    3172    0    0    0     0       0          0
veth00ef657: 33425476   31860    0    0    0     0          0         0  8210650   46967    0    0    0     0       0          0
    lo: 13842267096 23005822    0    0    0     0          0         0 13842267096 23005822    0    0    0     0       0          0
veth7fb33f1: 51909829  515437    0    0    0     0          0         0 74688993  541216    0    0    0     0       0          0
veth23384f0:    1661      12    0    0    0     0          0         0   647838    3177    0    0    0     0       0          0
veth798a17f:       0       0    0    0    0     0          0         0   643899    3160    0    0    0     0       0          0
veth972a573:  119383      51    0    0    0     0          0         0   647422    3221    0    0    0     0       0          0
veth7e37e4a:  162644    1306    0    0    0     0          0         0   904990    4164    0    0    0     0       0          0
 tunl0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0: 2982092842005 2532288297    0 128970    0     0          0    955152 1651562320958 1826658205    0    0    0     0       0          0
virbr0: 133825484  231108    0    0    0     0          0         0 759527064  274162    0    0    0     0       0          0
ip_vti0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
vethce43ace: 2423696   11321    0    0    0     0          0         0 15189844   14231    0    0    0     0       0          0
gretap0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  gre0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth1: 693423649343 119110796    0    0    0     0          0     80149 112776818509 62705455    0    0    0     0       0          0
docker0: 42108791879 99891074    0    0    0     0          0         0 708623386525 441996956    0    0    0     0       0          0
veth2846623:    2955      22    0    0    0     0          0         0   652304    3182    0    0    0     0       0          0
  sit0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
erspan0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
vethc00e71c: 1941947    8138    0    0    0     0          0         0 27876086   11844    0    0    0     0       0          0
veth7818f09: 6226161   64059    0    0    0     0          0         0  6330640   60861    0    0    0     0       0          0
veth3ab4cf6: 176674682  155422    0    0    0     0          0         0 749887875  530054    0    0    0     0       0          0
veth6872395:  617459    7826    0    0    0     0          0         0  2635414   14773    0    0    0     0       0          0
vethc02ab36:       0       0    0    0    0     0          0         0   644158    3162    0    0    0     0       0          0

But bashtop reports this:

image

I cannot find any issue with accessing /proc/net/dev nor am I running sandboxed. As I say, it occasionally works but not always.

eth1 currently seems to be working.

aristocratos commented 4 years ago

Not really sure how to debug this, since it's not crashing and there is nothing showing in the error log it doesn't point to being an error caused by bashtop. It rather looks like it fails to read /proc/net/dev which would indicate it being locked at times for some reason.

Is there any difference if you switch to psutil data collection?

turkeyphant commented 4 years ago

I just tried and when attempting to change to psutil it reloads and sticks with "use psutil" false.

aristocratos commented 4 years ago

You need python 3.6 or greater and psutil module. Can be installed with pyton3 -m pip install psutil.

turkeyphant commented 4 years ago

Is there any difference if you switch to psutil data collection?

That seems to work:

image

pbulteel commented 4 years ago

I too had to switch to psutil - one thing I noticed, if I started it with sudo the info displayed correctly (with psutil set to false. FYI - I'm running it as a snap.