Open paulo-erichsen opened 3 years ago
Thanks for the feature request. I think this is something that should be possible to implement. Currently the main limiting factor is the implementation of the configuration file reader which doesn't support per interface configurations on a generic level. There's also the MonthRotateAffectsYears
setting in the configuration of which I'm not sure if it too should be then be interface specific or not.
Since this obviously isn't going to happen here's a script to get the total since some time.
begin=$( date -d "2024-06-01" +%s )
mb=$( vnstat -i hp --json | jq -r ".interfaces[0].traffic.fiveminute" | jq ".[] | select( .timestamp >= $begin ) | {\"t\": [.rx, .tx] | add}" | jq '[.t] | add' |
paste -sd+ | bc | xargs -i echo "scale=0;{}/(1024*1024)" | bc )
Or maybe not
# vnstat -i hp --json d | jq -r ".interfaces[0].traffic.day" | jq ".[] | select( .timestamp >= $begin ) | {\"t\": [.rx, .tx] | add}" | jq '[.t] | add' | past
e -sd+ | bc | xargs -i echo "scale=2;{}/(1024*1024)" | bc
769.40
# vnstat -i hp --json | jq -r ".interfaces[0].traffic.fiveminute" | jq ".[] | select( .timestamp >= $begin ) | {\"t\": [.rx, .tx] | add}" | jq '[.t] | add' | paste -sd+ | bc | xargs -i echo "scale=2;{}/(1024*1024)" | bc
260.49
#
description
this is a feature request for vnstat to allow keeping track of billing cycle usage for different interfaces that start on different days
can we make the MonthRotate option to be set on a per interface basis?
description for MonthRotate from vnstat.conf(5)
use case
say I have different ISPs on different interfaces, or for example one interface could be a cellular connection while the other interface using a different ISP. I'd like to easily be able to get the monthly usage for both interfaces even though their billing cycles are different
example: