domctl: manage your Xen infrastructure from the command line
domctl is a command line tool built on top of pangea that helps you to manage you Xen virtual infrastructure.
Think of it as a networked xm (though not all the xm commands are implemented ATM).
Installation
You will need ruby (>=1.8.7) and rubygems installed in your system.
gem source -a http://gems.xen-fu.org/
gem install domctl
Configuration
Before running domctl, we need to configure it first. Let’s run domctl without arguments to create an example config file:
rubiojr@srubio:~$ domctl domctl config file does not exist. I have created an example one for you (/Users/rubiojr/.domctlrc). Configure it first.
The generated config file syntax is YAML. Be carefull with the indentation and spaces when editing:
---
cluster:
xen0:
username: foo
url: http://xen0.example.net:9363
password: bar
xen1:
username: foo
url: http://xen1.example.net:9363
password: bar
The url parameter is the url needed to connect to the xend xml-rpc daemon.
Usage
Let’s demo some commands available:
List running guests (DomU) in the given host (Dom0)
rubiojr@srubio:~$ domctl list_running xen4
[xen4.example.net]
label memory power state cpus
----------------------------------------------------------------
php1 1024 MB Running 1
test2 512 MB Running 1
syslog2 256 MB Running 1
jsp2 1024 MB Running 1
frontend1 512 MB Running 1
mysql1.hosting 2 GB Running 4
php3.hosting 1024 MB Running 1
We can pass all as the argument instead of xen4 to print all the running hosts in every node configured in the domctlrc config file.
Print some stats from your Xen farm
rubiojr@srubio:~$ domctl farm_info Gathering Info... xen0.example.net ------- Resident VMs: 6 Mem Free: 2 GB Mem Total: 8 GB CPUs: 11.57 5.62 4.18 0.32 xen1.example.net ------- Resident VMs: 10 Mem Free: 8 GB Mem Total: 16 GB CPUs: 3.95 0.01 0.15 0.03 0.01 0.04 0.03 0.03 xen2.example.net ------- Resident VMs: 10 Mem Free: 3 GB Mem Total: 8 GB CPUs: 0.31 0.18 0.03 0.01
Locate a DomU within your hosts (physical nodes)
rubiojr@srubio:~$ domctl locate_domu mysql Searching.......... xen2: mysql1-backend-dev xen4: mysql1.hosting xen5: mysql2.hosting
Print the CPU Utilisation in every host
rubiojr@srubio:~$ domctl cpu_utilisation Gathering info... CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 ---------------------------------------------------------------- [xen0.example.net] 13.81 8.31 4.44 0.19 [xen1.example.net] 3.44 0.18 0.17 0.02 0.01 0.02 0.02 0.03 [xen2.example.net] 0.22 0.14 0.07 0.01 [xen3.example.net] 1.53 0.06 0.16 0.04 [xen4.example.net] 5.80 0.46 3.67 0.18 0.05 0.04 0.02 0.01
There are many other commands available (and many others waiting to be implemented soon). Run domctl without commands or with the help command and check them out:
rubiojr@srubio:~$ domctl domctl 0.2 Usage: help.rb command [arguments...] Available commands: help print this help or the help associated to a command list_running list all running domUs in the specified dom0 locate_domu find the dom0 hosting the specified domU show_vifs list the VIFs from a given domU domu_info print DomU info dom0_info print Dom0 info recent_domus print the last 10 domus created oldest_domus print the first 10 domus created mem_info print the memory available in a host farm_info print statistics from all the Hosts cpu_utilisation CPU utilisation from all the Hosts Type domctl help to get specific command help.
Hopefully you will find domctl as useful as I do.
pangea bugfix release: 0.1.20090403134419
Update it
gem update pangea
Release Log
* removed debugging prints
* updated docs
* code cleanup