I wrote a script to give me an overview about my internet-volume-usage.
dependencies: cat, grep, sed, tr, echo, bc, revCode:!/bin/bash # # Usage : $0 Jun # # (c) Stefan Wagner 2004 - feel free to use, update or delete # function usage () { echo Usage : $0 MONTH echo Example : $0 Jun } function msgexit () { echo $1 exit $2 } if [ $# -ne 1 ] ; then usage exit 2 fi # file=/var/log/pppstatus/pppstatus.ppp0.$1-2004.log # [ -f $file ] || msgexit "file not found: $file" 1 bytes=$(cat $file | grep 'RX Bytes:' | sed 's/.*RX Bytes: //g' | sed 's/RX Err.*//g') # echo "by:" $bytes equation=$(echo $bytes | tr ' ' '+' | sed 's/ *+/+/g;s/+$//g') # echo "eq:" $equation echo -n "sum=" zahl=$( echo "$equation" | bc) echo $zahl | rev | sed 's/\([0-9]\{3\}\)/\1./g' | rev | sed 's/^\.//'
problems:
- My account isn't measured by calendarian months, but from 20.x to 19.x+1
- In year 2005, 06, 07 ... you have to update the script.
- It evaluates only the downstream, not upstream
- no errorhandling
- Information isn't valid, if account is used from several computers/ installations.
- For US-Numberformat you have to replace '.' in the last line by ','.
goals: Gives a rough overview about monthly traffic, is easy to adopted for comming years, easy in usage and formats it's output in good readable way (Summe=1.345.367.245).
How it works: The logfile is searched for the 'RX: ....' - pattern, everything around is stripped off.
The numbers are transformed to an equation, which is passed to bc, (the commandline calculator) and the result formatted for better human readability.
Feedback is welcome.

SFP TO RJ45 TRANSCEIVER SFP MODULE COPPER SFP OPTICAL PORT TO RJ45 ETHERNET PORT
$7.99
Dell Intel X710-DA2 5N7Y5 Dual-Port 10GbE SFP+ PCIe 3.0 x8 Network Adapter
$27.50
NEW Sealed Cisco SFP-10G-LR 10GBASE-LR SFP+ 1310nm 10km *US Shipping*
$24.00
New Sealed Cisco GLC-LH-SMD 1000BASE-LX/LH SFP Transceiver Module *US
$17.00
Genuine Cisco SFP-10G-SR 0-2415-03 10 Gigabit Transceiver
$5.40
HP 560SFP+ 10GB 2-port PCIe NIC Ethernet ADAPTER 669279-001 w/ (2) 10GB SFP+
$16.99
Intel X520-DA2 10Gb 10Gbe 10 Gigabit Network Adapter NIC Dual Port E10G42BTDA
$28.94
Cisco 10G SFP+ 850nm P/N: SFP-10G-SR (10-2415-03) *NEW SEALED
$25.00
Cisco Acacia DP04QSDD-E25-840 400G QSFP-DD Coherent DCO Transceiver Module
$699.99
Cisco QSFP-40G-SR-BD Module 10-2945-02 NEW CLAMSHELL
$45.50