I use vnstat to keep track of network traffic on my NAS, because it is dead simple and does just what need.
However I am noticing that in some instances it doesn’t count traffic correctly.
For example I just copied an 11 GB folder and that does not get reflected (please, I know it’s not immediate, there’s a delay of 5-10 min) and I got no traffic.
The other day I copied 17 GB and I see 4 GB.
It might be relevant that I have 2 interfaces - my internet connection, and a direct connection to my main computer. Tracking the internet-connected interface seems to work well, but picking up any stats on the direct connection appears to be completely random!
If I use vnstat -l I can see the traffic I generate, but it doesn’t seem to get recorded. Could this be a bug in vnstat? Or user error?
For one, I don’t want any merged stats. And that is just presentation anyway, the database is keeping separate track.
TBH none of the above was helpful.
But!
I accidentally ran systemctl status and whaddya know!
Dec 03 09:48:40 martixy-nas vnstatd[905]: Info: Traffic rate for "enp4s0" higher than set maximum 1000 Mbit (20s->2673868800, r3945290954 t9431523, 64bit:1), syncing.
Then I went looking into /etc/vnstat.conf and found this parameter: MaxBandwidth
Maximum bandwidth for all interfaces. If the counted traffic exceeds the given value then the data is assumed to be invalid and rejected. Set to 0 in order to disable the feature. (vnstat and vnstatd only)
…and the silly and in no way reasonable in 2024 default of 1000 mbit.
(The direct link is 2500 mbit.)
Change that, restart service, and now it all works.