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

Login

Remember Me

NRPE script for HP SmartArray checks

Rating
11 votes
Favoured:
0
Current Version
1.7
Last Release Date
2016-09-19
Compatible With
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
Owner
License
GPL
Hits
20615
Files:
FileDescription
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
}

----------
Updates:

• 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 (9)
Hi,
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?

thanks!
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?


Also.
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
=====
[mrpe]
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.
Like:
OK - RAID status is good | 'Nb_Ctrl' = 1, 'Nb_Array' = 2, 'Nb_logicaldrive' = 2, 'Nb_physicaldrive' = 8