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
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 79 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

6 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

  3. Rajan on November 14th, 2010

    Hi,

    I have observing the following 2 errors. Please give me the solution.
    1.CHECK_NRPE: Error receiving data from daemon.
    2.NRPE: Command ‘check_load’ not defined.

    Thanks,
    G.Rajan
    rajangurusamy@gmail.com

  4. jbroome on January 10th, 2011

    Uh, “requiretty” needs to be commented out for this to work.

  5. [...] Nagios NRPE Monitor Yum Updates [...]

  6. Antonio on September 23rd, 2011

    Which version of CentOS?

Leave a reply