KVM virsh domstats (guest statistics) example

domstats [--raw] [--enforce] [--backing] [--state] [--cpu-total] [--balloon] [--vcpu] [--interface] [--block] [--perf] [[--list-active] [--list-inactive] [--list-persistent] [--list-transient] [--list-running] [--list-paused] [--list-shutoff] [--list-other]] | [domain ...]

Get statistics for multiple or all domains. Without any argument this command prints all available statistics for all domains.

The list of domains to gather stats for can be either limited by listing the domains as a space separated list, or by specifying one of the filtering flags --list-*. (The approaches can't be combined.)

By default some of the returned fields may be converted to more human friendly values by a set of pretty-printers. To suppress this behavior use the --raw flag.

The individual statistics groups are selectable via specific flags. By default all supported statistics groups are returned. Supported statistics groups flags are: --state, --cpu-total, --balloon, --vcpu, --interface, --block, --perf.

Note that - depending on the hypervisor type and version or the domain state - not all of the following statistics may be returned.

--state group returns:

  • "state.state" - state of the VM, returned as number from virDomainState enum,
  • "state.reason" - reason for entering given state, returned as int from virDomain*Reason enum corresponding to given state.

--cpu-total returns:

  • "cpu.time" - total cpu time spent for this domain in nanoseconds,
  • "cpu.user" - user cpu time spent in nanoseconds,
  • "cpu.system" - system cpu time spent in nanoseconds

--balloon returns:

  • "balloon.current" - the memory in kiB currently used,
  • "balloon.maximum" - the maximum memory in kiB allowed,
  • "balloon.swap_in" - the amount of data read from swap space (in kB),
  • "balloon.swap_out" - the amount of memory written out to swap space (in kB),
  • "balloon.major_fault" - the number of page faults then disk IO was required,
  • "balloon.minor_fault" - the number of other page faults,
  • "balloon.unused" - the amount of memory left unused by the system (in kB),
  • "balloon.available" - the amount of usable memory as seen by the domain (in kB),
  • "balloon.rss" - Resident Set Size of running domain's process (in kB),
  • "balloon.usable" - the amount of memory which can be reclaimed by balloon without causing host swapping (in KB),
  • "balloon.last-update" - timestamp of the last update of statistics (in seconds)

--vcpu returns:

  • "vcpu.current" - current number of online virtual CPUs,
  • "vcpu.maximum" - maximum number of online virtual CPUs,
  • "vcpu.<num>.state" - state of the virtual CPU <num>, as number from virVcpuState enum,
  • "vcpu.<num>.time" - virtual cpu time spent by virtual CPU <num> (in microseconds),
  • "vcpu.<num>.wait" - virtual cpu time spent by virtual CPU <num> waiting on I/O (in microseconds),
  • "vcpu.<num>.halted" - virtual CPU <num> is halted: yes or no (may indicate the processor is idle or even disabled, depending on the architecture)

--interface returns:

  • "net.count" - number of network interfaces on this domain,
  • "net.<num>.name" - name of the interface <num>,
  • "net.<num>.rx.bytes" - number of bytes received,
  • "net.<num>.rx.pkts" - number of packets received,
  • "net.<num>.rx.errs" - number of receive errors,
  • "net.<num>.rx.drop" - number of receive packets dropped,
  • "net.<num>.tx.bytes" - number of bytes transmitted,
  • "net.<num>.tx.pkts" - number of packets transmitted,
  • "net.<num>.tx.errs" - number of transmission errors,
  • "net.<num>.tx.drop" - number of transmit packets dropped

--perf returns the statistics of all enabled perf events:

  • "perf.cmt" - the cache usage in Byte currently used,
  • "perf.mbmt" - total system bandwidth from one level of cache,
  • "perf.mbml" - bandwidth of memory traffic for a memory controller,
  • "perf.cpu_cycles" - the count of cpu cycles (total/elapsed),
  • "perf.instructions" - the count of instructions,
  • "perf.cache_references" - the count of cache hits,
  • "perf.cache_misses" - the count of caches misses,
  • "perf.branch_instructions" - the count of branch instructions,
  • "perf.branch_misses" - the count of branch misses,
  • "perf.bus_cycles" - the count of bus cycles,
  • "perf.stalled_cycles_frontend" - the count of stalled frontend cpu cycles,
  • "perf.stalled_cycles_backend" - the count of stalled backend cpu cycles,
  • "perf.ref_cpu_cycles" - the count of ref cpu cycles

See the perf command for more details about each event.

--block returns information about disks associated with each domain. Using the --backing flag extends this information to cover all resources in the backing chain, rather than the default of limiting information to the active layer for each guest disk. Information listed includes:

  • "block.count" - number of block devices being listed,
  • "block.<num>.name" - name of the target of the block device <num> (the same name for multiple entries if --backing is present),
  • "block.<num>.backingIndex" - when --backing is present, matches up with the <backingStore> index listed in domain XML for backing files,
  • "block.<num>.path" - file source of block device <num>, if it is a local file or block device,
  • "block.<num>.rd.reqs" - number of read requests,
  • "block.<num>.rd.bytes" - number of read bytes,
  • "block.<num>.rd.times" - total time (ns) spent on reads,
  • "block.<num>.wr.reqs" - number of write requests,
  • "block.<num>.wr.bytes" - number of written bytes,
  • "block.<num>.wr.times" - total time (ns) spent on writes,
  • "block.<num>.fl.reqs" - total flush requests,
  • "block.<num>.fl.times" - total time (ns) spent on cache flushing,
  • "block.<num>.errors" - Xen only: the 'oo_req' value,
  • "block.<num>.allocation" - offset of highest written sector in bytes,
  • "block.<num>.capacity" - logical size of source file in bytes,
  • "block.<num>.physical" - physical size of source file in bytes

Selecting a specific statistics groups doesn't guarantee that the daemon supports the selected group of stats. Flag --enforce forces the command to fail if the daemon doesn't support the selected group.

# virsh domstats fedora-27
Domain: 'fedora-27'
  state.state=1 
  state.reason=1
  cpu.time=208051093872
  cpu.user=37040000000
  cpu.system=121270000000
  balloon.current=1048576
  balloon.maximum=1048576
  balloon.swap_in=0
  balloon.swap_out=0
  balloon.major_fault=913
  balloon.minor_fault=247449
  balloon.unused=694704
  balloon.available=1014852
  balloon.usable=732936
  balloon.last-update=1514452854
  balloon.rss=725496
  vcpu.current=3
  vcpu.maximum=4
  vcpu.0.state=1
  vcpu.0.time=63200000000
  vcpu.0.wait=0
  vcpu.0.halted=yes
  vcpu.1.state=1
  vcpu.1.time=28310000000
  vcpu.1.wait=0
  vcpu.1.halted=yes
  vcpu.2.state=1
  vcpu.2.time=35100000000
  vcpu.2.wait=0
  vcpu.2.halted=yes
  net.count=1
  net.0.name=vnet0
  net.0.rx.bytes=17026052
  net.0.rx.pkts=28622
  net.0.rx.errs=0
  net.0.rx.drop=0
  net.0.tx.bytes=483066
  net.0.tx.pkts=7044
  net.0.tx.errs=0
  net.0.tx.drop=0
  block.count=2
  block.0.name=vda
  block.0.path=/home/user/.vms/fedora-27
  block.0.rd.reqs=11011
  block.0.rd.bytes=270762496
  block.0.rd.times=744910292
  block.0.wr.reqs=3420
  block.0.wr.bytes=112903680
  block.0.wr.times=1749476447
  block.0.fl.reqs=624
  block.0.fl.times=2277337440
  block.0.allocation=16894132224
  block.0.capacity=16106127360
  block.0.physical=2458574848
  block.1.name=hda
  block.1.rd.reqs=4
  block.1.rd.bytes=152
  block.1.rd.times=50637
  block.1.wr.reqs=0
  block.1.wr.bytes=0
  block.1.wr.times=0
  block.1.fl.reqs=0
  block.1.fl.times=0
  block.1.allocation=0
  block.1.physical=0
Edit

Pub: 28 Dec 2017 18:49 UTC

Edit: 28 Dec 2017 19:04 UTC

Views: 3073