[SOLVED kinda]

I now know the cause of this. I have scrcpy, syncthing and KDE connect working in the background. So, if I upload something from one device to another, it gets treated as upload using data bandwidth and it gets counted, even if I am not uploading it to the internet.


vnstat won’t show me accurate data, it’s estimates for today are 1.66 times greater than what it should be. If the data usage is 6 GB, it would show me that it is 10GB, pretty inaccurate readings. Is there a way to fix this? Also, sometimes it’s 1.66 times and sometimes it more/less. It isn’t accurate is my point.

PS: I need it to be vnstat as I have a script which works on vnstat

But, if there is another better package, do tell me about it.

here is the script, (strictly not relevant)

#!/bin/bash
eleven=$(vnstat --json | jq --arg day "$(date +'%d')" --arg month "$(date +'%m')" '.interfaces[0].traffic.day[] | select(.date.day == ($day | tonumber) and .date.month == ($month | tonumber)) | (.rx + .tx)/ (1024*1024*1024)')
rounded_eleven=$(printf "%.2f" "$eleven")

echo " $rounded_eleven GB"

What are you comparing it to? I’m pretty sure vnstat is using the raw.interface counters. This would include all protocol overhead. I would expect it to be higher than, for example, an application level counter.

___

  • Subject6051OP
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    I now know the cause of this. I have scrcpy, syncthing and KDE connect working in the background. So, if I upload something from one device to another, it gets treated as upload using data bandwidth and it gets counted, even if I am not uploading it to the internet.

    The comparison is fair, but I thought vnstat only measured data bandwidth (i.e., which is used over the internet) but it’s counting file sharing too. So, the measurements are haywire.