Nagios NRPE Software RAID Monitor

Scenario / Question:

How do I monitor linux software raid array status on a remote linux server

Solution / Answer:

Use the check_raid plugin and NRPE

Download check_raid Plugin on Remote Host Server

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

check_raid

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_raid
# chmod 775 check_raid

3. Test the plugin works

# /usr/local/nagios/libexec/check_raid

Add sudo alias for Nagios user

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

# visudo

Add the following:

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

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_raid command definition.

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

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 RAID STATUS
check_command check_nrpe!check_raid
}

Next, verify your Nagios configuration files and restart Nagios.

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

# service nagios restart

1 Comment so far

  1. Shaz on October 1st, 2009

    Hi

    I think this will only work if you not removed comment before “Defaults requiretty”

    else you will get this error

    NRPE: Unable to read output

Leave a reply