MilhouseVH / bcmstat

Simple Raspberry Pi monitoring tool
GNU General Public License v2.0
263 stars 36 forks source link

Support non-primary network interface? #23

Closed geerlingguy closed 2 years ago

geerlingguy commented 2 years ago

I'm doing some testing with a network card eth1 (not the built-in eth0 interface), and I'm seeing 0 for both RX B/s and TX B/s.

Here's my proc/net/dev:

$ cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:    5530      39    0    0    0     0          0         0     5530      39    0    0    0     0       0          0
  eth0: 10010025    7702    0    0    0     0          0       549   193967    1558    0    0    0     0       0          0
 wlan0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth1: 21375449369 17268488    0    0    0     0          0      1846 99991576856 66978432    0    0    0     0       0          0
geerlingguy commented 2 years ago

By editing https://github.com/MilhouseVH/bcmstat/blob/master/bcmstat.sh#L491, I could hack the change in...

---    if name.startswith("eth") or name.startswith("enxb827eb"):
+++     if name.startswith("eth1") or name.startswith("enxb827eb"):
geerlingguy commented 2 years ago

It might be nice to allow the interface to be specified since it looks like you may have also been testing with enxb827eb before. Like --iface eth1 and that just locks it into eth1.

MilhouseVH commented 2 years ago

Hi Jeff.

-ieth1 should work on the command line and allow you to use an alternative interface.

You can also set the default interface (and other properties) with, eg:

echo "ieth1 d1" > ~/.config/bcmstat.conf

Full help info available via bcmstat.sh -h.

Glad you find this script useful - love what you do! 👍

geerlingguy commented 2 years ago

Oh lol... could just look at help I guess. Closing this issue :)