Nagios NRPE Monitor Yum Updates

Scenario / Question:

How do I monitor Yum updates on a remote linux server

Solution / Answer:

Use the check_yum plugin and NRPE

Download check_yum Plugin on Remote Host Server

Downlaod check_yum plugin to /usr/local/nagios/libexec/ from www.monitorexchange.org

check_yum

1. Download the plugin to folder /usr/local/nagios/libexec/

2. Change permissions on plugin to nagios

# cd /usr/local/nagios/libexec/
# chown nagios.nagios check_yum
# chmod 775 check_yum

3. Install yum-security package

# yum -y install yum-security

4. Test the plugin works

# /usr/local/nagios/libexec/check_yum

Add sudo alias for Nagios user

Yum is a command that needs to be executed by root user. We need to create a sudo alias so that nagios user can execute yum with root privileges.

# visudo

Add the following:

# Allow nagios to run certain plugins as root
  nagios  ALL=(ALL) NOPASSWD: /usr/local/nagios/libexec/check_yum

Uncomment the following:

#Defaults requiretty

Edit nrpe.cfg File on Remote Host Server

Add a new command definition to the nrpe.cfg file on the remote host

# vi /usr/local/nagios/etc/nrpe.cfg

Add a new check_yum command definition.

command[check_yum]=/usr/bin/sudo /usr/local/nagios/libexec/check_yum

Because we are running xinetd we do not need to restart the NRPE daemon. Otherwise you would have to restart the NRPE daemon for the changes to take effect.

Add Service Definition to Nagios Monitoring Server

On the monitoring host, you need to define a new service for check_something on the remote host. Add
the following entry to one of your object configuration files (linux-server-remote.cfg)
define service{
use generic-service
host_name remotehost
service_description Yum Update
check_command check_nrpe!check_yum
}

Next, verify your Nagios configuration files and restart Nagios.

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

# service nagios restart

TroubleShooting

Nagios is giving the error:

NRPE: Unable to read output

Solution:

# visudo

Uncomment the following “Defaults requiretty”:

#Defaults requiretty

2 Comments so far

  1. Mary Starr on June 30th, 2009

    You can find the check_yum plugin on the officical Nagios Exchange website. See the link below.

    http://exchange.nagios.org/directory/Plugins/Uncategorized/Operating-Systems/Linux/Check_Yum/details

  2. Fabio Milano on June 30th, 2009

    Mary

    Thanks for the link

Leave a reply