3 virt-top - 'top'-like utility for virtualization stats
11 virt-top is a L<top(1)>-like utility for showing stats of virtualized
12 domains. Many keys and command line options are the same as for
15 It uses libvirt so it is capable of showing stats across a variety of
16 different virtualization systems.
24 Display physical CPUs by default (instead of domains).
26 Under each domain column, two numbers are shown. The first is
27 the percentage of the physical CPU used by the domain and the
28 hypervisor together. The second is the percentage used by just
31 When virt-top is running, use the I<1> key to toggle
32 between physical CPUs and domains display.
36 Display network interfaces by default (instead of domains).
37 When virt-top is running, use the I<2> key to toggle
38 between network interfaces and domains display.
42 Display block devices (virtual disks) by default (instead of domains).
43 When virt-top is running, use the I<3> key to toggle
44 between block devices and domains display.
48 Batch mode. In this mode keypresses are ignored.
50 =item B<-c uri> or B<--connect uri>
52 Connect to the libvirt URI given.
54 To connect to QEMU/KVM you would normally do I<-c qemu:///system>
56 To connect to Xen on the same host, do I<-c xen:///>
58 To connect to libvirtd on a remote machine you would normally do
59 I<-c qemu://host/system>
61 If this option is not given then virt-top connects by default
62 to whatever is the default hypervisor for libvirt, although
63 this can be overridden by setting environment variables.
65 See the libvirt documentation at L<http://libvirt.org/uri.html>
66 for further information.
70 Set the delay between screen updates in seconds.
71 The default is 3.0 seconds. You can change this
72 while virt-top is running by pressing either I<s> or I<d> key.
74 =item B<-n iterations>
76 Set the number of iterations to run. The default
77 is to run continuously.
81 Set the sort order to one of:
82 B<cpu> (sort by %CPU used),
83 B<mem> (sort by total memory),
84 B<time> (sort by total time),
85 B<id> (sort by domain ID),
86 B<name> (sort by domain name),
87 B<netrx> (sort by network received bytes),
88 B<nettx> (sort by network transmitted bytes),
89 B<blockrdrq> (sort by block device [disk] read requests),
90 B<blockwrrq> (sort by block device [disk] write requests).
92 While virt-top is running you can change the sort
93 order using keys I<P> (cpu), I<M> (memory),
94 I<T> (total time), I<N> (domain ID),
95 I<F> (interactively select the sort field).
99 Secure mode. Currently this does nothing.
101 =item B<--hist-cpu secs>
103 Set the time in seconds between updates of the historical
104 %CPU at the top right of the display.
106 =item B<--csv file.csv>
108 Write the statistics to file I<file.csv>. First a header is written
109 showing the statistics being recorded in each column, then one line is
110 written for each screen update. The CSV file can be loaded directly
111 by most spreadsheet programs.
113 Currently the statistics which this records vary between releases of
114 virt-top (but the column headers will stay the same, so you can use
115 those to process the CSV file).
117 Not every version of virt-top supports CSV output - it depends how the
118 program was compiled (see I<README> file in the source distribution
121 To save space you can compress your CSV files (if your shell supports
122 this feature, eg. I<bash>):
124 virt-top --csv >(gzip -9 > output.csv.gz)
126 You can use a similar trick to split the CSV file up. In this example
127 the CSV file is split every 1000 lines into files called
128 I<output.csv.00>, I<output.csv.01> etc.
130 virt-top --csv >(split -d -l 1000 - output.csv.)
132 =item B<--no-csv-cpu>
134 Disable domain CPU stats in CSV output.
136 =item B<--no-csv-mem>
138 Disable domain memory stats in CSV output.
140 =item B<--no-csv-block>
142 Disable domain block device stats in CSV output.
144 =item B<--no-csv-net>
146 Disable domain network interface stats in CSV output.
148 =item B<--debug filename>
150 Send debug and error messages to I<filename>.
151 To send error messages to syslog you can do:
153 virt-top --debug >(logger -t virt-top)
155 See also REPORTING BUGS below.
157 =item B<--init-file filename>
159 Read I<filename> as the init file instead of the default which is
160 I<$HOME/.virt-toprc>. See also INIT FILE below.
162 =item B<--no-init-file>
164 Do not read any init file.
168 Script mode. There will be no user interface. This is most useful
169 when used together with the I<--csv> and I<-n> options.
173 Stream mode. All output is sent to stdout. This can be used from
174 shell scripts etc. There is no user interface.
176 =item B<--block-in-bytes>
178 Show I/O statistics in Bytes. Default is shown in the number of Requests.
180 =item B<--end-time time>
182 The program will exit at the I<time> given.
184 The time may be given in one of the following formats:
188 =item I<YYYY-MM-DD HH:MM:SS>
190 End time is the date and time given.
194 End time is the time given, today.
198 End time is HH hours, MM minutes, SS seconds in the future (counted
199 from the moment that program starts).
203 End time is I<secs> seconds in the future.
207 For example to run the program for 3 minutes you could do:
209 virt-top --end-time +00:03:00
213 virt-top --end-time +180
215 Not every version of virt-top supports this option - it depends how the
216 program was compiled (see I<README> file in the source distribution
221 Display usage summary.
225 Display version number and exit.
231 Note that keys are case sensitive. For example use upper-case I<P>
232 (shift P) to sort by %CPU. I<^> before a key means a Ctrl key, so
237 =item I<space> or I<^L>
251 Change the delay between screen updates.
255 Toggle Block I/O statistics so they are shown in either bytes or requests.
257 =item I<0> (number 0)
259 Show the normal list of domains display.
261 =item I<1> (number 1)
263 Toggle into showing physical CPUs. If pressed
264 again toggles back to showing domains (the normal
269 Toggle into showing network interfaces. If pressed
270 again toggles back to showing domains.
274 Toggle into showing block devices (virtual disks). If pressed again
275 toggles back to showing domains.
283 Sort by total memory. Note that this shows the total memory
284 allocated to the guest, not the memory being used.
296 Select the sort field interactively (there are other
297 sort fields you can choose using this key).
301 This creates or overwrites the init file with the current settings.
303 This key is disabled if I<--no-init-file> was specified on the
304 command line or if I<overwrite-init-file false> is given in
311 When virt-top starts up, it reads initial settings from the
312 file I<.virt-toprc> in the user's home directory.
314 The name of this file may be overridden using the I<--init-file
315 filename> command line option or may be disabled entirely using
318 The init file has a simple format. Blank lines and comments
319 beginning with I<#> are ignored. Everything else is a set of
320 I<key value> pairs, described below.
324 =item B<display> I<task|pcpu|block|net>
326 Sets the major display mode to one of I<task> (tasks, the
327 default), I<pcpu> (physical CPUs), I<block> (block devices),
328 or I<net> (network interfaces).
330 =item B<delay> I<secs>
332 Sets the delay between display updates in seconds.
334 =item B<hist-cpu> I<secs>
336 Sets the historical CPU delay in seconds.
338 =item B<iterations> I<n>
340 Sets the number of iterations to run before we exit. Setting
341 this to I<-1> means to run continuously.
343 =item B<sort> I<cpu|mem|time|id|name|...>
345 Sets the sort order. The option names are the same as for
346 the command line I<-o> option.
348 =item B<connect> I<uri>
350 Sets the default connection URI.
352 =item B<debug> I<filename>
354 Sets the default filename to use for debug and error messages.
356 =item B<csv> I<filename>
358 Enables CSV output to the named file.
360 =item B<csv-cpu> I<true|false>
362 Enable or disable domain CPU stats in CSV output.
364 =item B<csv-mem> I<true|false>
366 Enable or disable domain memory stats in CSV output.
368 =item B<csv-block> I<true|false>
370 Enable or disable domain block device stats in CSV output.
372 =item B<csv-net> I<true|false>
374 Enable or disable domain network interface stats in CSV output.
376 =item B<batch> I<true|false>
380 =item B<secure> I<true|false>
384 =item B<script> I<true|false>
388 =item B<stream> I<true|false>
392 =item B<block-in-bytes> I<true|false>
394 Show block device statistics in bytes.
396 =item B<end-time> I<time>
398 Set the time at which the program exits. See above for the
399 time formats supported.
401 =item B<overwrite-init-file> I<false>
403 If set to I<false> then the I<W> key will not overwrite the
408 Note that in the current implementation, options specified in
409 the init file override options specified on the command line.
410 This is a bug and this behaviour may change in the future.
412 =head1 COLUMN HEADINGS
418 Percentage of CPU used. As with L<top(1)>, 100% means that
419 all physical CPUs are being fully used.
423 The block device name.
429 The name of the libvirt domain.
433 The libvirt domain ID.
437 The network interface name.
441 The percentage of host memory assigned to the guest.
449 Disk bytes read since last displayed.
453 Disk read requests since last displayed.
457 Network bytes received since last displayed.
461 Network packets received since last displayed.
465 The state of the domain, one of:
497 Suspended by guest power management.
507 Network bytes transmitted since last displayed.
511 Network packets transmitted since last displayed.
515 Disk bytes written since last displayed.
519 Disk write requests since last displayed.
525 =head2 Block I/O statistics
527 This I/O value is the amount of I/O since the previous iteration
528 of virt-top. To calculate speed of I/O, you should divide
529 the number by delay secs.
531 =head2 NETWORK RX BYTES AND PACKETS
533 Libvirt/virt-top has no way to know that a packet transmitted to a
534 guest was received (eg. if the guest is not listening). In the
535 network RX stats, virt-top reports the packets transmitted to the
536 guest, on the basis that the guest might receive them.
538 In particular this includes broadcast packets. Because of the way
539 that Linux bridges work, if the guest is connected to a bridge, it
540 will probably see a steady "background noise" of RX packets even when
541 the network interface is idle or down. These are caused by STP
542 packets generated by the bridge.
544 =head2 DEBUGGING LIBVIRT ISSUES
546 virt-top tries to turn libvirt errors into informative messages.
547 However if libvirt initialization fails then this is not possible.
548 Instead you will get an obscure error like:
550 libvir: error : Unknown failure
551 Fatal error: exception Libvirt.Virterror(...)
553 To see the cause of libvirt errors in more detail, enable libvirt
554 debugging by setting this environment variable:
556 export LIBVIRT_DEBUG=1
562 L<http://www.libvirt.org/ocaml/>,
563 L<http://www.libvirt.org/>,
564 L<http://people.redhat.com/~rjones/>,
565 L<http://caml.inria.fr/>
569 Richard W.M. Jones <rjones @ redhat . com>
573 (C) Copyright 2007-2012 Red Hat Inc., Richard W.M. Jones
576 This program is free software; you can redistribute it and/or modify
577 it under the terms of the GNU General Public License as published by
578 the Free Software Foundation; either version 2 of the License, or
579 (at your option) any later version.
581 This program is distributed in the hope that it will be useful,
582 but WITHOUT ANY WARRANTY; without even the implied warranty of
583 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
584 GNU General Public License for more details.
586 You should have received a copy of the GNU General Public License
587 along with this program; if not, write to the Free Software
588 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
590 =head1 REPORTING BUGS
592 Bugs can be viewed on the Red Hat Bugzilla page:
593 L<https://bugzilla.redhat.com/>.
595 If you find a bug in virt-top, please follow these steps to report it:
599 =item 1. Check for existing bug reports
601 Go to L<https://bugzilla.redhat.com/> and search for similar bugs.
602 Someone may already have reported the same bug, and they may even
605 =item 2. Capture debug and error messages
609 virt-top --debug virt-top.log
611 and keep I<virt-top.log>. It contains error messages which you
612 should submit with your bug report.
614 =item 3. Get version of virt-top and version of libvirt.
620 If you can get the precise version of libvirt you are using
621 then that too is helpful.
623 =item 4. Submit a bug report.
625 Go to L<https://bugzilla.redhat.com/> and enter a new bug.
626 Please describe the problem in as much detail as possible.
628 Remember to include the version numbers (step 3) and the debug
629 messages file (step 2).
631 =item 5. Assign the bug to rjones @ redhat.com
633 Assign or reassign the bug to B<rjones @ redhat.com> (without the
634 spaces). You can also send me an email with the bug number if you
635 want a faster response.