Difference between revisions of "Virsh dommemstat"
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <code>[[virsh]] dommemstat</code> get [[memory]] stats for a running domain/VM. | + | {{lc}}<code>[[virsh]] dommemstat</code> get [[memory]] stats for a running domain/VM. |
* Doc: https://libvirt.org/sources/virshcmdref/html-single/#sect-dommemstat | * Doc: https://libvirt.org/sources/virshcmdref/html-single/#sect-dommemstat | ||
Syntax: | Syntax: | ||
− | * <code>virsh dommemstat DOMAIN_NAME [--period seconds] [[--config] [--live] | [--current]]</code><ref>https://rentry.co/bmpsn</ref> | + | * <code>[[virsh]] dommemstat DOMAIN_NAME [--period seconds] [[--config] [--live] | [--current]]</code><ref>https://rentry.co/bmpsn</ref> |
− | + | Example: | |
− | # virsh dommemstat YOUR_VM_NAME | + | # virsh dommemstat YOUR_VM_NAME |
− | actual 1048576 | + | actual 1048576 |
− | swap_in 0 | + | [[swap_in]] 0 |
− | swap_out 0 | + | swap_out 0 |
− | major_fault 913 | + | [[major_fault]] 913 |
− | minor_fault 247449 | + | [[minor_fault]] 247449 |
− | unused 694704 | + | unused 694704 |
− | available 1014852 | + | available 1014852 |
− | usable 732936 | + | usable 732936 |
− | last_update 1514452854 | + | last_update 1514452854 |
− | rss 537524 | + | [[rss]] 537524 |
− | |||
Availability of these fields depends on [[hypervisor]]. Unsupported fields are missing from the output. Other fields may appear if communicating with a newer version of <code>[[libvirtd]]</code>. | Availability of these fields depends on [[hypervisor]]. Unsupported fields are missing from the output. Other fields may appear if communicating with a newer version of <code>[[libvirtd]]</code>. | ||
− | For [[QEMU]]/KVM with a [[memory balloon]], setting the optional --period to a value larger than 0 in seconds will allow the balloon driver to return additional statistics which will be displayed by subsequent <code>dommemstat</code> commands. Setting the <code>--period</code> to 0 will stop the balloon driver collection, but does not clear the statistics in the balloon driver. Requires at least [[QEMU]]/[[KVM]] 1.5 to be running on the host. | + | For [[QEMU]]/[[KVM]] with a [[memory balloon]], setting the optional <code>--period</code> to a value larger than 0 in seconds will allow the balloon driver to return additional statistics which will be displayed by subsequent <code>dommemstat</code> commands. Setting the <code>--period</code> to 0 will stop the balloon driver collection, but does not clear the statistics in the balloon driver. Requires at least [[QEMU]]/[[KVM]] 1.5 to be running on the host. |
The <code>--live</code>, <code>--config</code>, and <code>--current</code> flags are only valid when using the <code>--period</code> option in order to set the collection period for the balloon driver. If <code>--live</code> is specified, only the running guest collection period is affected. If <code>--config</code> is specified, affect the next boot of a persistent guest. If <code>--current</code> is specified, affect the current guest state. | The <code>--live</code>, <code>--config</code>, and <code>--current</code> flags are only valid when using the <code>--period</code> option in order to set the collection period for the balloon driver. If <code>--live</code> is specified, only the running guest collection period is affected. If <code>--config</code> is specified, affect the next boot of a persistent guest. If <code>--current</code> is specified, affect the current guest state. | ||
Line 60: | Line 59: | ||
== Activities == | == Activities == | ||
# Use <code>virsh dommemstat</code> to view memory assigned to your VM or <code>[[virsh dominfo]] VM_MACHINE | grep memory</code> | # Use <code>virsh dommemstat</code> to view memory assigned to your VM or <code>[[virsh dominfo]] VM_MACHINE | grep memory</code> | ||
+ | |||
+ | |||
+ | == Related commands == | ||
+ | * <code>[[virsh domstats]]</code> | ||
+ | * <code>[[virsh dominfo]]</code> | ||
+ | * [[virsh domstats --memory]] ([[Libvirt release notes|Added in v6.0.0 (2020-01-15)]]) | ||
+ | * [[Virt-top]] | ||
== See also == | == See also == |
Latest revision as of 09:16, 17 January 2024
virsh dommemstat
get memory stats for a running domain/VM.
Syntax:
Example:
# virsh dommemstat YOUR_VM_NAME actual 1048576 swap_in 0 swap_out 0 major_fault 913 minor_fault 247449 unused 694704 available 1014852 usable 732936 last_update 1514452854 rss 537524
Availability of these fields depends on hypervisor. Unsupported fields are missing from the output. Other fields may appear if communicating with a newer version of libvirtd
.
For QEMU/KVM with a memory balloon, setting the optional --period
to a value larger than 0 in seconds will allow the balloon driver to return additional statistics which will be displayed by subsequent dommemstat
commands. Setting the --period
to 0 will stop the balloon driver collection, but does not clear the statistics in the balloon driver. Requires at least QEMU/KVM 1.5 to be running on the host.
The --live
, --config
, and --current
flags are only valid when using the --period
option in order to set the collection period for the balloon driver. If --live
is specified, only the running guest collection period is affected. If --config
is specified, affect the next boot of a persistent guest. If --current
is specified, affect the current guest state.
Both --live
and --config
flags may be given, but --current
is exclusive. If no flag is specified, behavior is different depending on the guest state.
Examples[edit]
# virsh dommemstat YOUR_VM_NAME actual 1048576 swap_in 0 swap_out 0 major_fault 913 minor_fault 247449 unused 694704 available 1014852 usable 732936 last_update 1514452854 rss 537524
Output explained:
# virsh dommemstat YOUR_VM_NAME actual 1048576 # Current balloon value (in KB) swap_in 0 # The amount of data read from swap space (in kB) swap_out 0 # The amount of memory written out to swap space (in kB) major_fault 913 # The number of page faults where disk IO was required minor_fault 247449 # The number of other page faults unused 694704 # The amount of memory left unused by the system (in kB) available 1014852 # The amount of usable memory as seen by the domain (in kB) usable 732936 # The amount of memory which can be reclaimed by balloon without causing host swapping (in KB) * last_update 1514452854 # Timestamp of the last update of statistics (in seconds) rss 537524 # Resident Set Size of the running domain's process (in kB)
Activities[edit]
- Use
virsh dommemstat
to view memory assigned to your VM orvirsh dominfo VM_MACHINE | grep memory
Related commands[edit]
See also[edit]
- virsh Memory Commands:
virsh setmaxmem
,virsh setmem
,virsh dommemstat
- KVM, Installation, QEMU,
virsh
,virtinst
,libguestfs-tools
, libvirt, qemu, Red Hat Virtualization (RHV), MacVTap, Virtio, oVirt, KVM services, KVM networking, KVM graphics, CPU, KVM on ARM
Advertising: