As a continuation on my last post about the bandwidth usage on this server, I wanted to share with you something I had a hard time to find. To monitor my actual bandwidth usage on the server I searched for a long time without finding a simple enough application that could do what I wanted. So I did what every true code nerd does. I (probably) reinvented the wheel!
The script needs to be run periodically. I run it from as a cron job every five minutes and pipe stdout and stderr to a log file. The script outputs usage by the hour, day, week, month and year. It also shows some preliminary numbers.