Gentoo Linuxでvirt-topを使う
いわゆるtopのlibvirt版です。Gentooではebuildが用意されていないので、ソースからビルドします。さくっと入るかと思ったら予想外に手こずりました。
- dev-lang/ocaml
- dev-ml/findlib
- dev-ml/extlib
- ocaml-libvirt-0.6.1.0 - ocaml-libvirt OCaml bindings for libvirt
- ocaml-curses-1.0.3 - OCaml Curses / NCurses
- virt-top-1.0.4 - Virt-top download binary and source
ebuildがないものは基本的にはconfigure && makeでインストールできます。ocaml-cursesはautoconfしてあげる必要があるのでちょっと面倒です。
cd /usr/local/src/ocaml-libvirt-0.6.1.0 CFLAGS="-O2 -pipe -march=core2" ./configure make opt make install cd /usr/local/src/ocaml-curses-1.0.3 vim config.h.in autoconf CFLAGS="-O2 -pipe -march=core2" ./configure make opt make install cd /usr/local/src/virt-top-1.0.4 CFLAGS="-O2 -pipe -march=core2" ./configure make opt make install
ocaml-cursesのconfig.h.inはとりあえずこんな感じで。警告が出るけど動いているので大丈夫。たぶん。
#define HAVE_SYS_IOCTL_H
下記がvirt-topの表示です。
virt-top 23:01:19 - x86_64 2/2CPU 2000MHz 7992MB 10 domains, 7 active, 7 running, 0 sleeping, 0 paused, 3 inactive D:0 O:0 X:0 CPU: 3.8% Mem: 5632 MB (5632 MB by guests) ID S RDRQ WRRQ RXBY TXBY %CPU %MEM TIME NAME 5 R 2.7 12.0 21:14:25 vm67 6 R 0.5 12.0 242:44.36 snoopy 7 R 0.3 6.0 45:19.17 goma 1 R 0.2 19.0 77:39.43 xxxx 4 R 0.2 6.0 108:09.08 xxxxxx 3 R 0.0 6.0 101:28.51 xxx 2 R 0.0 6.0 48:25.69 xxxx - (xx) - (xxxxxx) - (xxxxxx) ※表示は一部変更しています。
ストレージやネットワークはlibvirtに管理を任せていない場合は表示されないようです。Domain XMLに論理ボリュームとtunデバイスをベタ書きしているので。うーん。