In OpenVZ, you can view the current network traffic statistics for virtual machines and containers using the vznetstat
utility. For example:
# vznetstat
UUID Net.Class Input(bytes) Input(pkts) Output(bytes) Output(pkts)
0 0 566093064 2800575 3120481 41736
47406484... 0 67489 155 8033 110
fbb30afa-... 0 9369 78 12692 71
By default, vznetstat
shows network statistics for both virtual machines and containers. Keep in mind that the vznetstat
utility displays statistics only about virtual machines and containers that were started at least once.
The vznetstat
utility displays the following information:
Column | Description |
---|---|
UUID | UUID assigned to virtual machine or container. |
Net.Class | ID of the network class for which network statistics is calculated. |
Input(bytes) | Amount of incoming traffic, in bytes. |
Input(pkts) | Amount of incoming traffic, in packets. |
Output(bytes) | Amount of outgoing traffic, in bytes. |
Output(pkts) | Amount of outgoing traffic, in packets. |
For example, from the command output above, you can see that around 9 MB of data were uploaded to the container MyCT
, (2) about 12 MB were downloaded from it, and all the traffic was exchanged with servers from class 0 networks.
If necessary, you can view network traffic statistics separately for virtual machine or container by passing the -t
option to vznetstat
:
-
For containers only:
# vznetstat -t ct CTID Net.Class Input(bytes) Input(pkts) Output(bytes) Output(pkts) 0 0 566093064 2800575 3120481 41736 fbb30afa-... 0 9369 78 12692 71
-
For virtual machines only:
# vznetstat -t vm UUID Net.Class Input(bytes) Input(pkts) Output(bytes) Output(pkts) 0 0 566093064 2800575 3120481 41736 47406484... 0 67489 155 8033 110
You can also view network statistics for a particular virtual machine or container by specifying its ID after the -v
option, for example:
# vznetstat -v fbb30afa-e770-4081-9d9e-6b9c262eb091
UUID Net.Class Input(bytes) Input(pkts) Output(bytes) Output(pkts)
fbb30afa-... 0 9369 78 12692 71
This command displays statistics only for the container MyCT
.