Although we decided to go the other route using MRTG on our switches, we did come across how to do it via SSH incase anyone in the future would like to do something similar. It is also the most accurate way to calculate bandwidth.
Tell IPtables what to do:
iptables -I INPUT ! -i lo; iptables -I OUTPUT ! -o lo
To reset the data, create a cron job that runs once a month with the following command:
iptables -R INPUT 1 ! -i lo; iptables -R OUTPUT 1 ! -o lo
Next create another cron job that runs regularly (recommended: every 30 minutes) to protect current data and chain incase a server needs to be rebooted
iptables-save -c > /etc/iptables
You can set the output file to any name you want (/etc/iptables)
In your rc.local, add:
iptables-restore -c < /etc/iptable
This will restore settings and data upon system boot.
To check the bandwidth you have used during the month:
iptables -L -v
You can set this up to output the data before it is reset once a month. You will want to look at the rule counters, NOT the chain counters.
Tada! Now you can check your bandwidth usage for the entire server.
Will post this later to How-To Guides section