add memory stats to --csv mode.
[virt-top.git] / virt-top / 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 When virt-top is running, use the I<1> key to toggle
26 between physical CPUs and domains display.
27
28 =item B<-2>
29
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.
33
34 =item B<-3>
35
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.
39
40 =item B<-b>
41
42 Batch mode.  In this mode keypresses are ignored.
43
44 =item B<-c uri> or B<--connect uri>
45
46 Connect to URI given.  The default is to connect to the Xen
47 hypervisor.
48
49 To connect to QEMU/KVM you would normally do I<-c qemu:///system>
50
51 To connect to libvirtd on a remote machine you would normally do
52 I<-c xen://host/>
53
54 Full details on connection URIs is available at
55 L<http://libvirt.org/uri.html>
56
57 =item B<-d delay>
58
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.
62
63 =item B<-n iterations>
64
65 Set the number of iterations to run.  The default
66 is to run continuously.
67
68 =item B<-o sort>
69
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).
80
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).
85
86 =item B<-s>
87
88 Secure mode.  Currently this does nothing.
89
90 =item B<--hist-cpu secs>
91
92 Set the time in seconds between updates of the historical
93 %CPU at the top right of the display.
94
95 =item B<--csv file.csv>
96
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.
101
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).
105
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
108 for details).
109
110 To save space you can compress your CSV files (if your shell supports
111 this feature, eg. I<bash>):
112
113  virt-top --csv >(gzip -9 > output.csv.gz)
114
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.
118
119  virt-top --csv >(split -d -l 1000 - output.csv.)
120
121 =item B<--no-csv-cpu>
122
123 Disable domain CPU stats in CSV output.
124
125 =item B<--no-csv-mem>
126
127 Disable domain memory stats in CSV output.
128
129 =item B<--no-csv-block>
130
131 Disable domain block device stats in CSV output.
132
133 =item B<--no-csv-net>
134
135 Disable domain network interface stats in CSV output.
136
137 =item B<--debug filename>
138
139 Send debug and error messages to I<filename>.
140 To send error messages to syslog you can do:
141
142  virt-top --debug >(logger -t virt-top)
143
144 See also REPORTING BUGS below.
145
146 =item B<--init-file filename>
147
148 Read I<filename> as the init file instead of the default which is
149 I<$HOME/.virt-toprc>.  See also INIT FILE below.
150
151 =item B<--no-init-file>
152
153 Do not read any init file.
154
155 =item B<--script>
156
157 Script mode.  There will be no user interface.  This is most useful
158 when used together with the I<--csv> and I<-n> options.
159
160 =item B<--stream>
161
162 Stream mode.  All output is sent to stdout.  This can be used from
163 shell scripts etc.  There is no user interface.
164
165 =item B<--block-in-bytes>
166
167 Show I/O statistics in Bytes. Default is shown in the number of Requests.
168
169 =item B<--end-time time>
170
171 The program will exit at the I<time> given.
172
173 The time may be given in one of the following formats:
174
175 =over 4
176
177 =item I<YYYY-MM-DD HH:MM:SS>
178
179 End time is the date and time given.
180
181 =item I<HH:MM:SS>
182
183 End time is the time given, today.
184
185 =item I<+HH:MM:SS>
186
187 End time is HH hours, MM minutes, SS seconds in the future (counted
188 from the moment that program starts).
189
190 =item I<+secs>
191
192 End time is I<secs> seconds in the future.
193
194 =back
195
196 For example to run the program for 3 minutes you could do:
197
198  virt-top --end-time +00:03:00
199
200 or:
201
202  virt-top --end-time +180
203
204 Not every version of virt-top supports this option - it depends how the
205 program was compiled (see I<README> file in the source distribution
206 for details).
207
208 =item B<--help>
209
210 Display usage summary.
211
212 =item B<--version>
213
214 Display version number and exit.
215
216 =back
217
218 =head1 KEYS
219
220 Note that keys are case sensitive.  For example use upper-case I<P>
221 (shift P) to sort by %CPU.  I<^> before a key means a Ctrl key, so
222 I<^L> is Ctrl L.
223
224 =over 4
225
226 =item I<space> or I<^L>
227
228 Updates the display.
229
230 =item I<q>
231
232 Quits the program.
233
234 =item I<h>
235
236 Displays help.
237
238 =item I<s> or I<d>
239
240 Change the delay between screen updates.
241
242 =item I<B>
243
244 Toggle Block I/O statistics so they are shown in either bytes or requests.
245
246 =item I<0> (number 0)
247
248 Show the normal list of domains display.
249
250 =item I<1> (number 1)
251
252 Toggle into showing physical CPUs.  If pressed
253 again toggles back to showing domains (the normal
254 display).
255
256 =item I<2>
257
258 Toggle into showing network interfaces.  If pressed
259 again toggles back to showing domains.
260
261 =item I<3>
262
263 Toggle into showing block devices (virtual disks).  If pressed again
264 toggles back to showing domains.
265
266 =item I<P>
267
268 Sort by %CPU.
269
270 =item I<M>
271
272 Sort by total memory.  Note that this shows the total memory
273 allocated to the guest, not the memory being used.
274
275 =item I<T>
276
277 Sort by total time.
278
279 =item I<N>
280
281 Sort by domain ID.
282
283 =item I<F>
284
285 Select the sort field interactively (there are other
286 sort fields you can choose using this key).
287
288 =item I<W>
289
290 This creates or overwrites the init file with the current settings.
291
292 This key is disabled if I<--no-init-file> was specified on the
293 command line or if I<overwrite-init-file false> is given in
294 the init file.
295
296 =back
297
298 =head1 INIT FILE
299
300 When virt-top starts up, it reads initial settings from the
301 file I<.virt-toprc> in the user's home directory.
302
303 The name of this file may be overridden using the I<--init-file
304 filename> command line option or may be disabled entirely using
305 I<--no-init-file>.
306
307 The init file has a simple format.  Blank lines and comments
308 beginning with I<#> are ignored.  Everything else is a set of
309 I<key value> pairs, described below.
310
311 =over 4
312
313 =item B<display> I<task|pcpu|block|net>
314
315 Sets the major display mode to one of I<task> (tasks, the
316 default), I<pcpu> (physical CPUs), I<block> (block devices),
317 or I<net> (network interfaces).
318
319 =item B<delay> I<secs>
320
321 Sets the delay between display updates in seconds.
322
323 =item B<hist-cpu> I<secs>
324
325 Sets the historical CPU delay in seconds.
326
327 =item B<iterations> I<n>
328
329 Sets the number of iterations to run before we exit.  Setting
330 this to I<-1> means to run continuously.
331
332 =item B<sort> I<cpu|mem|time|id|name|...>
333
334 Sets the sort order.  The option names are the same as for
335 the command line I<-o> option.
336
337 =item B<connect> I<uri>
338
339 Sets the default connection URI.
340
341 =item B<debug> I<filename>
342
343 Sets the default filename to use for debug and error messages.
344
345 =item B<csv> I<filename>
346
347 Enables CSV output to the named file.
348
349 =item B<csv-cpu> I<true|false>
350
351 Enable or disable domain CPU stats in CSV output.
352
353 =item B<csv-mem> I<true|false>
354
355 Enable or disable domain memory stats in CSV output.
356
357 =item B<csv-block> I<true|false>
358
359 Enable or disable domain block device stats in CSV output.
360
361 =item B<csv-net> I<true|false>
362
363 Enable or disable domain network interface stats in CSV output.
364
365 =item B<batch> I<true|false>
366
367 Sets batch mode.
368
369 =item B<secure> I<true|false>
370
371 Sets secure mode.
372
373 =item B<script> I<true|false>
374
375 Sets script mode.
376
377 =item B<stream> I<true|false>
378
379 Sets stream mode.
380
381 =item B<block-in-bytes> I<true|false>
382
383 Show block device statistics in bytes.
384
385 =item B<end-time> I<time>
386
387 Set the time at which the program exits.  See above for the
388 time formats supported.
389
390 =item B<overwrite-init-file> I<false>
391
392 If set to I<false> then the I<W> key will not overwrite the
393 init file.
394
395 =back
396
397 Note that in the current implementation, options specified in
398 the init file override options specified on the command line.
399 This is a bug and this behaviour may change in the future.
400
401 =head1 NOTES
402
403 =head2 Block I/O statistics
404
405 This I/O value is the amount of I/O since the previous iteration
406 of virt-top. To calculate speed of I/O, you should divide
407 the number by delay secs.
408
409 =head2 NETWORK RX BYTES AND PACKETS
410
411 Libvirt/virt-top has no way to know that a packet transmitted to a
412 guest was received (eg. if the guest is not listening).  In the
413 network RX stats, virt-top reports the packets transmitted to the
414 guest, on the basis that the guest might receive them.
415
416 In particular this includes broadcast packets.  Because of the way
417 that Linux bridges work, if the guest is connected to a bridge, it
418 will probably see a steady "background noise" of RX packets even when
419 the network interface is idle or down.  These are caused by STP
420 packets generated by the bridge.
421
422 =head1 SEE ALSO
423
424 L<top(1)>,
425 L<virsh(1)>,
426 L<http://www.libvirt.org/ocaml/>,
427 L<http://www.libvirt.org/>,
428 L<http://people.redhat.com/~rjones/>,
429 L<http://caml.inria.fr/>
430
431 =head1 AUTHORS
432
433 Richard W.M. Jones <rjones @ redhat . com>
434
435 =head1 COPYRIGHT
436
437 (C) Copyright 2007-2011 Red Hat Inc., Richard W.M. Jones
438 http://libvirt.org/
439
440 This program is free software; you can redistribute it and/or modify
441 it under the terms of the GNU General Public License as published by
442 the Free Software Foundation; either version 2 of the License, or
443 (at your option) any later version.
444
445 This program is distributed in the hope that it will be useful,
446 but WITHOUT ANY WARRANTY; without even the implied warranty of
447 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
448 GNU General Public License for more details.
449
450 You should have received a copy of the GNU General Public License
451 along with this program; if not, write to the Free Software
452 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
453
454 =head1 REPORTING BUGS
455
456 Bugs can be viewed on the Red Hat Bugzilla page:
457 L<https://bugzilla.redhat.com/>.
458
459 If you find a bug in virt-top, please follow these steps to report it:
460
461 =over 4
462
463 =item 1. Check for existing bug reports
464
465 Go to L<https://bugzilla.redhat.com/> and search for similar bugs.
466 Someone may already have reported the same bug, and they may even
467 have fixed it.
468
469 =item 2. Capture debug and error messages
470
471 Run
472
473  virt-top --debug virt-top.log
474
475 and keep I<virt-top.log>.  It contains error messages which you
476 should submit with your bug report.
477
478 =item 3. Get version of virt-top and version of libvirt.
479
480 Use:
481
482  virt-top --version
483
484 If you can get the precise version of libvirt you are using
485 then that too is helpful.
486
487 =item 4. Submit a bug report.
488
489 Go to L<https://bugzilla.redhat.com/> and enter a new bug.
490 Please describe the problem in as much detail as possible.
491
492 Remember to include the version numbers (step 3) and the debug
493 messages file (step 2).
494
495 =item 5. Assign the bug to rjones @ redhat.com
496
497 Assign or reassign the bug to B<rjones @ redhat.com> (without the
498 spaces).  You can also send me an email with the bug number if you
499 want a faster response.
500
501 =back