initial commit

initial commit of all files
This commit is contained in:
Paul M 2021-05-03 22:08:55 -05:00
parent 748012f50a
commit a1bcd8e0a3
23 changed files with 13925 additions and 0 deletions

18
Bash/OpenWrt/band.bash Normal file
View file

@ -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 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";

View file

@ -0,0 +1,14 @@
#!/bin/bash
# step two of my revised band width monitoring system
# First script runs on openwrt, queries vnstat, crunches a number or two
# and then sends it to syslog, which then sends it to a remote server
# said remote server a RPI runs this code to make the result web accessible
# note log contains a weeks worth of hourly bandwidth logs and we need the most recent
# only
vndat=`cat /var/log/openwrt.log | grep "root: dom" | tail -n 1`;
echo "$vndat" > /var/www/html/bnd.dat;
# echo "$vndat";