0

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?

1

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.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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