Home Directory Plugins Hardware Server Hardware HP (Compaq) NRPE script for HP SmartArray checks

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

Directory Tree

NRPE script for HP SmartArray checks

13 votes
Current Version
Last Release Date
Compatible With
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
check_SmartArray.ps1Windows version 1.7 (2016-09-19)
check_smartarray_v1.5.pyLinux version 1.5 (01-12-2015)
check_SmartArray (1.6).ps1Windows version 1.6 (2016-04-22)
check_smartarray_v1.6.pyLinux version 1.6 by Tomaz (22-02-2018)
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
PowerShell and Python scripts to check HP SmartArray RAID status on Windows and Linux using HPACUCLI and HPSSACLI.

The PowerShell version for Windows is semi-actively developed; the Python version for Windows is languishing!
PowerShell script to check HP SmartArray RAID status on Windows and Linux.

Because the Hpacucli takes long time to execute, when you call it for each drive thats become conflicting while adding drives to enclosure.
I don't find a script thats pleased me so i developped it.

All can use, copy, redistribute, modify and improve it.
But please, respect the 'AUTHOR' & 'VERSION' lines (append your's to the list, mandatory).

Checks :
• Physical drives status
• Logical drives status
• Compatible with multiple Arrays
• Compatible with multiple Controllers (Linux only for the moment)

Future improvements (all suggestions and dev. are welcome) :
• Compatibility with multiple HP Smart Array controllers
• Properly handle NRPE's 1024b limitation in return packet

Windows - NSClient++ configuration:
1. Copy script file to NSClient++ scripts folder
2. Set Powershell execution policy to 'Set-ExecutionPolicy Unrestricted'
3. Append to NSC.ini: check_raid=cmd /c echo scripts/check_SmartArray.ps1; exit $LastExitCode | powershell.exe -Command -
4. Restart NSClient++ service

Linux - NRPE:
• Copy script file to your scripts folder
• Append execution command to NRPE config file (details comming ...)

Nagios configuration example with nrpe-check :
define service {
use critical-service
host_name MyServer
service_description RAID Status
check_command check_nrpe!check_raid

define command {
command_name check_raid
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c check_raid


• 22 April 2016: PowerShell version 1.6
• 19 December 2016: PowerShell version 1.7 belatedly added

Changes in PowerShell version 1.7:

• Cleaned up the output formatting, and removed duplication of results
• Drive predictive failure now raised to warning level (untested)
• Better compatibility with HPSSACLI (controller warnings were not being reported)
Reviews (11)
My HP Servers with the P408i-a Smart array needed a little fix in the regex in line 60 of the python version 1.7:

should be:

smart = re.compile('^(HPE )?Smart Array .*$')
Windows vVersion 1.7.1 bellow, to respect paths on newer versions of HPE SSA:

# NAME: check_smartarray.ps1
# AUTHOR: Christophe Robert - christophe °dot° robert °at° cocoche °dot° fr
# Daniel Beardsmore [DGB] - daniel °at° trustnetworks °dot° co °dot° uk
# DESC: Check HPSSACLI/HPACUCLI results for RAID status on Windows - hpssacli/hpacucli command line tool
# Script compatibility : Python 2+
# Return Values :
# No problems - OK (exit code 0)
# Drive status != OK but not "Failed" - WARNING (exit code 1)
# Drive status is "Failed" - CRITICAL (exit code 2)
# TODO : Script errors - UNKNOWN (exit code 3)
# 1.0 - Initial dev. - 09-02-2012 (02 Sept. 2012)
# 1.1 - Correcting some errors and add comments - 09-15-2013 (15 Sept. 2013)
# * Add SAS array to be considerated (only SATA was before)
# * Add comments
# * Add UNKNOWN mark - script errors
# 1.2 - Correcting some errors - 09-24-2013 (24 Sept. 2013)
# * Add SCSI array to be considerated
# * Add comments
# 1.3 - Add multi controllers compatibility - 01-07-2015 (07 Jan. 2015)
# 1.4 - Add controller, battery and cache status checks - 01-18-2015 (18 Jan. 2015)
# 1.5 - Modify result analisys - 01-21-2015 (21 Jan. 2015)
# 1.6 - Corrected exception collection in existing code
# * Permits parameter "Blacklist" to blacklist controller status results
# * Auto-detects the location of HPACUCLI/HPSSACLI
# @ DGB 2016-04-22
# 1.7 - Cleaned up the output formatting, and removed duplication of results
# * Drive predictive failure now raised to warning level (untested)
# * Better compatibility with HPSSACLI (controller warnings were not being reported)
# @ DGB 2016-09-19

param (
[string]$Blacklist = ('Nothing')

Function Get-Storage-Executable-Path () {
$programPaths = (
'C:\Program Files\HP\HPSSACLI\bin\hpssacli.exe',
'C:\Program Files\HP\HPACUCLI\Bin\hpacucli.exe',
'C:\Program Files\Compaq\HPACUCLI\Bin\hpacucli.exe',
'C:\Program Files (x86)\HP\HPACUCLI\Bin\hpacucli.exe',
'C:\Program Files (x86)\Compaq\HPACUCLI\Bin\hpacucli.exe',
'C:\Program Files\Smart Storage Administrator\ssacli\bin\ssacli.exe',
'C:\Program Files (x86)\Smart Storage Administrator\ssacli\bin\ssacli.exe'

foreach ($path in $programPaths) {
if (Test-Path $path) {
return $path

return $false

Function Should-Line-Be-Skipped ($line) {
$line = $line.trim()
$colonPos = $line.indexOf(":")
if ($colonPos -eq -1) {
return $false
$LHS = $line.trim().substring(0, $colonPos)

return $global:blacklistItems -contains $LHS

Function Read-HPSmartArrayStatus ($buffer){
#creation de table de hash qui permet d'associer une clé et une valeur
$system = @{"ctrl" = @() ; "array" = @() ; "logical" = @() ; "physical" = @()}

foreach ($line in $buffer)
$line = $line.trim()
# Insert all controllers in dedicated list of dict
if ($line -like "Smart Array*")
#Write-Host "--Debug-- Enter smart"
#Write-Host "--Debug-- Value = $line"
$system.Item("ctrl") += $line
#Write-Host "--Debug-- Dict : $system"

# Insert all arrays in dedicated list of dict
elseif ($line -like "*array*SATA*" -Or $line -like "*array*SAS*" -Or $line -like "*array*SCSI*")
#Write-Host "--Debug-- Enter array"
#Write-Host "--Debug-- Value = $line"
$system.Item("array") += $line
#Write-Host "--Debug-- Dict : $system"

# Insert all logicaldrives in dedicated list of dict
elseif ($line -like "*logicaldrive*")
#Write-Host "--Debug-- Enter logical"
#Write-Host "--Debug-- Value = $line"
$system.Item("logical") += $line
#Write-Host "--Debug-- Dict : $system"

# Insert all physicaldives in dedicated list of dict
elseif ($line -like "*physicaldrive*")
#Write-Host "--Debug-- Enter physical"
#Write-Host "--Debug-- Value = $line"
$system.Item("physical") += $line
#Write-Host "--Debug-- Dict : $system"

#Write-Host "--Debug-- Show 'system' dict content"
#Write-Host "--Debug-- Value = $system"

return $system

Function Get-Errors ($buffer) {
$errors = @{"CRITICAL" = @() ; "WARNING" = @() ; "UNKNOWN" = @()}
$nb_ctrl = 0
$nb_array = 0
$nb_logical = 0
$nb_physical = 0

# For each controller found, check errors and find S/N
foreach ($element in $buffer.Item("ctrl"))
#Write-Host "--Debug-- Controller : $element"
$nb_ctrl += 1

$slot = $element.split(" ")[5]
#Write-Host "--Debug-- Slot : $slot"

$ctrl_status = & $prg ctrl slot=$slot show status

$ctrl_status = $ctrl_status | Where-Object { $_ }

foreach ($line in $ctrl_status)
#Write-Host "--Debug-- Controller internal status : $line"

if (Should-Line-Be-Skipped $line) {

if ($line -like "Smart*")
$hw = $line.trim()
if ($line -like "*Status*")
if ($line -notlike "*OK*")
$status = $line.trim()
$errors.Item("WARNING") += "$status in $hw"

# For each array found, check errors
foreach ($element in $buffer.Item("array"))
#Write-Host "--Debug-- Array : $element"
$nb_array += 1

# For each logicaldrive found, check errors
foreach ($element in $buffer.Item("logical"))
#Write-Host "--Debug-- Logicaldrive : $element"
$nb_logical += 1

if ($element -like "*OK*")
#Write-Host $element
elseif ($element -like "*Failed*")
#Write-Host $element
$errors.Item("CRITICAL") += $element
elseif ($element -like "*Recover*")
#Write-Host $element
$errors.Item("WARNING") += $element
#Write-Host $element
$errors.Item("UNKNOWN") += $element

# For each physical drive found, check errors
foreach ($element in $buffer.Item("physical"))
#Write-Host "--Debug-- Physicaldrive : $element"
$nb_physical += 1

if ($element -like "*OK*")
#Write-Host $element
elseif ($element -like "*Failed*")
#Write-Host $element
$errors.Item("CRITICAL") += $element
elseif ($element -like "*Rebuilding*" -or $element -like "*Predictive Failure*")
#Write-Host $element
$errors.Item("WARNING") += $element
#Write-Host $element
$errors.Item("UNKNOWN") += $element

#Write-Host "--Debug-- Errors dict : $errors"
return $errors, $nb_ctrl, $nb_array, $nb_logical, $nb_physical

### Core ###

$prg = Get-Storage-Executable-Path
if ($prg -eq $false) {
Write-Host "DOH! Cannot find ProLiant Array Configuration Utility or Smart Storage Administrator on this computer."
exit 3

$exec = & $prg 'ctrl all show config'
#Write-Host $exec

$global:Warning = 0
$global:Critical = 0
$global:Unknown = 0
$global:ToSendList = @()
$global:ToSendStr = ""

$global:blacklistItems = $Blacklist.split(",")
0..($global:blacklistItems.Length - 1) | % { $global:blacklistItems[$_] = $global:blacklistItems[$_].trim() }

# Execute Hp program with needed parameters and remove empty lines
$res = $exec | Where-Object { $_ }
#Write-Host $res

# Parse and analyse returned lines
$nagios = Read-HPSmartArrayStatus $res
#Write-Host $nagios

# Check errors
$health, $nb_ctrl, $nb_array, $nb_logical, $nb_physical = Get-Errors $nagios

#Write-Host "--Debug-- Health dict : $health"

if ($health.Item("CRITICAL").count -ne 0)
#Write-Host "--Debug-- Enter critical"
$global:Critical += 1
foreach ($elem in $health.Item("CRITICAL"))
$global:ToSendList += 'CRITICAL - ' + $elem
elseif (($health.Item("WARNING").count -ne 0) -and ($global:Critical -eq 0))
#Write-Host "--Debug-- Enter warning"
$global:Warning += 1
foreach ($elem in $health.Item("WARNING"))
$global:ToSendList += 'WARNING - ' + $elem
elseif (($health.Item("UNKNOWN").count -ne 0) -and ($global:Critical -eq 0) -and ($global:Warning -eq 0))
#Write-Host "--Debug-- Enter unknown"
$global:Unknown += 1
foreach ($elem in $health.Item("UNKNOWN"))
$global:ToSendList += 'UNKNOWN - ' + $elem
elseif (($nb_ctrl -eq 0) -and ($nb_array -eq 0) -and ($nb_logical -eq 0) -and ($nb_physical -eq 0))
#Write-Host "--Debug-- Enter unknown"
$global:Unknown += 1
$global:ToSendList += 'UNKNOWN - One of element of these : controller ($nb_ctrl), array ($nb_array), logicaldrive ($nb_logical) or physicaldrive ($nb_physical) is missing !'
$global:ToSendList += "OK - RAID status is good - Nb Ctrl : $nb_ctrl - Nb Array : $nb_array - Nb logicaldrive : $nb_logical - Nb physicaldrive : $nb_physical"

$global:ToSendStr = $global:ToSendList -join "; "
#Write-Host $global:ToSendStr
$global:ToSendStr = $_.Exception.Message
$global:Unknown += 1;
Write-Host $global:ToSendStr

if ($global:Critical -ne 0)
{ exit 2 }
elseif ($global:Warning -ne 0)
{ exit 1 }
elseif ($global:Unknown -ne 0)
{ exit 3 }
{ exit 0 }
Can anyone please tell me how to configure it on linux?
byyoursystem, March 15, 2019
Hi, I have added this path to work:

'C:\Program Files\Smart Storage Administrator\ssacli\bin\ssacli.exe'

I suggest to add in your scripts.
Thank you
bygbonasso, August 3, 2018
hello, and thanks for the script.
i have a constant warning because of this:
on CLI when "ctrl slot=0 show detail"

Cache Board Present: False
Cache Status: Not Configured

i'm not a pro on powershell scripting, so it would be cool to avoid cache warnings, what part should it comment?

check_SmartArray.ps1 Version 1.7 gives me the following error on Gen9 (Win2012 R2) server array:

DOH! Cannot find ProLiant Array Configuration Utility or Smart Storage Administrator on this computer.

Added the following to the scripts path and it works:

C:Program FilesSmart Storage Administratorssacliinssacli.exe
byDanielBeardsmore, December 18, 2016
1 of 1 people found this review helpful
Since I'm developing the Windows version, but I'm not Bob, I am forbidden by this site to reply to anyone, so this is all I can do.

Happyblue: "Nb Ctrl" is the number of RAID controllers found. For it to be zero (0), this suggests that you installed HPACUCLI/HPSSACLI onto a server that doesn't have a RAID controller fitted. I don't know that I've ever seen this specifically, but while deploying this script I have indeed found at least one server without RAID. If the server does have RAID but the script still reports no RAID controllers, then please provide the exact output of an invocation of HPACUCLI/HPSSACLI with the following parameters: ctrl all show config

Example: "\Program Files\HP\hpssacli\bin\hpssacli.exe" ctrl all show config

The script looks for a line of output starting with "Smart Array"; each line is recorded as being a controller found.

uguu: I don't use MRPE and cannot test this, but basically what the program does (as mentioned above) is call HPACUCLI/HPSSACLI with the parameters "ctrl all show config":

$exec = & $prg 'ctrl all show config'
#Write-Host $exec

(ll. 249-250 in version 1.7)

If it can't find HPACUCLI/HPSSACLI, it throws an error, so we know that it's able to locate the relevant program. Therefore, it is not recognising the output. The commented-out Write-Host line above, if enabled, would reveal exactly what response it received. It's either being disallowed the privilege of executing this program (so $exec may contain an error message), or something is causing the program's output to be misreported or lost, such that the script cannot read off the controller and array details.
My Proliant DL580 G5 that I have to test monitoring stuff with as I don't want to mess around in production seems unable to report raid status though SNMP no matter how many times I loop through the prtg forum posts, download stuff from the HPE website or use the Smart Update Manager DVD to install HP Insight agents and WBEM something something...
(It gives me loads of other stuff, the only thing missing is the raid stuff)
This script seemed promising as a workaround until the boss lets me near the newer Gen 8 server I've heard can do all this agentless through iLO.

Anyway, to the topic.
Locally it works just fine. I run it in powershell and it reports back this:
"OK - RAID status is good - Nb Ctrl : 1 - Nb Array : 2 - Nb logicaldrive : 2 - Nb physicaldrive : 8"

If I try to run it though MRPE (The check_mk agent version of NPRE) I get this instead:
"UNKNOWN - One of element of these : controller ($nb_ctrl), array ($nb_array), logicaldrive ($nb_logical) or physicaldrive ($nb_physical) is missing !"

Anyone know what's happening here or what I can do to help figure it out?

For anyone possibly googling their way here:
To make it run with MRPE I had to put the following into check_mk.ini, which is supposed to be located in the same folder as check_mk_agent.exe
check = HP_Smart_Array C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ".'C:\Program Files (x86)\check_mk\mrpe\check_smartarray_v1.6.ps1'"

Making it simply "check = HP_Smart_Array mrpe\check_smartarray_v1.6.ps1" like the documentation and example config file shows things looking doesn't work with powershell scripts. Handles bat-files just fine like that though.
byHappyblue, July 21, 2016
Hi, this plugin is working perfectly but i don't understand the first return "Nb Ctrl : n". For me, sometime it's 1 or 0. What's that ?
And can you give me an example of bad return cause i can't turn off one of my disk to simulate it of course ;)
Thx !
byZenden8686, December 16, 2015
1 of 1 people found this review helpful
Exactly what I needed. I am running Server 2012 so there were some tweaks needed. Listed here to help others in the same situation:

The 2012 version of HP array Configuration Utility will not work with this. Instead, Install the HP Smart Storage Administrator (cp019294.exe) and the HP Smart Storage Administrator CLI (cp019296.exe).

Now edit the check_smartarray.ps1 file:
- Change Line 195 to point to hpssacli.exe (in my case it is C:Program Fileshphpssacliinhpssacli.exe)

Copy the check_smartarray.ps1 file into the "scripts" subfolder within the installation path of the nsclient on each server you want to monitor.

Now edit the NSC.ini on each HP Server you wish to monitor (found in the NSClient Folder):
Add the following:
check_raid=cmd /c echo scripts/check_smartarray.ps1; exit $LastExitCode | powershell.exe -Command -

(that was all one line)

Enable Powershell Script Execution on each server you want to monitor:

Run Powershell as Administrator
Type - Set-ExecutionPolicy Remote-Signed
Agree to the prompt

Now Restart the NSClient Service

After doing this it would work correctly.
bydani.kostov, May 25, 2015
Thank you for the script.
For the guys who are fighting with the "the scripts asks to confirm security warning", sign the script and all will work fine.

Just one note: it would be nice if the output of the script was in the nagios performance data format.
OK - RAID status is good | 'Nb_Ctrl' = 1, 'Nb_Array' = 2, 'Nb_logicaldrive' = 2, 'Nb_physicaldrive' = 8