如果KVM VM监视器没有可用数据,首先要做的事情

如果KVM VM监视器没有可用数据,首先要做的事情

在KVM中,所有数据都是通过CLI命令收集的。因此如果在UI中没有正确检索到任何数据,我们可以通过执行CLI命令来检查它。

下表包含用于KVM VM监视器下存在的每个指标的CLI命令列表:

属性
命令行命令
输出
CPU:
$ virsh cpu-stats --total
test@APM-KVM-U1:~$ virsh cpu-stats --total centos7.0
Total:
        cpu_time 2089.714823565 秒
        user_time 104.750000000 秒
        system_time 330.430000000 秒
CPU利用率

Value of cpu_time
用户

Value of user_time
系统

Value of system_time
内存:
virsh dommemstat <VMname>
virsh dommemstat centos7.0 —period 10 —live

上述命令用于启用指标

test@APM-KVM-U1:~$ virsh dommemstat centos7.0
actual 4194304
swap_in 0
swap_out 0
major_fault 1424
minor_fault 19368780
unused 2776976
available 3882420
last_update 1544636808
rss 1567572
调用内存


从交换中读取

Value of swap_in
写入交换

Value of swap_out
磁盘I/O错误计数

Value of Major_fault
页错误计数

Value of minor_fault
RSS内存

Value of rss
总内存
$ sudo virsh dominfo APM-C764-5
Value of MaxMemory
已用内存
$ sudo virsh dominfo APM-C764-5
Value of UsedMemory
空闲内存

Max Memory - Used Memory
内存利用率


磁盘详细信息:
$virsh domblklist --details
$virsh domblklist --details <VMname> | grep 'disk'
$virsh domblkinfo <VM_Name> <Block_devName>
virt-df
test@APM-KVM-U1:~$ virsh domblklist centos7.0
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/centos7.0.qcow2
hda        -

test@APM-KVM-U1:~$ virsh domblkinfo centos7.0 vda
Capacity:       107374182400
Allocation:     5553049600
Physical:       107390828544
名称

Value of Target
来源

Value of Source
容量

Value of Capacity
已使用的

Value of Allocation
空闲的

Capacity-Allocation
磁盘 I/O 详细信息:
$virsh domblkstat <VMname> <diskName> --human
test@APM-KVM-U1:~$ virsh domblkstat centos7.0 vda --human
Device: vda
 number of read operations:      19405
 number of bytes read:           541752832
 number of write operations:     4209
 number of bytes written:        31960576
 number of flush operations:     651
 total duration of reads (ns):   1047787890
 total duration of writes (ns):  94970385161
 total duration of flushes (ns): 140993649
名称

Value of 'Device'
读操作

Value of 'number of read operations'
写操作

Value of 'number of write operations'
接收的字节数

Value of 'number of bytes read'
传输的字节数

Value of 'number of bytes written'
读取所需的时间

Value of ' total duration of reads (ns)'
写入所需的时间

Value of ' total duration of writes (ns)'
网络接口:
$ virsh domiflist <VMName>
[test@APM-KVM-C7-1 ~]$ virsh domiflist APM-U18-3
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet1      bridge     br0        rtl8139     52:54:00:b7:a5:f8
名称

Value of ' Interface'
类型

Value of ' Type'
来源

Value of ' Source'
模型

Value of ' Model'
MAC地址

Value of ' MAC'
网络接口利用率:
$ virsh domifstat <VMName> <InterfaceName>
test@APM-KVM-U1:~$ virsh domifstat centos7.0 vnet0
vnet0 rx_bytes 54127329
vnet0 rx_packets 450484
vnet0 rx_errs 0
vnet0 rx_drop 1066
vnet0 tx_bytes 47532
vnet0 tx_packets 352
vnet0 tx_errs 0
vnet0 tx_drop 0s
接口名称


接收字节数

Value of rx_bytes
收到的数据包

Value of rx_packets
传输的字节

Value of tx_bytes
传输的数据包

Value of tx_packets
配置:
$ virsh dominfo <VMName>
test@APM-KVM-U1:~$ virsh dominfo centos7.0
Id:             11
Name:           centos7.0
UUID:           684b1cd4-0969-4683-8134-e9ca021a7601
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       128.8s
Max memory:     4194304 KiB
Used memory:    4194304 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: apparmor
Security DOI:   0
Security label: libvirt-684b1cd4-0969-4683-8134-e9ca021a7601 (enforcing
ID

Value of Id
名称

Value of Name
IP地址


UUID

Value of UUID
操作系统类型

Value of OS Type
已安装的操作系统


状态

Value of State
CPU(s)

Value of CPU(s)
自动启动

Value of Autostart