Tracking amount of sent/received data
Hello,
I'm looking for a way of logging and recovering the total amount of data sent and received for a network interface. The code I currently use resets after a certain period of time which is not desired. I'm looking for something that even after a reboot will tell me how much data has been received and sent on that interface since the server was first taken into use (i.e. from the time a solution was implemented). This is my current code Code:
echo $(/sbin/ifconfig eth1 | grep 'RX bytes' | head -n1 | awk '{print $3 $4}' | cut -d '(' -f2 | cut -d ')' -f1 Code:
echo $(/sbin/ifconfig eth1 | grep 'RX bytes' | head -n1 | awk '{print $7 $8}' | cut -d '(' -f2 | cut -d ')' -f1) |
Quote:
If you want a quick-and-dirty solution, fire up MySQL, define a database and table (very easy to do), and shovel those values into a table, say every minute or so. I.E:, under MySQL prompt, "create database NetworkStats;", "use NetworkStats;", "create table traffic (DateTime char(26), IF char(10), RX int, TX int);". Then your script can just append a mysql command-line insert, and shove a record in every time it runs. Use OpenOffice Spreadsheet or Excel to make an ODBC connection to it, for graphing, trending, etc. Can keep as much data as you've got disk space for. |
pv is a nice tool as well.
|
It looks like I will have to look into RRDTOOL which I have seen in use in other places. Does anyone happen to know a good basic tutorial on how to configure it?
It seems I need to define which interface to listen to somehwere, and prefferably the site should be accesible from outside of my network (even if the rest of my website server should). |
All times are GMT -5. The time now is 03:34 AM. |