[fedora-virt] Nagios plugin for monitoring libvirt: multiple servers not possible?

Richard W.M. Jones rjones at redhat.com
Thu Apr 1 16:24:17 UTC 2010


On Thu, Apr 01, 2010 at 06:11:14PM +0200, Eveline wrote:
> On Thu, Apr 01, 2010 at 12:23:03 +0200, Andrea Modesto Rossi wrote:
> > 
> > On Gio, 1 Aprile 2010 9:49 am, Richard W.M. Jones wrote:
> > >
> > > You could perhaps try something with libvirt remote support:
> > > http://libvirt.org/remote.html
> > 
> > I use ZABBIX to monitor my KVM cluster, both qemu processes and libvirtd
> > service. Simply, on zabbiz client:
> > 
> > cat /etc/zabbix/zabbix_agent.conf
> > 
> > .....
> > UserParameter=proc.num[libvirtd],ps axu | grep  "libvirtd" | awk '{print
> > $11}' | grep  "libvirtd" | wc -l
> > UserParameter=proc.num[qemu-kvm],ps axu | grep  "qemu-kvm" | awk '{print
> > $11}' | grep  "qemu-kvm" | wc -l
> 
> Hmm, we do also have zabbix, so this might indeed be a solution. As far as
> I know zabbix is mostly used for statistics in our setup, and nagios for
> problem reports.
> 
> Thanks!
> 
> The remote support for libvirt seems like what virt-manager uses to
> connect to all KVM servers for me. I recoqnize the qemu:// URLS from the
> virt-manager config.
> 
> But how to combine that with the nagios-virt plugin, I really don't have a
> clue. I was thinking myself to create a nagios plugin that runs the plugin
> on the remote servers over ssh. A bit like virt-manager does (it asks for
> ssh keys/passwords).

Basically you need to edit the check_virt script that gets installed.

Locate the line which runs virsh:

  status=$(sudo /usr/bin/virsh domstate "$HOSTNAME" | head -1)

and modify the command so it passes a URI to virsh, eg:

  ... /usr/bin/virsh -c 'xen+ssh://host/' ...

(That will only handle a single remote host; handling multiple remote
hosts is a good deal more complicated than that).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/


More information about the virt mailing list