

Give the script execute permission by issuingĬhmod +x /usr/local/nagios/libexec/check_raid in case of a CentOS server, replace /sbin/MegaCli as /opt/MegaRAID/MegaCli/MegaCli64 in the above script as it is the correct path to the Binary in Centos distributions. STATUS="CRITICAL: RAID failure detected!"Įlif ! /sbin/MegaCli -PDList -aAll | grep "Count: " | grep -v ": 0" &> /dev/nullĭo change the binary location in accordance with your installation and OS. If /sbin/MegaCli -PDList -aAll | grep -i failed &> /dev/null
#Raid monitor code code
If you see the version details, proceed to the next stepĬreate a new file check_raid at /usr/local/nagios/libexec Add the following code to the file check_raid #!/bin/bash So you can continue with your current session.

The bash built-in command “source” executes the content of the file /root/.bashrc and loads the variables to the current shell. bashrc to make the change permanent.Įcho alias MegaCli=\"/opt/MegaRAID/MegaCli/MegaCli64\" > /root/.bashrc PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files (i.e., ready-to-run programs) in response to commands issued by a user.įor easy access, lets create an alias for the command with name megacli and add it to.
#Raid monitor code full
The reason the command does not show up without full path is because the path to the binary is not included in the users PATH variable. If you see the output as above, it means the binary is present. MegaCLI SAS RAID Management Tool Ver 8.07.14 (c)Copyright 2013, LSI Corporation, All Rights Reserved. Try executing the below command # /opt/MegaRAID/MegaCli/MegaCli64 -v In CentOs machines, the binary is installed at /opt/MegaRAID/MegaCli/MegaCli64 The path and name to access the utility might be different. This doesn’t necessarily mean that MegaCli is absent. usr/bin/which: no MegaCli in (/usr/local/ /sbin/usr/local/bin:/usr/sbin:/usr/bin:/opt/cpanel/composer/bin:/root/bin") Otherwise, skip to Step 3įor Centos Machines, you may get an error like ~]#MegaCli The below instructions are to be read only if megacli is not found. If for some reason the path to the binary is different like /usr/sbin/MegaCli etc, then modify the script and commands below by replacing all instances of /sbin/MegaCli with the correct path to binary. You can do that by issuing the which MegaCliĪs you already knew, the binary paths can vary according to the installations. Login to the client server or the server to be monitored as root user Step 2:īefore moving forward, verify the path to MegaCli. Now let us move to the step by step instructions to enable RAID Monitoring on Nagios.
#Raid monitor code manual
MegaCLI is a command line interface (CLI) binary used to communicate with the full LSI family of raid controllers.įor a complete reference either call MegaCli -h or refer to the manual at:
#Raid monitor code how to
Here we are focusing our discussion only on the configuration of RAID check.īefore delving into how to add the check, lets first look at what MegaCli is. I assume that you already configured a Nagios server for server monitoring using NRPE plugin and are familiar with its working. This article is to highlight the steps to be followed to add raid check for servers using the `MegaCli` utility. While majority of the disk checks can be performed through simple tweaking of the existing commands, Raid disk health evaluation demands some advanced level of operations due to the architecture and raid controller differences with each RAID setup. During a Nagios monitoring implementation, we often need to depend NRPE plugins and custom commands to execute server monitoring tasks such as load monitoring, disk usage monitoring etc.
