'top'-like utility for virtualization stats
virt-top [-options]
virt-top is a top\|(1)-like utility for showing stats of virtualized domains. Many keys and command line options are the same as for ordinary top.
It uses libvirt so it is capable of showing stats across a variety of different virtualization systems.
Display physical CPUs by default (instead of domains). When virt-top is running, use the 1 key to toggle between physical CPUs and domains display.
Display network interfaces by default (instead of domains). When virt-top is running, use the 2 key to toggle between network interfaces and domains display.
Display block devices (virtual disks) by default (instead of domains). When virt-top is running, use the 3 key to toggle between block devices and domains display.
Batch mode. In this mode keypresses are ignored.
Connect to the libvirt \s-1URI\s0 given. To connect to \s-1QEMU/KVM\s0 you would normally do -c qemu:///system To connect to Xen on the same host, do -c xen:/// To connect to libvirtd on a remote machine you would normally do -c qemu://host/system If this option is not given then virt-top connects by default to whatever is the default hypervisor for libvirt, although this can be overridden by setting environment variables. See the libvirt documentation at <http://libvirt.org/uri.html> for further information.
Set the delay between screen updates in seconds. The default is 3.0 seconds. You can change this while virt-top is running by pressing either s or d key.
Set the number of iterations to run. The default is to run continuously.
Set the sort order to one of: cpu (sort by %CPU used), mem (sort by total memory), time (sort by total time), id (sort by domain \s-1ID\s0), name (sort by domain name), netrx (sort by network received bytes), nettx (sort by network transmitted bytes), blockrdrq (sort by block device [disk] read requests), blockwrrq (sort by block device [disk] write requests). While virt-top is running you can change the sort order using keys P (cpu), M (memory), T (total time), N (domain \s-1ID\s0), F (interactively select the sort field).
Secure mode. Currently this does nothing.
Set the time in seconds between updates of the historical %CPU at the top right of the display.
Write the statistics to file file.csv. First a header is written showing the statistics being recorded in each column, then one line is written for each screen update. The \s-1CSV\s0 file can be loaded directly by most spreadsheet programs. Currently the statistics which this records vary between releases of virt-top (but the column headers will stay the same, so you can use those to process the \s-1CSV\s0 file). Not every version of virt-top supports \s-1CSV\s0 output - it depends how the program was compiled (see \s-1README\s0 file in the source distribution for details). To save space you can compress your \s-1CSV\s0 files (if your shell supports this feature, eg. bash):
virt-top --csv >(gzip -9 > output.csv.gz)
You can use a similar trick to split the \s-1CSV\s0 file up. In this example the \s-1CSV\s0 file is split every 1000 lines into files called output.csv.00, output.csv.01 etc. virt-top --csv >(split -d -l 1000 - output.csv.)
Disable domain \s-1CPU\s0 stats in \s-1CSV\s0 output.
Disable domain memory stats in \s-1CSV\s0 output.
Disable domain block device stats in \s-1CSV\s0 output.
Disable domain network interface stats in \s-1CSV\s0 output.
Send debug and error messages to filename. To send error messages to syslog you can do: virt-top --debug >(logger -t virt-top) See also \s-1REPORTING\s0 \s-1BUGS\s0 below.
Read filename as the init file instead of the default which is $HOME/.virt-toprc. See also \s-1INIT\s0 \s-1FILE\s0 below.
Do not read any init file.
Script mode. There will be no user interface. This is most useful when used together with the --csv and -n options.
Stream mode. All output is sent to stdout. This can be used from shell scripts etc. There is no user interface.
Show I/O statistics in Bytes. Default is shown in the number of Requests.
The program will exit at the time given. The time may be given in one of the following formats:
End time is the date and time given.
End time is the time given, today.
End time is \s-1HH\s0 hours, \s-1MM\s0 minutes, \s-1SS\s0 seconds in the future (counted from the moment that program starts).
End time is secs seconds in the future.
For example to run the program for 3 minutes you could do: virt-top --end-time +00:03:00 or: virt-top --end-time +180 Not every version of virt-top supports this option - it depends how the program was compiled (see \s-1README\s0 file in the source distribution for details).
Display usage summary.
Display version number and exit.
Note that keys are case sensitive. For example use upper-case P (shift P) to sort by %CPU. ^ before a key means a Ctrl key, so ^L is Ctrl L.
Updates the display.
Quits the program.
Displays help.
Change the delay between screen updates.
Toggle Block I/O statistics so they are shown in either bytes or requests.
Show the normal list of domains display.
Toggle into showing physical CPUs. If pressed again toggles back to showing domains (the normal display).
Toggle into showing network interfaces. If pressed again toggles back to showing domains.
Toggle into showing block devices (virtual disks). If pressed again toggles back to showing domains.
Sort by %CPU.
Sort by total memory. Note that this shows the total memory allocated to the guest, not the memory being used.
Sort by total time.
Sort by domain \s-1ID\s0.
Select the sort field interactively (there are other sort fields you can choose using this key).
This creates or overwrites the init file with the current settings. This key is disabled if --no-init-file was specified on the command line or if overwrite-init-file false is given in the init file.
When virt-top starts up, it reads initial settings from the file .virt-toprc in the user's home directory.
The name of this file may be overridden using the --init-file filename command line option or may be disabled entirely using --no-init-file.
The init file has a simple format. Blank lines and comments beginning with # are ignored. Everything else is a set of key value pairs, described below.
Sets the major display mode to one of task (tasks, the default), pcpu (physical CPUs), block (block devices), or net (network interfaces).
Sets the delay between display updates in seconds.
Sets the historical \s-1CPU\s0 delay in seconds.
Sets the number of iterations to run before we exit. Setting this to -1 means to run continuously.
Sets the sort order. The option names are the same as for the command line -o option.
Sets the default connection \s-1URI\s0.
Sets the default filename to use for debug and error messages.
Enables \s-1CSV\s0 output to the named file.
Enable or disable domain \s-1CPU\s0 stats in \s-1CSV\s0 output.
Enable or disable domain memory stats in \s-1CSV\s0 output.
Enable or disable domain block device stats in \s-1CSV\s0 output.
Enable or disable domain network interface stats in \s-1CSV\s0 output.
Sets batch mode.
Sets secure mode.
Sets script mode.
Sets stream mode.
Show block device statistics in bytes.
Set the time at which the program exits. See above for the time formats supported.
If set to false then the W key will not overwrite the init file.
Note that in the current implementation, options specified in the init file override options specified on the command line. This is a bug and this behaviour may change in the future.
This I/O value is the amount of I/O since the previous iteration of virt-top. To calculate speed of I/O, you should divide the number by delay secs.
Libvirt/virt-top has no way to know that a packet transmitted to a guest was received (eg. if the guest is not listening). In the network \s-1RX\s0 stats, virt-top reports the packets transmitted to the guest, on the basis that the guest might receive them.
In particular this includes broadcast packets. Because of the way that Linux bridges work, if the guest is connected to a bridge, it will probably see a steady \*(L"background noise\*(R" of \s-1RX\s0 packets even when the network interface is idle or down. These are caused by \s-1STP\s0 packets generated by the bridge.
virt-top tries to turn libvirt errors into informative messages. However if libvirt initialization fails then this is not possible. Instead you will get an obscure error like:
libvir: error : Unknown failure Fatal error: exception Libvirt.Virterror(...)
To see the cause of libvirt errors in more detail, enable libvirt debugging by setting this environment variable:
export LIBVIRT_DEBUG=1
top\|(1), virsh\|(1), <http://www.libvirt.org/ocaml/>, <http://www.libvirt.org/>, <http://people.redhat.com/~rjones/>, <http://caml.inria.fr/>
Richard W.M. Jones <rjones @ redhat . com>
(C) Copyright 2007-2011 Red Hat Inc., Richard W.M. Jones http://libvirt.org/
This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0 General Public License for more details.
You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, \s-1MA\s0 02139, \s-1USA\s0.
Bugs can be viewed on the Red Hat Bugzilla page: <https://bugzilla.redhat.com/>.
If you find a bug in virt-top, please follow these steps to report it:
Go to <https://bugzilla.redhat.com/> and search for similar bugs. Someone may already have reported the same bug, and they may even have fixed it.
Run virt-top --debug virt-top.log and keep virt-top.log. It contains error messages which you should submit with your bug report.
Use: virt-top --version If you can get the precise version of libvirt you are using then that too is helpful.
Go to <https://bugzilla.redhat.com/> and enter a new bug. Please describe the problem in as much detail as possible. Remember to include the version numbers (step 3) and the debug messages file (step 2).
Assign or reassign the bug to rjones @ redhat.com (without the spaces). You can also send me an email with the bug number if you want a faster response.