To monitor the status of a LSI RAID card, say for example a Dell PERC card, you will need to install NRPE, sudo, mpt-status and check_mpt.sh .

Install sudo and NRPE via your package manager. You can grab mpt-status via apt if you use Debian/Ubuntu or here if you use CentOS.  You can grab check_mpt.sh here.

First, load the module mptctl if it’s not done already: modprobe mptctl

To have the module loaded at boot, you can use your distribution specific behavior. In my case, I put it in /etc/rc.local .

To poll the RAID card, mpt-status needs some privileges. The easiest way to give them is to use sudo. sudo will be call via NRPE so you need to allow NRPE to invoke sudo without a tty.

Add the following lines to your sudoers file:

Defaults:nagios !requiretty nagios 
ALL=(ALL) NOPASSWD: /usr/sbin/mpt-status

Put check_mpt.sh in the plugins directory of NRPE (for example: /usr/lib64/nagios/plugins) and make it executable.

Then add a command to your NRPE config file: command[check_raid]=/usr/lib64/nagios/plugins/contrib/check_mpt.sh and restart NRPE.

On your NAGIOS server, run the following command to check it’s actually working: /usr/lib/nagios/plugins/check_nrpe -H 217.111.202.76 -c check_raid

If you get something like this, then it works:

State: OK 
ioc0 vol_id 0 type IM, 2 phy, 232 GB, state OPTIMAL, flags ENABLED 
ioc0 phy 1 scsi_id 9 ATA WDC WD2502ABYS-1 3B05, 232 GB, state ONLINE, flags NONE 
ioc0 phy 0 scsi_id 1 ATA WDC WD2502ABYS-1 3B05, 232 GB, state ONLINE, flags NONE

Now you just have to add an extra service check to your host and reload NAGIOS config and voilà !

Note: if you don’t want to use sudo, you can run NRPE as root but that’s not recommended ;-)