Difference between revisions of "Virsh dommemstat"

From wikieduonline
Jump to navigation Jump to search
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
Get memory stats for a running domain.<ref>
+
{{lc}}<code>[[virsh]] dommemstat</code> get [[memory]] stats for a running domain/VM.
https://en.wikiversity.org/wiki/Draft:Virsh/virsh_dommemstat</ref>
+
* Doc: https://libvirt.org/sources/virshcmdref/html-single/#sect-dommemstat
<code>dommemstat domain [--period seconds] [[--config] [--live] | [--current]]</code><ref>https://rentry.co/bmpsn</ref>
 
  
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.
+
Syntax:
 +
* <code>[[virsh]] dommemstat DOMAIN_NAME [--period seconds] [[--config] [--live] | [--current]]</code><ref>https://rentry.co/bmpsn</ref>
  
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.
+
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 <code>[[libvirtd]]</code>.
 +
 
 +
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 11: Line 26:
 
Both <code>--live</code> and <code>--config</code> flags may be given, but <code>--current</code> is exclusive. If no flag is specified, behavior is different depending on the guest state.
 
Both <code>--live</code> and <code>--config</code> flags may be given, but <code>--current</code> is exclusive. If no flag is specified, behavior is different depending on the guest state.
  
Command:
+
== Examples ==
 
<pre>
 
<pre>
 
# virsh dommemstat YOUR_VM_NAME           
 
# virsh dommemstat YOUR_VM_NAME           
Line 44: 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 ==
* [[Virsh Memory Commands]]:  [[virsh dommemstat]], [[virsh setmem]]
+
* {{virsh memory commands}}
*[[KVM]]
+
* {{KVM}}
 +
 
 +
 
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:KVM]]
 
[[Category:KVM]]

Latest revision as of 09:16, 17 January 2024

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[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]

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


Related commands[edit]

See also[edit]

  • https://rentry.co/bmpsn
  • Advertising: