new script

I added on to the script felix has created above. This one will return OK with spare drives and return a more specific error to Nagios…

$array_config_util = ‘C:Program Files (x86)CompaqHpacucliBinhpacucli.exe’

try {
$exec = & $array_config_util ‘ctrl all show config’
#Write-Output $exec
}
catch {
Write-Host “Problem checking array status (hint: nagioscheck_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)”} | Where-Object { $_ -notlike “*OK, spare)”}
if ($not_OK.length -lt 2) {
Write-Host “Array status appears OK”
Write-Host $not_OK
exit 0
}

Write-Host “Array status not OK;” $not_OK
#write-Host $not_OK
exit 2