src: Include <libxml/parser.h>
[virt-top.git] / src / virt-top.pod
1 =head1 NAME
2
3 virt-top - 'top'-like utility for virtualization stats
4
5 =head1 SUMMARY
6
7 virt-top [-options]
8
9 =head1 DESCRIPTION
10
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
13 ordinary I<top>.
14
15 It uses libvirt so it is capable of showing stats across a variety of
16 different virtualization systems.
17
18 =head1 OPTIONS
19
20 =over 4
21
22 =item B<-1>
23
24 Display physical CPUs by default (instead of domains).
25
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
29 the domain.
30
31 When virt-top is running, use the I<1> key to toggle
32 between physical CPUs and domains display.
33
34 =item B<-2>
35
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.
39
40 =item B<-3>
41
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.
45
46 =item B<-b>
47
48 Batch mode.  In this mode keypresses are ignored.
49
50 =item B<-c uri> or B<--connect uri>
51
52 Connect to the libvirt URI given.
53
54 To connect to QEMU/KVM you would normally do I<-c qemu:///system>
55
56 To connect to Xen on the same host, do I<-c xen:///>
57
58 To connect to libvirtd on a remote machine you would normally do
59 I<-c qemu://host/system>
60
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.
64
65 See the libvirt documentation at L<http://libvirt.org/uri.html>
66 for further information.
67
68 =item B<-d delay>
69
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.
73
74 =item B<-n iterations>
75
76 Set the number of iterations to run.  The default
77 is to run continuously.
78
79 =item B<-o sort>
80
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).
91
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).
96
97 =item B<-s>
98
99 Secure mode.  Currently this does nothing.
100
101 =item B<--hist-cpu secs>
102
103 Set the time in seconds between updates of the historical
104 %CPU at the top right of the display.
105
106 =item B<--csv file.csv>
107
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.
112
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).
116
117 To save space you can compress your CSV files (if your shell supports
118 this feature, eg. I<bash>):
119
120  virt-top --csv >(gzip -9 > output.csv.gz)
121
122 You can use a similar trick to split the CSV file up.  In this example
123 the CSV file is split every 1000 lines into files called
124 I<output.csv.00>, I<output.csv.01> etc.
125
126  virt-top --csv >(split -d -l 1000 - output.csv.)
127
128 =item B<--no-csv-cpu>
129
130 Disable domain CPU stats in CSV output.
131
132 =item B<--no-csv-mem>
133
134 Disable domain memory stats in CSV output.
135
136 =item B<--no-csv-block>
137
138 Disable domain block device stats in CSV output.
139
140 =item B<--no-csv-net>
141
142 Disable domain network interface stats in CSV output.
143
144 =item B<--debug filename>
145
146 Send debug and error messages to I<filename>.
147 To send error messages to syslog you can do:
148
149  virt-top --debug >(logger -t virt-top)
150
151 See also REPORTING BUGS below.
152
153 =item B<--init-file filename>
154
155 Read I<filename> as the init file instead of the default which is
156 I<$HOME/.virt-toprc>.  See also INIT FILE below.
157
158 =item B<--no-init-file>
159
160 Do not read any init file.
161
162 =item B<--script>
163
164 Script mode.  There will be no user interface.  This is most useful
165 when used together with the I<--csv> and I<-n> options.
166
167 =item B<--stream>
168
169 Stream mode.  All output is sent to stdout.  This can be used from
170 shell scripts etc.  There is no user interface.
171
172 =item B<--block-in-bytes>
173
174 Show I/O statistics in Bytes. Default is shown in the number of Requests.
175
176 =item B<--end-time time>
177
178 The program will exit at the I<time> given.
179
180 The time may be given in one of the following formats:
181
182 =over 4
183
184 =item I<YYYY-MM-DD HH:MM:SS>
185
186 End time is the date and time given.
187
188 =item I<HH:MM:SS>
189
190 End time is the time given, today.
191
192 =item I<+HH:MM:SS>
193
194 End time is HH hours, MM minutes, SS seconds in the future (counted
195 from the moment that program starts).
196
197 =item I<+secs>
198
199 End time is I<secs> seconds in the future.
200
201 =back
202
203 For example to run the program for 3 minutes you could do:
204
205  virt-top --end-time +00:03:00
206
207 or:
208
209  virt-top --end-time +180
210
211 Not every version of virt-top supports this option - it depends how the
212 program was compiled (see I<README> file in the source distribution
213 for details).
214
215 =item B<--help>
216
217 Display usage summary.
218
219 =item B<--version>
220
221 Display version number and exit.
222
223 =back
224
225 =head1 KEYS
226
227 Note that keys are case sensitive.  For example use upper-case I<P>
228 (shift P) to sort by %CPU.  I<^> before a key means a Ctrl key, so
229 I<^L> is Ctrl L.
230
231 =over 4
232
233 =item I<space> or I<^L>
234
235 Updates the display.
236
237 =item I<q>
238
239 Quits the program.
240
241 =item I<h>
242
243 Displays help.
244
245 =item I<s> or I<d>
246
247 Change the delay between screen updates.
248
249 =item I<B>
250
251 Toggle Block I/O statistics so they are shown in either bytes or requests.
252
253 =item I<0> (number 0)
254
255 Show the normal list of domains display.
256
257 =item I<1> (number 1)
258
259 Toggle into showing physical CPUs.  If pressed
260 again toggles back to showing domains (the normal
261 display).
262
263 =item I<2>
264
265 Toggle into showing network interfaces.  If pressed
266 again toggles back to showing domains.
267
268 =item I<3>
269
270 Toggle into showing block devices (virtual disks).  If pressed again
271 toggles back to showing domains.
272
273 =item I<P>
274
275 Sort by %CPU.
276
277 =item I<M>
278
279 Sort by total memory.  Note that this shows the total memory
280 allocated to the guest, not the memory being used.
281
282 =item I<T>
283
284 Sort by total time.
285
286 =item I<N>
287
288 Sort by domain ID.
289
290 =item I<F>
291
292 Select the sort field interactively (there are other
293 sort fields you can choose using this key).
294
295 =item I<W>
296
297 This creates or overwrites the init file with the current settings.
298
299 This key is disabled if I<--no-init-file> was specified on the
300 command line or if I<overwrite-init-file false> is given in
301 the init file.
302
303 =back
304
305 =head1 INIT FILE
306
307 When virt-top starts up, it reads initial settings from the
308 file I<.virt-toprc> in the user's home directory.
309
310 The name of this file may be overridden using the I<--init-file
311 filename> command line option or may be disabled entirely using
312 I<--no-init-file>.
313
314 The init file has a simple format.  Blank lines and comments
315 beginning with I<#> are ignored.  Everything else is a set of
316 I<key value> pairs, described below.
317
318 =over 4
319
320 =item B<display> I<task|pcpu|block|net>
321
322 Sets the major display mode to one of I<task> (tasks, the
323 default), I<pcpu> (physical CPUs), I<block> (block devices),
324 or I<net> (network interfaces).
325
326 =item B<delay> I<secs>
327
328 Sets the delay between display updates in seconds.
329
330 =item B<hist-cpu> I<secs>
331
332 Sets the historical CPU delay in seconds.
333
334 =item B<iterations> I<n>
335
336 Sets the number of iterations to run before we exit.  Setting
337 this to I<-1> means to run continuously.
338
339 =item B<sort> I<cpu|mem|time|id|name|...>
340
341 Sets the sort order.  The option names are the same as for
342 the command line I<-o> option.
343
344 =item B<connect> I<uri>
345
346 Sets the default connection URI.
347
348 =item B<debug> I<filename>
349
350 Sets the default filename to use for debug and error messages.
351
352 =item B<csv> I<filename>
353
354 Enables CSV output to the named file.
355
356 =item B<csv-cpu> I<true|false>
357
358 Enable or disable domain CPU stats in CSV output.
359
360 =item B<csv-mem> I<true|false>
361
362 Enable or disable domain memory stats in CSV output.
363
364 =item B<csv-block> I<true|false>
365
366 Enable or disable domain block device stats in CSV output.
367
368 =item B<csv-net> I<true|false>
369
370 Enable or disable domain network interface stats in CSV output.
371
372 =item B<batch> I<true|false>
373
374 Sets batch mode.
375
376 =item B<secure> I<true|false>
377
378 Sets secure mode.
379
380 =item B<script> I<true|false>
381
382 Sets script mode.
383
384 =item B<stream> I<true|false>
385
386 Sets stream mode.
387
388 =item B<block-in-bytes> I<true|false>
389
390 Show block device statistics in bytes.
391
392 =item B<end-time> I<time>
393
394 Set the time at which the program exits.  See above for the
395 time formats supported.
396
397 =item B<overwrite-init-file> I<false>
398
399 If set to I<false> then the I<W> key will not overwrite the
400 init file.
401
402 =back
403
404 Note that in the current implementation, options specified in
405 the init file override options specified on the command line.
406 This is a bug and this behaviour may change in the future.
407
408 =head1 COLUMN HEADINGS
409
410 =over 4
411
412 =item B<%CPU>
413
414 Percentage of CPU used.  As with L<top(1)>, 100% means that
415 all physical CPUs are being fully used.
416
417 =item B<DEVICE>
418
419 The block device name.
420
421 =item B<DOMAIN>
422
423 =item B<NAME>
424
425 The name of the libvirt domain.
426
427 =item B<ID>
428
429 The libvirt domain ID.
430
431 =item B<INTERFACE>
432
433 The network interface name.
434
435 =item B<%MEM>
436
437 The percentage of host memory assigned to the guest.
438
439 =item B<PHYCPU>
440
441 The physical CPU.
442
443 =item B<RDBY>
444
445 Disk bytes read since last displayed.
446
447 =item B<RDRQ>
448
449 Disk read requests since last displayed.
450
451 =item B<RXBY>
452
453 Network bytes received since last displayed.
454
455 =item B<RXPK>
456
457 Network packets received since last displayed.
458
459 =item B<S>
460
461 The state of the domain, one of:
462
463 =over 4
464
465 =item B<?>
466
467 Unknown.
468
469 =item B<R>
470
471 Running.
472
473 =item B<S>
474
475 Blocked.
476
477 =item B<P>
478
479 Paused.
480
481 =item B<D>
482
483 =item B<O>
484
485 Shutdown.
486
487 =item B<X>
488
489 Crashed.
490
491 =item B<M>
492
493 Suspended by guest power management.
494
495 =back
496
497 =item B<TIME>
498
499 Total CPU time used.
500
501 =item B<TXBY>
502
503 Network bytes transmitted since last displayed.
504
505 =item B<TXPK>
506
507 Network packets transmitted since last displayed.
508
509 =item B<WRBY>
510
511 Disk bytes written since last displayed.
512
513 =item B<WRRQ>
514
515 Disk write requests since last displayed.
516
517 =back
518
519 =head1 NOTES
520
521 =head2 Block I/O statistics
522
523 This I/O value is the amount of I/O since the previous iteration
524 of virt-top. To calculate speed of I/O, you should divide
525 the number by delay secs.
526
527 =head2 NETWORK RX BYTES AND PACKETS
528
529 Libvirt/virt-top has no way to know that a packet transmitted to a
530 guest was received (eg. if the guest is not listening).  In the
531 network RX stats, virt-top reports the packets transmitted to the
532 guest, on the basis that the guest might receive them.
533
534 In particular this includes broadcast packets.  Because of the way
535 that Linux bridges work, if the guest is connected to a bridge, it
536 will probably see a steady "background noise" of RX packets even when
537 the network interface is idle or down.  These are caused by STP
538 packets generated by the bridge.
539
540 =head2 DEBUGGING LIBVIRT ISSUES
541
542 virt-top tries to turn libvirt errors into informative messages.
543 However if libvirt initialization fails then this is not possible.
544 Instead you will get an obscure error like:
545
546  libvir: error : Unknown failure
547  Fatal error: exception Libvirt.Virterror(...)
548
549 To see the cause of libvirt errors in more detail, enable libvirt
550 debugging by setting this environment variable:
551
552  export LIBVIRT_DEBUG=1
553
554 =head1 SEE ALSO
555
556 L<top(1)>,
557 L<virsh(1)>,
558 L<http://www.libvirt.org/ocaml/>,
559 L<http://www.libvirt.org/>,
560 L<http://people.redhat.com/~rjones/>,
561 L<http://caml.inria.fr/>
562
563 =head1 AUTHORS
564
565 Richard W.M. Jones <rjones @ redhat . com>
566
567 =head1 COPYRIGHT
568
569 (C) Copyright 2007-2012 Red Hat Inc., Richard W.M. Jones
570 http://libvirt.org/
571
572 This program is free software; you can redistribute it and/or modify
573 it under the terms of the GNU General Public License as published by
574 the Free Software Foundation; either version 2 of the License, or
575 (at your option) any later version.
576
577 This program is distributed in the hope that it will be useful,
578 but WITHOUT ANY WARRANTY; without even the implied warranty of
579 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
580 GNU General Public License for more details.
581
582 You should have received a copy of the GNU General Public License
583 along with this program; if not, write to the Free Software
584 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
585
586 =head1 REPORTING BUGS
587
588 Bugs can be viewed on the Red Hat Bugzilla page:
589 L<https://bugzilla.redhat.com/>.
590
591 If you find a bug in virt-top, please follow these steps to report it:
592
593 =over 4
594
595 =item 1. Check for existing bug reports
596
597 Go to L<https://bugzilla.redhat.com/> and search for similar bugs.
598 Someone may already have reported the same bug, and they may even
599 have fixed it.
600
601 =item 2. Capture debug and error messages
602
603 Run
604
605  virt-top --debug virt-top.log
606
607 and keep I<virt-top.log>.  It contains error messages which you
608 should submit with your bug report.
609
610 =item 3. Get version of virt-top and version of libvirt.
611
612 Use:
613
614  virt-top --version
615
616 If you can get the precise version of libvirt you are using
617 then that too is helpful.
618
619 =item 4. Submit a bug report.
620
621 Go to L<https://bugzilla.redhat.com/> and enter a new bug.
622 Please describe the problem in as much detail as possible.
623
624 Remember to include the version numbers (step 3) and the debug
625 messages file (step 2).
626
627 =item 5. Assign the bug to rjones @ redhat.com
628
629 Assign or reassign the bug to B<rjones @ redhat.com> (without the
630 spaces).  You can also send me an email with the bug number if you
631 want a faster response.
632
633 =back