From 1417d71d7c208a7875fbea578561ea98143c5e10 Mon Sep 17 00:00:00 2001 From: kake26 Date: Sat, 25 Sep 2021 23:58:04 +0200 Subject: [PATCH] band.bash added Bandwidth usage reporting tool. --- band.bash | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 band.bash diff --git a/band.bash b/band.bash new file mode 100644 index 0000000..bde4b48 --- /dev/null +++ b/band.bash @@ -0,0 +1,18 @@ +#!/bin/bash + +# Requires vnstat to be running on target system + +# initial values +mtotal=1000 # monthly total in GB for high end cut off +dmax=40 # daily max usage value +md=`date +%d` # day of the month numerically +cmd=$(($dmax * $md)) # computed max daily +wif="eth1.2" + +# now vnstat stuff, some of this is specific to openwrt + +vnhourly=`vnstat -i $wif -d -s --oneline | awk -F\; '{print $6}'` # total monthly usage +vnmonthly=`vnstat -i $wif -d -s --oneline | awk -F\; '{print $11}'` # daily total usage + + +logger "dom $md cm $cmd vnhourly $vnhourly vnmonthly $vnmonthly";