Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How do you caculat how many bandwidth traffic a VM used, with Proxmox & KVM.
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How do you caculat how many bandwidth traffic a VM used, with Proxmox & KVM.

dnwkdnwk Member

So, on KVM, If I only have Proxmox and native KVM tool, how do I calculate the total transfer of a VM?

Comments

  • Please apply palm to face. That's JUST a graphing and database tool. You have to stick data in in the first place, which is what OP is looking for.

    said: So, on KVM, If I only have Proxmox and native KVM tool, how do I calculate the total transfer of a VM?

    Use something like vnstat. It'll grab the bandwidth utilization of all interfaces once every so often and save that number. Since KVM uses a network interface for each VM, that'll make it extra easy.

  • marcmmarcm Member

    Rallias said: Please apply palm to face.

    image

  • dnwkdnwk Member

    @Rallias said:
    Use something like vnstat. It'll grab the bandwidth utilization of all interfaces once every so often and save that number. Since KVM uses a network interface for each VM, that'll make it extra easy.

    Showing the bandwidth utilization only tell you the current throughput. How do I calculate the monthly acculturation? The a snapshot every second? It probably take a lot of CPU

  • dnwk said: Showing the bandwidth utilization only tell you the current throughput. How do I calculate the monthly acculturation? The a snapshot every second? It probably take a lot of CPU

    What vnstat does is take the bandwidth of each interface once each 5 minutes. You can extract this data with vnstat command easily, and doesn't use that much CPU.

    For example,

    ~
    ❯ vnstat -m                                               rallias@fortress-gate
    
     eth0  /  monthly
    
       month        rx      |     tx      |    total    |   avg. rate
    ------------------------+-------------+-------------+---------------
      Jan '14      6.18 GiB |    1.17 GiB |    7.35 GiB |   23.02 kbit/s
      Feb '14    100.03 GiB |    7.83 GiB |  107.86 GiB |  374.02 kbit/s
      Mar '14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated        --     |      --     |      --     |
    
    ~
    ❯ vnstat -d                                               rallias@fortress-gate
    
     eth0  /  daily
    
         day         rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
      02/01/14      3.27 GiB |  446.00 MiB |    3.70 GiB |  359.56 kbit/s
      02/02/14     18.23 GiB |  566.09 MiB |   18.78 GiB |    1.82 Mbit/s
      02/03/14      1.60 GiB |  411.05 MiB |    2.00 GiB |  194.19 kbit/s
      02/04/14      1.14 GiB |  207.59 MiB |    1.34 GiB |  130.21 kbit/s
      02/05/14      4.92 GiB |  347.53 MiB |    5.26 GiB |  510.57 kbit/s
      02/06/14      1.91 GiB |  271.68 MiB |    2.17 GiB |  210.73 kbit/s
      02/07/14      3.11 GiB |  855.05 MiB |    3.94 GiB |  382.70 kbit/s
      02/08/14      2.05 GiB |  297.69 MiB |    2.34 GiB |  227.08 kbit/s
      02/09/14     10.30 GiB |  557.55 MiB |   10.84 GiB |    1.05 Mbit/s
      02/10/14      4.83 GiB |  445.96 MiB |    5.27 GiB |  511.37 kbit/s
      02/11/14      3.97 GiB |  250.21 MiB |    4.22 GiB |  409.50 kbit/s
      02/12/14     11.04 GiB |  453.54 MiB |   11.48 GiB |    1.11 Mbit/s
      02/13/14      3.95 GiB |  605.89 MiB |    4.54 GiB |  440.58 kbit/s
      02/14/14      7.61 GiB |  793.64 MiB |    8.39 GiB |  814.43 kbit/s
      02/15/14     18.11 GiB |    1.07 GiB |   19.18 GiB |    1.86 Mbit/s
      02/16/14      2.94 GiB |  308.34 MiB |    3.24 GiB |  314.52 kbit/s
      02/17/14      1.08 GiB |  103.87 MiB |    1.18 GiB |  114.49 kbit/s
      02/18/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/19/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/20/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/21/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/22/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/23/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/24/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/25/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/26/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/27/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      02/28/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      03/01/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
      03/02/14         0 KiB |       0 KiB |       0 KiB |    0.00 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated        --     |      --     |      --     |
    
  • dnwkdnwk Member

    @Rallias said:

    So, it tells you eth0. How do you know which VM used it?

  • skagerrakskagerrak Member
    edited March 2014

    @dnwk said:
    So, on KVM, If I only have Proxmox and native KVM tool, how do I calculate the total transfer of a VM?

    You could do traffic accounting on the node using IPTables: 1, 2, 3.

  • dnwkdnwk Member

    @skagerrak said:

    Great

  • dnwk said: So, it tells you eth0. How do you know which VM used it?

    Find what interface goes to what VM and attach the -i $interface option.

  • Will otal bandwidth be zero if the guest reinstalled ??

  • MaouniqueMaounique Host Rep, Veteran

    You can be piping it through another VM and to traffic accounting there per IP. There are specialized tools for this that work out of the box. You could also do this on the router or switch, depending on your config. Own solution to do the accounting on the node could work, however, you must make sure you commit the changes and there are no pitfalls that could reset the counting. I would keep stats per day and write them to disk, for example.

  • We using proxmox too and it is not easy to grep the traffic correctly from proxmox. It has same bugs like spikes into the PB area and do not reset the traffic after the VM was deleted. Both bugs are submitted to proxmox and confirmed, but not fixed. We changed the calculation way and grep the traffic directly on the routers for each ip address.

  • dnwkdnwk Member

    @fileMEDIA said:
    We using proxmox too and it is not easy to grep the traffic correctly from proxmox. It has same bugs like spikes into the PB area and do not reset the traffic after the VM was deleted. Both bugs are submitted to proxmox and confirmed, but not fixed. We changed the calculation way and grep the traffic directly on the routers for each ip address.

    So, do you have any temporary solution?

  • Yes grep the traffic directly from your router for each ip address.

  • dnwkdnwk Member

    @fileMEDIA said:
    Yes grep the traffic directly from your router for each ip address.

    em... I don't have a router. Probably setup some software router. Any recommendation?

  • @dnwk said:
    em... I don't have a router. Probably setup some software router. Any recommendation?

    pfsense.

  • dnwkdnwk Member

    @TheHackBox said:
    pfsense.

    So, are you doing 1-to-1 nat? If I am still using my provider's router, how do I have pfsense co-exist? Any tutorials?

  • Your provider must route the ip subnets to the router's ip address and it route it into your networks. But without any own router it isn't the best solution and you need to separate networks.

    You can try to grep the traffic from the tap interfaces on the proxmox hosts too.

  • dnwkdnwk Member

    @fileMEDIA said:
    Your provider must route the ip subnets to the router's ip address and it route it into your networks. But without any own router it isn't the best solution and you need to separate networks.

    You can try to grep the traffic from the tap interfaces on the proxmox hosts too.

    Do you think 1-to-1 NAT would work?

  • Talk to your DC if is possible. That's nothing we can check here.
    Other way, try it.

  • dnwkdnwk Member

    @fileMEDIA said:
    Talk to your DC if is possible. That's nothing we can check here.
    Other way, try it.

    Yes. I talked to DC and find out that my colo plan including unlimited bandwidth. So, I think I don't really need to care about how many bandwidth user use.

Sign In or Register to comment.