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).
25 When virt-top is running, use the I<1> key to toggle
26 between physical CPUs and domains display.
30 Display network interfaces by default (instead of domains).
31 When virt-top is running, use the I<2> key to toggle
32 between network interfaces and domains display.
36 Display block devices (virtual disks) by default (instead of domains).
37 When virt-top is running, use the I<3> key to toggle
38 between block devices and domains display.
42 Batch mode. In this mode keypresses are ignored.
44 =item B<-c uri> or B<--connect uri>
46 Connect to URI given. The default is to connect to the Xen
49 To connect to QEMU/KVM you would normally do I<-c qemu:///system>
51 To connect to libvirtd on a remote machine you would normally do
54 Full details on connection URIs is available at
55 L<http://libvirt.org/uri.html>
59 Set the delay between screen updates in seconds.
60 The default is 3.0 seconds. You can change this
61 while virt-top is running by pressing either I<s> or I<d> key.
63 =item B<-n iterations>
65 Set the number of iterations to run. The default
66 is to run continuously.
70 Set the sort order to one of:
71 B<cpu> (sort by %CPU used),
72 B<mem> (sort by total memory),
73 B<time> (sort by total time),
74 B<id> (sort by domain ID),
75 B<name> (sort by domain name),
76 B<netrx> (sort by network received bytes),
77 B<nettx> (sort by network transmitted bytes),
78 B<blockrdrq> (sort by block device [disk] read requests),
79 B<blockwrrq> (sort by block device [disk] write requests).
81 While virt-top is running you can change the sort
82 order using keys I<P> (cpu), I<M> (memory),
83 I<T> (total time), I<N> (domain ID),
84 I<F> (interactively select the sort field).
88 Secure mode. Currently this does nothing.
90 =item B<--hist-cpu secs>
92 Set the time in seconds between updates of the historical
93 %CPU at the top right of the display.
95 =item B<--csv file.csv>
97 Write the statistics to file I<file.csv>. First a header is written
98 showing the statistics being recorded in each column, then one line is
99 written for each screen update. The CSV file can be loaded directly
100 by most spreadsheet programs.
102 Currently the statistics which this records vary between releases of
103 virt-top (but the column headers will stay the same, so you can use
104 those to process the CSV file).
106 Not every version of virt-top supports CSV output - it depends how the
107 program was compiled (see I<README> file in the source distribution
110 To save space you can compress your CSV files (if your shell supports
111 this feature, eg. I<bash>):
113 virt-top --csv >(gzip -9 > output.csv.gz)
115 You can use a similar trick to split the CSV file up. In this example
116 the CSV file is split every 1000 lines into files called
117 I<output.csv.00>, I<output.csv.01> etc.
119 virt-top --csv >(split -d -l 1000 - output.csv.)
121 =item B<--no-csv-cpu>
123 Disable domain CPU stats in CSV output.
125 =item B<--no-csv-block>
127 Disable domain block device stats in CSV output.
129 =item B<--no-csv-net>
131 Disable domain network interface stats in CSV output.
133 =item B<--debug filename>
135 Send debug and error messages to I<filename>.
136 To send error messages to syslog you can do:
138 virt-top --debug >(logger -t virt-top)
140 See also REPORTING BUGS below.
142 =item B<--init-file filename>
144 Read I<filename> as the init file instead of the default which is
145 I<$HOME/.virt-toprc>. See also INIT FILE below.
147 =item B<--no-init-file>
149 Do not read any init file.
153 Script mode. There will be no user interface. This is most useful
154 when used together with the I<--csv> and I<-n> options.
158 Stream mode. All output is sent to stdout. This can be used from
159 shell scripts etc. There is no user interface.
161 =item B<--end-time time>
163 The program will exit at the I<time> given.
165 The time may be given in one of the following formats:
169 =item I<YYYY-MM-DD HH:MM:SS>
171 End time is the date and time given.
175 End time is the time given, today.
179 End time is HH hours, MM minutes, SS seconds in the future (counted
180 from the moment that program starts).
184 End time is I<secs> seconds in the future.
188 For example to run the program for 3 minutes you could do:
190 virt-top --end-time +00:03:00
194 virt-top --end-time +180
196 Not every version of virt-top supports this option - it depends how the
197 program was compiled (see I<README> file in the source distribution
202 Display usage summary.
206 Display version number and exit.
212 Note that keys are case sensitive. For example use upper-case I<P>
213 (shift P) to sort by %CPU. I<^> before a key means a Ctrl key, so
218 =item I<space> or I<^L>
232 Change the delay between screen updates.
234 =item I<0> (number 0)
236 Show the normal list of domains display.
238 =item I<1> (number 1)
240 Toggle into showing physical CPUs. If pressed
241 again toggles back to showing domains (the normal
246 Toggle into showing network interfaces. If pressed
247 again toggles back to showing domains.
251 Toggle into showing block devices (virtual disks). If pressed again
252 toggles back to showing domains.
260 Sort by total memory. Note that this shows the total memory
261 allocated to the guest, not the memory being used.
273 Select the sort field interactively (there are other
274 sort fields you can choose using this key).
278 This creates or overwrites the init file with the current settings.
280 This key is disabled if I<--no-init-file> was specified on the
281 command line or if I<overwrite-init-file false> is given in
288 When virt-top starts up, it reads initial settings from the
289 file I<.virt-toprc> in the user's home directory.
291 The name of this file may be overridden using the I<--init-file
292 filename> command line option or may be disabled entirely using
295 The init file has a simple format. Blank lines and comments
296 beginning with I<#> are ignored. Everything else is a set of
297 I<key value> pairs, described below.
301 =item B<display> I<task|pcpu|block|net>
303 Sets the major display mode to one of I<task> (tasks, the
304 default), I<pcpu> (physical CPUs), I<block> (block devices),
305 or I<net> (network interfaces).
307 =item B<delay> I<secs>
309 Sets the delay between display updates in seconds.
311 =item B<hist-cpu> I<secs>
313 Sets the historical CPU delay in seconds.
315 =item B<iterations> I<n>
317 Sets the number of iterations to run before we exit. Setting
318 this to I<-1> means to run continuously.
320 =item B<sort> I<cpu|mem|time|id|name|...>
322 Sets the sort order. The option names are the same as for
323 the command line I<-o> option.
325 =item B<connect> I<uri>
327 Sets the default connection URI.
329 =item B<debug> I<filename>
331 Sets the default filename to use for debug and error messages.
333 =item B<csv> I<filename>
335 Enables CSV output to the named file.
337 =item B<csv-cpu> I<true|false>
339 Enable or disable domain CPU stats in CSV output.
341 =item B<csv-block> I<true|false>
343 Enable or disable domain block device stats in CSV output.
345 =item B<csv-net> I<true|false>
347 Enable or disable domain network interface stats in CSV output.
349 =item B<batch> I<true|false>
353 =item B<secure> I<true|false>
357 =item B<script> I<true|false>
361 =item B<stream> I<true|false>
365 =item B<end-time> I<time>
367 Set the time at which the program exits. See above for the
368 time formats supported.
370 =item B<overwrite-init-file> I<false>
372 If set to I<false> then the I<W> key will not overwrite the
377 Note that in the current implementation, options specified in
378 the init file override options specified on the command line.
379 This is a bug and this behaviour may change in the future.
383 =head2 NETWORK RX BYTES AND PACKETS
385 Libvirt/virt-top has no way to know that a packet transmitted to a
386 guest was received (eg. if the guest is not listening). In the
387 network RX stats, virt-top reports the packets transmitted to the
388 guest, on the basis that the guest might receive them.
390 In particular this includes broadcast packets. Because of the way
391 that Linux bridges work, if the guest is connected to a bridge, it
392 will probably see a steady "background noise" of RX packets even when
393 the network interface is idle or down. These are caused by STP
394 packets generated by the bridge.
400 L<http://www.libvirt.org/ocaml/>,
401 L<http://www.libvirt.org/>,
402 L<http://people.redhat.com/~rjones/>,
403 L<http://caml.inria.fr/>
407 Richard W.M. Jones <rjones @ redhat . com>
411 (C) Copyright 2007-2011 Red Hat Inc., Richard W.M. Jones
414 This program is free software; you can redistribute it and/or modify
415 it under the terms of the GNU General Public License as published by
416 the Free Software Foundation; either version 2 of the License, or
417 (at your option) any later version.
419 This program is distributed in the hope that it will be useful,
420 but WITHOUT ANY WARRANTY; without even the implied warranty of
421 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
422 GNU General Public License for more details.
424 You should have received a copy of the GNU General Public License
425 along with this program; if not, write to the Free Software
426 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
428 =head1 REPORTING BUGS
430 Bugs can be viewed on the Red Hat Bugzilla page:
431 L<https://bugzilla.redhat.com/>.
433 If you find a bug in virt-top, please follow these steps to report it:
437 =item 1. Check for existing bug reports
439 Go to L<https://bugzilla.redhat.com/> and search for similar bugs.
440 Someone may already have reported the same bug, and they may even
443 =item 2. Capture debug and error messages
447 virt-top --debug virt-top.log
449 and keep I<virt-top.log>. It contains error messages which you
450 should submit with your bug report.
452 =item 3. Get version of virt-top and version of libvirt.
458 If you can get the precise version of libvirt you are using
459 then that too is helpful.
461 =item 4. Submit a bug report.
463 Go to L<https://bugzilla.redhat.com/> and enter a new bug.
464 Please describe the problem in as much detail as possible.
466 Remember to include the version numbers (step 3) and the debug
467 messages file (step 2).
469 =item 5. Assign the bug to rjones @ redhat.com
471 Assign or reassign the bug to B<rjones @ redhat.com> (without the
472 spaces). You can also send me an email with the bug number if you
473 want a faster response.