Home Directory

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

Login

Remember Me

Directory Tree

Directory

felix_h

Reviews(1)
byfelix_h, March 3, 2014
I also had trouble with this script on our servers. In particular, it returned a false "OK" status when I pulled a drive out of the array. I tried debugging it for a bit, but ended up getting frustrated and just rewrote it much shorter:
----
####
#
# NAME: check_smartarray.ps1
#
# ABOUT: Checks the output of HP's Array Configuration Utility for Smart Array
# RAID controllers, and tries to detect any problems with array status.
#
# This was inspired by Christophe Robert's "Powershell NRPE NSClient
# script for HP SmartArray check", found here:
# http://exchange.nagios.org/directory/Plugins/Hardware/Server-Hardware/HP-(Compaq)/Powershell-NRPE-NSClient-script-for-HP-SmartArray-check/details
# That one seemed a bit complicated, so I shortened it.
#
# AUTHOR: Felix Howe
#
# DISCLAIMER: I don't warrant this code as being suitable for anything;
# use at your own risk. In writing it I represent only myself, not my employer.
#
####

$array_config_util = 'C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe'

try {
$exec = & $array_config_util 'ctrl all show config'
#Write-Output $exec
}
catch {
Write-Host "Problem checking array status (hint: nagios\check_smartarray.ps1)"
exit 3
}

# filter results for lines that talk about drives (physicaldrive, logicaldrive)
# and do not end with "OK":
$not_OK = $exec | Where-Object { $_ -like "*drive*" } | Where-Object { $_ -notlike "*OK)" }
if ($not_OK.length -lt 2) {
Write-Host "Array status appears OK"
exit 0
}

Write-Host "Array status not OK; please check (hint: nagios\check_smartarray.ps1)"
exit 2
----