Build precise queries to find exactly what you need
Press ESC to close
@felix_h
Favorites0
Views
Projects0
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 FilesCompaqHpacucliBinhpacucli.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)" } if ($not_OK.length -lt 2) { Write-Host "Array status appears OK" exit 0 } Write-Host "Array status not OK; please check (hint: nagioscheck_smartarray.ps1)" exit 2 ----
Reviewed 12 years ago