bandmon/Bash/OpenWrt/band.bash
Paul M a1bcd8e0a3 initial commit
initial commit of all files
2021-05-03 22:08:55 -05:00

18 lines
569 B
Bash

#!/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 daily usage
vnmonthly=`vnstat -i $wif -d -s --oneline | awk -F\; '{print $11}'` # monthly total usage
logger "dom $md cm $cmd vnhourly $vnhourly vnmonthly $vnmonthly";