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
Fabio Milano has written 80 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. 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

  2. krushna on November 24th, 2010

    Hi,

    I have followed all the step given above and stuck of with the following error.

    Error: Service check command ‘check_raid’ specified in service ‘RAID STATUS’ for host ‘Linux Server’ not defined anywhere!

  3. BRAEC?????…

    BRAEC????????? ?? ?? ???? Webmin??????? RAID????? quota?? SSH telnet??????? SSH??????? chroot?? ntp Web??? MySQL munin phpmyadmin FTP yum-priorities???????……

  4. vishal on May 30th, 2013

    I want to monitor raid of windows server 2008.
    I have followed all the steps that are you given but got the error.

    ERROR :- “No handler for command: check_raid”

  5. vreni on July 21st, 2014

    I’ve followed all steps and i’ve got vishnal’s errors hum, this post should be tested before being submitted on the web ;)

  6. tiago on July 21st, 2014

    Thanks a lot man,

    i was struggling here with this, forgot the chown and chmod on the client check_raid.

    Now it works like a charm :) i’ve just need to change the nrpe on my adagios to check_nrpe_1arg!check_raid

    THANKS A Lot…

Leave a reply