Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What is a a good way to track over time the amount of data transferred from my ubuntu machine to another host on the internet?

share|improve this question
add comment

1 Answer

That greatly depends on how you transfer it. If you have some sort of a VPN, then vnstat can track traffic per interface. These are for example monthly statistics from a VPN I'm using:

# vnstat -m -i tun0

 tun0  /  monthly

       month        rx      |     tx      |    total    |   avg. rate
    ------------------------+-------------+-------------+---------------
      Sep '12     26.36 GiB |  894.47 MiB |   27.23 GiB |   88.12 kbit/s
      Oct '12     49.80 GiB |    1.90 GiB |   51.70 GiB |  161.92 kbit/s
      Nov '12     25.93 GiB |    1.20 GiB |   27.12 GiB |   87.78 kbit/s
      Dec '12     27.64 GiB |    1.24 GiB |   28.88 GiB |   90.46 kbit/s
      Jan '13     17.11 GiB |  745.23 MiB |   17.83 GiB |  125.83 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated     38.54 GiB |    1.64 GiB |   40.17 GiB |
    ------------------------+-------------+-------------+---------------

Of course, this is per network interface, not per host. vnstat can be configured to keep a persistent database (flat files).

Another way would be to set up a forward rule in iptables and read iptables traffic statistics (iptables -nv).

But a proper solution would be to use dedicated software with traffic accounting. DrFTPD has a quota plugin.

share|improve this answer
    
some of it is http(s) traffic and some of it is imaps traffic. i don't think DrFTP plugin will help in my case :) –  Saqib Ali Feb 2 '13 at 2:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.