Monitoring Citrix XenServer with Nagios

This adds Nagios NRPE support for Citrix XenServer 5.5. I've tested this with the current patches as of 3/12/2010, but if it breaks and explodes and blows the hair off your cat, well, you've been warned. (Note, this has been updated for XenServer 5.6)

The rpm's are either from CentOS 5.3 or from Dag Wieers' site. I just put it all in one place.

Putty into the Xen Server and run:

wget http://www.8layer8.com/xen/net-snmp-utils-5.3.1-24.el5.i386.rpm
wget http://www.8layer8.com/xen/perl-Digest-HMAC-1.01-2.2.el5.rf.noarch.rpm
wget http://www.8layer8.com/xen/perl-Digest-SHA1-2.11-1.el5.rf.i386.rpm
wget http://www.8layer8.com/xen/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
wget http://www.8layer8.com/xen/xinetd-2.3.14-10.el5.i386.rpm
wget http://www.8layer8.com/xen/yum-priorities-1.1.10-9.el5.centos.noarch.rpm
wget http://www.8layer8.com/xen/yum-utils-1.1.16-21.el5.centos.noarch.rpm
wget http://www.8layer8.com/xen/perl-Socket6-0.19-3.fc6.i386.rpm

rpm -i perl-Digest-SHA1-2.11-1.el5.rf.i386.rpm
rpm -i perl-Digest-HMAC-1.01-2.2.el5.rf.noarch.rpm
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm
rpm -i net-snmp-utils-5.3.1-24.el5.i386.rpm
rpm -i xinetd-2.3.14-10.el5.i386.rpm
rpm -i yum-priorities-1.1.10-9.el5.centos.noarch.rpm
yum -y install compat-libstdc++-296 compat-libstdc++-33
rpm -i yum-utils-1.1.16-21.el5.centos.noarch.rpm
rpm -i perl-Socket6-0.19-3.fc6.i386.rpm 
yum -y install nagios-plugins nagios-nrpe xinetd perl-Net-SNMP
yum install net-snmp
yum install net-snmp-utils

When you run this, you'll have to answer some questions about the SNMP setup you want. If you don't want SNMP support, skip this section

snmpconf -g basic_setup
chkconfig snmpd on
service snmpd start

We need to modify the Xen firewall to allow Nagios/NRPE and SNMP to talk. If you don't want SNMP, omit the udp/161 rule

nano /etc/sysconfig/iptables

Add:

-A RH-Firewall-1-INPUT -p udp --dport 161 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT

Save & Close

service iptables restart

You need to convince xinetd to allow nrpe to run, and allow connections from your Nagios server

nano /etc/xinetd.d/nrpe

Edit:

disable = no
only_from = 127.0.0.1 ip.of.your.nagios

Save and exit.

Allow Nagios to do its thing. May not be the best security-wise, but you shouldn't allow public management anyway.

nano /etc/sudoers

Add this at the end somewhere:

nagios ALL=(ALL) NOPASSWD: ALL

Restart xinetd

chkconfig xinetd on
service xinetd start

Download my updated nrpe.cfg file to accommodate the differing paths under CentOS/XenServer and incorporate some checks for sda1

cd /etc/nagios
cp nrpe.cfg nrpe.cfg.backup
rm -f nrpe.cfg
wget http://www.8layer8.com/xen/nrpexen.cfg
cp nrpexen.cfg nrpe.cfg
chown nagios:nagios nrpe.cfg
chmod 644 nrpe.cfg
/etc/init.d/xinetd restart

At this point, you should be able to telnet to port 5666 from the Xen server itself and from the Nagios server. If not, don't continue!

On your Nagios server, here is a sample setup for checking sda1 free space, CPU Load, Current Users (probably useless), swap usage, total processes, and Zombie processes.

I'm working on having some Xen specific monitoring things added in soon.

xenhosts.cfg:
define hostgroup{
hostgroup_name  xen-servers     ; The name of the hostgroup
alias           XenServers      ; Long name of the group
members         xen1       ;comma separated list of host_names
}
#### To make a new entry, copy from here...
define host{
use             linux-servers ; Inherit settings from template
host_name       xen1    ; The name we're giving to this host
alias           xen1.l8.dmz    ; A longer name associated with the host
address         10.100.110.241  ; IP address of the host
}
define service{
use generic-service
host_name xen1
service_description CPU Load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name xen1
service_description Current Users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name xen1
service_description /dev/sda1 Free Space /
check_command check_nrpe!check_sda1
}
define service{
use generic-service
host_name xen1
service_description Total Processes
check_command check_nrpe!check_total_procs
}
define service{
use generic-service
host_name xen1
service_description Zombie Processes
check_command check_nrpe!check_zombie_procs
}
define service{
use generic-service
host_name xen1
service_description Swap Usage
check_command check_nrpe!check_swap
}

If you get status unknown, or unable to connect type messages, be sure you can telnet to the xen server on 5666.

If you get some stats, but it fails on sda1 free space with an unknown command error, make sure that you have to proper /etc/nagios/nrpe.cfg file in place that has the additional commands for /dev/sda1.

5 comments on “Monitoring Citrix XenServer with Nagios
  1. Blogem says:

    Worked great, thanks! There are a few mistakes though:

    The second wget command ('wget http://www.8layer8.com/xen/nrpexen.cf') should be left out. The URL is incorrect and you download it later on again.

    'rpm import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt' should be 'rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt'.

  2. Brad says:

    Thanks for the tips, I've fixed the typo's in the post. Apparently I couldn't Copy & Paste from my notes that day.

  3. Brad says:

    Update for XenServer 5.6:

    Edit the /etc/xinetd.d/nrpe

    Change the server and server_args to be:
    server = /usr/sbin/nrpe
    server_args = -c /etc/nagios/nrpe.cfg --inetd

  4. Julie says:

    Hi Brad, actually I'm trayin to get available Nagios with XenServer, but a I'm getting trouble to install
    rpm -i net-snmp-utils-5.3.1-24.el5.i386.rpm
    show me this message:
    error: Failed dependencies:
    net-snmp = 1:5.3.1 is needed by net-snmp-utils-5.3.1-24.el5.i386

    do you have this error?

  5. Brad says:

    I've seen this when it can't sort out the dependencies. Get net-snmp with this: wget http://vault.centos.org/5.2/os/i386/CentOS/net-snmp-5.3.1-24.el5.i386.rpm and then install with rpm -i net-snmp-5.3.1-24.el.i386.rpm

3 Pings/Trackbacks for "Monitoring Citrix XenServer with Nagios"
  1. [...] complément, je viens de trouver ceci : Monitoring Citrix XenServer with Nagios et A pool checking plugin for [...]

  2. [...] And its wiki (in German. Use Google for translation) XenServer checks: check_xen_pool Checking XenServer using NRPE But I did not care about Dom0 performance parameters, as they meant very little regarding the [...]

  3. [...] And its wiki (in German. Use Google for translation) XenServer checks: check_xen_pool Checking XenServer using NRPE But I did not care about Dom0 performance parameters, as they meant very little regarding the [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*