Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
Powershell script to check HP SmartArray RAID status on Windows
Current Version
1.2
Last Release Date
2013-09-24
Owner
Bob
License
GPL
Compatible With
######################################################
Plugin deprecated !
Please go to : http://exchange.nagios.org/directory/Plugins/Hardware/Server-Hardware/HP-%28Compaq%29/NRPE-script-for-HP-SmartArray-checks/details
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
Future improvements (all suggestions and dev. are welcome) : - Compatibility with multiple HP Smart Array controllers - Properly handle NRPE's 1024b limitation in return packet - Some other ...
NSClient++ config : - Copy check_smartarray.ps1 to NSCLient++ scripts folder - Set Powershell execution policy to 'Set-ExecutionPolicy Unrestricted' - Append to NSC.ini : 'check_raid=cmd /c echo scripts/check_smartarray.ps1; exit $LastExitCode | powershell.exe -Command -' - Restart NSClient++ service
Nagios config example with nrpe-check : define service { use critical-service host_name MyWindowsServer 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 }
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 ---
any news on: Cannot index into a null array. At C:Program FilesNSClient++scriptscheck_smartarray.ps1:94 char:77 + return ($state ?
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 ----
Looking forward to this plugin but getting some errors: Any thoughts? Running on win2k3 x64. I have a few print here statements trying to locate where the errors are coming from. c:Userseric.aikenDownloads>powershell -File check_smartarray.ps1 -t30 -c check_raid here0 Smart Array P410i in Slot 0 (Embedded) (sn: 5001438018A01EB0) array A (SAS, Unused Space: 0 MB) logicaldrive 1 (1.6 TB, RAID 5, OK) physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 900.1 GB, OK) physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 900.1 GB, OK) physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 900.1 GB, OK) SEP (Vendor ID PMCSIERA, Model SRC 8x6G) 250 (WWID: 5001438018A01EBF) here1 Smart Array P410i in Slot 0 (Embedded) (sn: 5001438018A01EB0) array A (SAS, Unused Space: 0 MB) logicaldrive 1 (1.6 TB, RAID 5, OK) physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 900.1 GB, OK) physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 900.1 GB, OK) physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 900.1 GB, OK) SEP (Vendor ID PMCSIERA, Model SRC 8x6G) 250 (WWID: 5001438018A01EBF) here2 Name Value ---- ----- Array 0 - lv System.Collections.DictionaryEntry Array 0 - pd {System.Collections.DictionaryEntry, System.Collections.DictionaryEntry, System.Collections.Dictiona... Cannot index into a null array. At C:Userseric.aikenDownloadscheck_smartarray.ps1:94 char:77 + return ($state | Select-String -Pattern "(?Id : MethodNotFound Method invocation failed because [System.Object[]] doesn't contain a method named 'ContainsKey'. At C:Userseric.aikenDownloadscheck_smartarray.ps1:190 char:25 + if ($errors.ContainsKey tain a method named 'ContainsKey'. At C:Userseric.aikenDownloadscheck_smartarray.ps1:190 char:25 + if ($errors.ContainsKey
Thank you for your feedback with debug ! I found the error, I'll correct it and publish a new version soon. The error is that the script only accept the SATA array and not SAS one ...
Returns OK but status information show: "Cannot index into a null array." Looking forward to an updated version!
Hi, Thanks for the feedback. I can't reproduce the error so can you uncomment #164 & #170 lines and send me the result by mail (my mail is in the script header) ? Regards,
Same error here.
When run against my server, Nagios is reporting the following under Status Information: The string starting: At line:1 char:2 + - cordException + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString At least it returns with a Status of 'OK'
Hi, I'm trying to reproduce the error but i can't. Did you modify the path of 'hpacucli' program in the script ? Or anything else ? Can you uncomment the lines 164 & 170 and send me the result by mail (you can find my mail addr. in the header) ? Thank you.
You must be logged in to submit a review.
To:
From: