NagiosXCP

From Xen
Jump to: navigation, search

Nagios can already be used to directly monitor the XCP dom0 host's external services, however, if you wish to do more than just ping the dom0 host, you can install Nagios NRPE on the XCP dom0 directly.

Please note the below instructions are not perfect as they don't necessarily install all the dependency packages needed by all of the available Nagios plugins (e.g. SNMP libraries, etc).

Disable iptables

XCP comes with iptables installed and enabled by default. You will either need to explicitly enable the services in iptables that you would like to allow through (e.g. NRPE port 5666), or if your system is already secure behind a firewall, you can completely disable iptables like this:

/etc/rc.d/init.d/iptables stop
chkconfig --del iptables

Install NRPE

A quick install for NRPE and the nagios plugins can be done like this:

#packages for 32-bit centos5
wget http://pkgs.repoforge.org/fping/fping-2.4-1.b2.3.el5.rf.i386.rpm http://pkgs.repoforge.org/nagios-plugins/nagios-plugins-1.4.15-2.el5.rf.i386.rpm http://pkgs.repoforge.org/nagios-nrpe/nagios-nrpe-2.12-1.el5.rf.i386.rpm
rpm -ivh fping-2.4-1.b2.3.el5.rf.i386.rpm
rpm -ivh nagios-plugins-1.4.15-2.el5.rf.i386.rpm --nodeps
rpm -ivh nagios-nrpe-2.12-1.el5.rf.i386.rpm

Allow sudo commands

Some of the custom plugins I use require sudo, so I chose to enable running all plugins as root. This is a security risk and so should only be done if needed.

visudo
# Comment out the line for "Defaults    requiretty"
# Add the line "nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/"
vi /etc/nagios/nrpe.cfg
# Enable the line for command_prefix with sudo
# Modify the commands as you would like, in particular I added the disk check:
# "command[check_disk1]=/usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /dev/sda1"
# Modify allowed_hosts to enable access from your Nagios machine: e.g. "allowed_hosts=192.168.1.20"
chkconfig --add nrpe
service nrpe start

References