Monitoring Drives Attached to HP RAID Controllers in ESXi using PRTG

PRTG does not appear to offer a sensor for monitoring P410 and similar RAID controllers in ESXi. I've written a script that will report on both the logical and physical drive statuses provided by HP's hpssacli ESXi utility. 

I have a github repository with updated versions of these PRTG sensors at: https://github.com/andygajetzki/prtg-sensors

From your ESXi terminal, do the following:

mkdir -p /scratch/var/prtg/scriptsxml vi /scratch/var/prtg/scriptsxml/raid.sh

and insert this:

#!/bin/sh
echo "<prtg>"  

# Check logical drives
esxcli hpssacli cmd -q "ctrl all show" | sed -rn 's/.*Slot ([0-9] ).*)/\1/p' | while read -r CONTROLLER; 
  do      
    esxcli hpssacli cmd -q "ctrl slot=$CONTROLLER ld all show" | sed -rn 's/logicaldrive ([0-9^ ]{1}).*/\1/p' | while read -r LOGICALDRIVE; 
    do          
      echo "<result>"          
      echo " <channel>RAID: Logical drive $LOGICALDRIVE</channel>"          
      TMP=`esxcli hpssacli cmd -q "ctrl slot=$CONTROLLER ld $LOGICALDRIVE show"`          
      echo $TMP | grep -q "Status: OK"          
      if [ "$?" -eq 0 ] ; then              
        echo " <value>1</value>"          
      else              
        echo " <value>0</value>"          
      fi          
      echo " <ValueLookup>prtg.standardlookups.offon.stateonok</ValueLookup>"          
    echo "</result>"      
  done;

# Check physical drives
esxcli hpssacli cmd -q "ctrl slot=$CONTROLLER pd all show" | sed -rn 's/physicaldrive ([1-9]{1}[A-Z]{1}:[1-9]{1}:[1-9]{1})[^(].*/\1/p' | while read -r PHYSICALDRIVE; 
  do          
    echo "<result>"          
    echo " <channel>RAID: Physical drive $PHYSICALDRIVE</channel>"          
    TMP=`esxcli hpssacli cmd -q "ctrl slot=$CONTROLLER pd $PHYSICALDRIVE show"`          
    echo $TMP | grep -q "Status: OK"          
    if [ "$?" -eq 0 ] ; then              
      echo " <value>1</value>"          
    else              
      echo " <value>0</value>"          
    fi          
    echo " <ValueLookup>prtg.standardlookups.offon.stateonok</ValueLookup>"          
  echo "</result>"      
  done;  
done;  

echo "</prtg>"
      chmod 755 /scratch/var/prtg/scriptsxml/raid.sh  cp -r /scratch/var/prtg /var  

You may need to first install the hpssacli utility in ESXi. If you need hpssacli, visit Manage an HP Smart Array directly from VMware ESXi.

Now, go to your PRTG Console and add an advanced SSH sensor and choose the new raid.sh sensor from the dropdown.