MonitoringvHostswithGanglia
Goal
We would like to show the status of the so-called "dom-machines" (KVM vHosts) in Ganglia.
Installation and configuration of gmond (SL6)
You first have to add the yum-repo sl6_addons. Put this content in the a file /etc/yup.repos.d/sl6_addons.repo :
[sl6_addons] name=sl6_addons baseurl=http://qrproxy.wn.iihe.ac.be:80/cb9/20140313/sl6_addons enabled=1 gpgcheck=0
And then :
yum install ganglia-gmond
You must then adapt /etc/ganglia/gmond.conf so that it contains the following :
... cluster { name = "vHosts" owner = "unspecified" latlong = "unspecified" url = "unspecified" } host { location = "unspecified" } udp_send_channel { host = dom04.wn.iihe.ac.be port = 8649 ttl = 1 } udp_recv_channel { port = 8649 } tcp_accept_channel { port = 8649 } ...
Check that this line is present in the /etc/ganglia/gmetad.conf on the Ganglia server (gangliat2b) :
data_source "vHosts" dom04.wn.iihe.ac.be:8649
(From these configurations, you see that we use dom04 as a collector for the data coming from the vHosts.)
Restart gmond :
service gmond restart
Gathering info about resources available/used by VMs
The idea is to use a Python module to collect the information on the vHosts. In details (we have done the following on dom10) :
- Install RPM gmond-gmond-python :
yum install ganglia-gmond-modules-python
2. We will use/adapt the xenstats files that are found here. These codes/configurations need to be adapted because they were written for Xen, and we actually use KVM. For the sake of simplicity, you will find the adapted files in attachments to this page. Copy them to these path :
/etc/ganglia/conf.d/kvmstats.pyconf /usr/lib64/ganglia/python_modules/kvmstats.py
3. Since the module python (kvmstats.py) is doing the equivalent of :
virsh -c qemu+ssh://root@localhost/system list --all
it means you are using ssh, and so, you must add the public SSH key of the vHost into its own .ssh/authorized_keys :
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Once it is done, run the command "virsh -c ..." above at least one time, so that an entry is added in .ssh/known_hosts.
4. Restart gmond :
service gmond restart