Virsh dommemstat

From wikieduonline
Revision as of 07:05, 11 April 2021 by Welcome (talk | contribs)
Jump to navigation Jump to search

virsh dommemstat get memory stats for a running domain/VM.

Syntax:

  • virsh dommemstat DOMAIN_NAME [--period seconds] [[--config] [--live] | [--current]][1]

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

# 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

  1. Use virsh dommemstat to view memory assigned to your VM or virsh dominfo VM_MACHINE | grep memory


Related commands

See also

Advertising: