API status: Netin and Netout

ferdl9999

Renowned Member
Nov 7, 2015
52
0
73
Hello,

I want to get the current bandwidth (inbound and outbound) used from a lxc container or a qemu machine via the API.

Using /nodes/{node}/{lxc,qemu}/{vmid}/status/current, I get the following JSON response:
Code:
{"template":"","swap":16384,"cpus":1,"vmid":"289","diskread":252493824,"maxswap":536870912,"cpu":0,"pid":"43800","netout":292461914,"type":"lxc","uptime":50344,"disk":"953860096","mem":45690880,"maxdisk":"15786254336","name":"vm289","ha":{"managed":0},"lock":"","diskwrite":14807040,"maxmem":1073741824,"status":"running","netin":7963775145}

Which unit does these values for netout and netin have?
Is this currently completely implemented? Because it's not documented in the Proxmox API: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc/{vmid}/status/current

I've also noticed that when I use pvesh get /nodes/{node}/lxc/{id}/status/current, I don't get values for netin and netout.
But when I use pvesh get /nodes/{node}/lxc/{id}/status/current --output-format json, I get values for netin and netout.

Are these values right? Or is this feature not yet completely implemented?
Which unit does these values have? Bits or bytes per second isn't possible


Thank you for your help

Best Regards
 
hi,

the values are in byte. it's the total in/out count.
pvesh get /nodes/{node}/lxc/{id}/status/current, I don't get values for netin and netout.
add --output-format pretty-json or json to see it.
 
Hi,

thank you, I didn't thought that it was the total value.

Is it possible to get the current traffic via the API (maybe in Bits/s)?