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

Directory Tree

NRPE script for HP SmartArray checks

Rating
16 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
27152
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)
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
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 (14)
bybawi, July 12, 2024
Adding to charles123 review on python3

on 3.6.9 it doesn't work as expected because in "text" argument didn't exist in Popen yet.

in order to make it work replace "text" to "universal_newlines"
in both of these lines:
ctrl_status = Popen(['sudo', smartarray_bin, 'ctrl', 'slot=' + self.tocheck['ctrl'][i].split('Slot ')[1].split(' ')[0], 'show', 'status'], stdout=PIPE, universal_newlines=True)

hpacucli = Popen(['sudo', smartarray_bin, 'ctrl', 'all', 'show', 'config'], stdout=PIPE, universal_newlines=True)
The latest script works only in Python 2
so here the script rewritten for python 3

#!/usr/bin/python3
# -*- coding:utf-8 -*-

####
#
# NAME: check_smartarray.py
#
# AUTHOR: Christophe Robert - christophe °dot° robert °at° cocoche °dot° fr
#
# DESC: Check HP SmartArray RAID status on Linux - hpacucli/hpssacli/ssacli command line tool
#
# VERSION: 1.6 - Support for `hpacucli`, `hpssacli` and `ssacli` - 2018-02-22 (22. Feb. 2018)
#
####

import os
import sys
import re
from subprocess import Popen, PIPE
import logging
import logging.handlers

class ReadHPSmartArrayStatus:

def __init__(self, tuple, logger):
self.nagios = tuple
self.logger = logger

# Creation de table de hash qui permet d'associer une clé et une valeur
self.system = {'ctrl': [], 'array': [], 'logical': [], 'physical': []}
self.ctrl_nb = 0
self.array_nb = 0
self.lv_nb = 0
self.pd_nb = 0

def process(self):
for element in self.nagios:
sata = re.compile('^.*[Aa]rray.*SATA.*$')
sas = re.compile('^.*[Aa]rray.*SAS.*$')
scsi = re.compile('^.*[Aa]rray.*SCSI.*$')
smart = re.compile('^Smart Array .*$')
logical = re.compile('^.*logicaldrive.*$')
physical = re.compile('^.*physicaldrive.*$')

if smart.match(element):
self.logger.debug('--Debug-- Enter smart')
self.logger.debug('--Debug-- Value = ' + element)
self.ctrl_nb += 1
self.system['ctrl'].append(element)
self.logger.debug('--Debug-- Dict :' + str(self.system))

elif sata.match(element) or sas.match(element) or scsi.match(element):
self.logger.debug('--Debug-- Enter array')
self.logger.debug('--Debug-- Value = ' + element)
self.array_nb += 1
self.system['array'].append(element)
self.logger.debug('--Debug-- Dict :' + str(self.system))

elif logical.match(element):
self.logger.debug('--Debug-- Enter logical')
self.logger.debug('--Debug-- Value = ' + element)
self.lv_nb += 1
self.system['logical'].append(element)
self.logger.debug('--Debug-- Dict :' + str(self.system))

elif physical.match(element):
self.logger.debug('--Debug-- Enter physical')
self.logger.debug('--Debug-- Value = ' + element)
self.pd_nb += 1
self.system['physical'].append(element)
self.logger.debug('--Debug-- Dict :' + str(self.system))

self.logger.debug('--Debug-- Show "system" dict content')
self.logger.debug('--Debug-- Value = ' + str(self.system))

return self.system


class GetErrors:

def __init__(self, buffer, logger):
self.errors = {'CRITICAL': [], 'WARNING': [], 'UNKNOWN': []}
self.tocheck = buffer
self.logger = logger
self.nb_ctrl = 0
self.nb_array = 0
self.nb_logical = 0
self.nb_physical = 0

def check(self):
sata = re.compile('^.*array.*SATA.*$')
sas = re.compile('^.*array.*SAS.*$')
scsi = re.compile('^.*array.*SCSI.*$')
logical = re.compile('^.*logicaldrive.*$')
physical = re.compile('^.*physicaldrive.*$')

for i in range(len(self.tocheck['ctrl'])):
self.logger.debug('--Debug-- Controller : ' + str(self.tocheck['ctrl'][i]))
self.nb_ctrl += 1

self.logger.debug('--Debug-- Slot : ' + self.tocheck['ctrl'][i].split('Slot ')[1].split(' ')[0])
ctrl_status = Popen(['sudo', smartarray_bin, 'ctrl', 'slot=' + self.tocheck['ctrl'][i].split('Slot ')[1].split(' ')[0], 'show', 'status'], stdout=PIPE, text=True)
res = ctrl_status.communicate()[0]
ctrl_status.stdout.close()

ctrl = []
for r in res.splitlines():
r = r.lstrip()
self.logger.debug(str(r))
if r:
ctrl.append(r)

self.logger.debug('--Debug-- Controller internal status : ' + str(ctrl))
for element in ctrl:
if re.compile('.*Status:.*').match(element):
self.logger.debug('--Debug-- Controller element status : ' + element)
if element.split(': ')[1].split('\n')[0] != 'OK':
self.errors['WARNING'].append(element)

for i in range(len(self.tocheck['array'])):
self.logger.debug('--Debug-- Enter "array"')
self.logger.debug('--Debug-- Value = ' + str(self.tocheck['array'][i]))
self.nb_array += 1

for i in range(len(self.tocheck['logical'])):
self.logger.debug('--Debug-- Enter "logicaldrive"')
self.logger.debug('--Debug-- Value = ' + str(self.tocheck['logical'][i]))
self.nb_logical += 1

if re.compile('^.*OK.*$').match(self.tocheck['logical'][i]):
pass
elif re.compile('^.*Failed.*$').match(self.tocheck['logical'][i]):
self.errors['CRITICAL'].append(self.tocheck['logical'][i])
elif re.compile('^.*Recover.*$').match(self.tocheck['logical'][i]):
self.errors['WARNING'].append(self.tocheck['logical'][i])
else:
self.errors['UNKNOWN'].append(self.tocheck['logical'][i])

for i in range(len(self.tocheck['physical'])):
self.logger.debug('--Debug-- Enter "physicaldrive"')
self.logger.debug('--Debug-- Value = ' + str(self.tocheck['physical'][i]))
self.nb_physical += 1

if re.compile('^.*OK.*$').match(self.tocheck['physical'][i]):
pass
elif re.compile('^.*Failed.*$').match(self.tocheck['physical'][i]):
self.errors['CRITICAL'].append(self.tocheck['physical'][i])
elif re.compile('^.*Rebuilding.*$').match(self.tocheck['physical'][i]):
self.errors['WARNING'].append(self.tocheck['physical'][i])
else:
self.errors['UNKNOWN'].append(self.tocheck['physical'][i])

self.logger.debug('--Debug-- Errors dict : ' + str(self.errors))
return self.errors, self.nb_ctrl, self.nb_array, self.nb_logical, self.nb_physical


### Core ###

logger = logging.getLogger('check_smartarray')
logger.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler(address='/dev/log')
logger.addHandler(handler)

# Check which HP SmartArray management utility is installed
smartarray_bin = None
if os.path.isfile('/usr/sbin/hpacucli'):
smartarray_bin = 'hpacucli'
elif os.path.isfile('/usr/sbin/hpssacli'):
smartarray_bin = 'hpssacli'
elif os.path.isfile('/usr/sbin/ssacli'):
smartarray_bin = 'ssacli'
else:
logger.debug('--Debug-- HP SmartArray management utility not found.')
sys.exit(2)

# Get array status from SmartArray management utility
hpacucli = Popen(['sudo', smartarray_bin, 'ctrl', 'all', 'show', 'config'], stdout=PIPE, text=True)
res = hpacucli.communicate()[0]
hpacucli.stdout.close()

nagios = []
for r in res.splitlines():
r = r.lstrip()
logger.debug(str(r))
if r:
nagios.append(r)

logger.debug('--Debug-- List command results :')
logger.debug(nagios)

nb_warning = 0
nb_critical = 0
nb_unknown = 0
tosend = ""

try:
state = ReadHPSmartArrayStatus(nagios, logger)
config = state.process()

errors = GetErrors(config, logger)
health, nb_ctrl, nb_array, nb_logical, nb_physical = errors.check()

logger.debug('--Debug-- Health dict : ' + str(health))

if len(health['CRITICAL']):
logger.debug('--Debug-- Enter critical')
nb_critical += 1
for l in range(len(health['CRITICAL'])):
tosend += 'CRITICAL - ' + health['CRITICAL'][l] + '\\n'
elif len(health['WARNING']) and nb_critical==0:
logger.debug('--Debug-- Enter warning')
nb_warning += 1
for l in range(len(health['WARNING'])):
tosend += 'WARNING - ' + health['WARNING'][l] + '\\n'
elif len(health['UNKNOWN']) and nb_critical==0 and nb_warning==0:
logger.debug('--Debug-- Enter unknown')
nb_unknown += 1
for l in range(len(health['UNKNOWN'])):
tosend += 'UNKNOWN - ' + health['UNKNOWN'][l] + '\\n'
elif nb_ctrl == 0 or nb_array == 0 or nb_logical == 0 or nb_physical == 0:
logger.debug('--Debug-- Enter unknown')
nb_unknown += 1
tosend += 'UNKNOWN - One of element of these : controller (' + str(nb_ctrl) + '), array (' + str(nb_array) + '), logicaldrive (' + str(nb_logical) + ') or physicaldrive (' +str(nb_physical) + ') is missing !\\n'
else:
tosend = 'OK - RAID status is good - Nb Ctrl : ' + str(nb_ctrl) + ' - Nb Array : ' + str(nb_array) + ' - Nb logicaldrive : ' + str(nb_logical) + ' - Nb physicaldrive : ' + str(nb_physical)

tosend = tosend.strip('^\n')
logger.debug(str(tosend))

except Exception as e:
tosend = str(e)
logger.debug('--Debug-- Exception : ' + tosend)
print('--Debug2-- Exception : ' + tosend)

finally:
print(str(tosend))
if nb_critical != 0:
sys.exit(2)
elif nb_warning != 0:
sys.exit(1)
elif nb_unknown != 0:
sys.exit(3)
else:
sys.exit(0)
Works fine wit HP Array Configuration Utility CLI 9.0-24.0 on CentOS7.x
My HP Servers with the P408i-a Smart array needed a little fix in the regex in line 60 of the python version 1.7:

should be:

smart = re.compile('^(HPE )?Smart Array .*$')
Windows vVersion 1.7.1 bellow, to respect paths on newer versions of HPE SSA:

####
#
# NAME: check_smartarray.ps1
#
# AUTHOR: Christophe Robert - christophe °dot° robert °at° cocoche °dot° fr
# Daniel Beardsmore [DGB] - daniel °at° trustnetworks °dot° co °dot° uk
#
# DESC: Check HPSSACLI/HPACUCLI results for RAID status on Windows - hpssacli/hpacucli command line tool
#
# Script compatibility : Python 2+
# Return Values :
# No problems - OK (exit code 0)
# Drive status != OK but not "Failed" - WARNING (exit code 1)
# Drive status is "Failed" - CRITICAL (exit code 2)
#
# TODO : Script errors - UNKNOWN (exit code 3)
#
# VERSION:
# 1.0 - Initial dev. - 09-02-2012 (02 Sept. 2012)
# 1.1 - Correcting some errors and add comments - 09-15-2013 (15 Sept. 2013)
# * Add SAS array to be considerated (only SATA was before)
# * Add comments
# * Add UNKNOWN mark - script errors
# 1.2 - Correcting some errors - 09-24-2013 (24 Sept. 2013)
# * Add SCSI array to be considerated
# * Add comments
# 1.3 - Add multi controllers compatibility - 01-07-2015 (07 Jan. 2015)
# 1.4 - Add controller, battery and cache status checks - 01-18-2015 (18 Jan. 2015)
# 1.5 - Modify result analisys - 01-21-2015 (21 Jan. 2015)
# 1.6 - Corrected exception collection in existing code
# * Permits parameter "Blacklist" to blacklist controller status results
# * Auto-detects the location of HPACUCLI/HPSSACLI
# @ DGB 2016-04-22
# 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)
# @ DGB 2016-09-19
#
####

param (
[string]$Blacklist = ('Nothing')
)

Function Get-Storage-Executable-Path () {
$programPaths = (
'C:\Program Files\HP\HPSSACLI\bin\hpssacli.exe',
'C:\Program Files\HP\HPACUCLI\Bin\hpacucli.exe',
'C:\Program Files\Compaq\HPACUCLI\Bin\hpacucli.exe',
'C:\Program Files (x86)\HP\HPACUCLI\Bin\hpacucli.exe',
'C:\Program Files (x86)\Compaq\HPACUCLI\Bin\hpacucli.exe',
'C:\Program Files\Smart Storage Administrator\ssacli\bin\ssacli.exe',
'C:\Program Files (x86)\Smart Storage Administrator\ssacli\bin\ssacli.exe'
);

foreach ($path in $programPaths) {
if (Test-Path $path) {
return $path
}
}

return $false
}


Function Should-Line-Be-Skipped ($line) {
$line = $line.trim()
$colonPos = $line.indexOf(":")
if ($colonPos -eq -1) {
return $false
}
$LHS = $line.trim().substring(0, $colonPos)

return $global:blacklistItems -contains $LHS
}

Function Read-HPSmartArrayStatus ($buffer){
#creation de table de hash qui permet d'associer une clé et une valeur
$system = @{"ctrl" = @() ; "array" = @() ; "logical" = @() ; "physical" = @()}

foreach ($line in $buffer)
{
$line = $line.trim()
# Insert all controllers in dedicated list of dict
if ($line -like "Smart Array*")
{
#Write-Host "--Debug-- Enter smart"
#Write-Host "--Debug-- Value = $line"
$system.Item("ctrl") += $line
#$system.Item("ctrl").add($line)
#Write-Host "--Debug-- Dict : $system"
}

# Insert all arrays in dedicated list of dict
elseif ($line -like "*array*SATA*" -Or $line -like "*array*SAS*" -Or $line -like "*array*SCSI*")
{
#Write-Host "--Debug-- Enter array"
#Write-Host "--Debug-- Value = $line"
$system.Item("array") += $line
#$system.Item("array").add($line)
#Write-Host "--Debug-- Dict : $system"
}

# Insert all logicaldrives in dedicated list of dict
elseif ($line -like "*logicaldrive*")
{
#Write-Host "--Debug-- Enter logical"
#Write-Host "--Debug-- Value = $line"
$system.Item("logical") += $line
#$system.Item("logical").add($line)
#Write-Host "--Debug-- Dict : $system"
}

# Insert all physicaldives in dedicated list of dict
elseif ($line -like "*physicaldrive*")
{
#Write-Host "--Debug-- Enter physical"
#Write-Host "--Debug-- Value = $line"
$system.Item("physical") += $line
#$system.Item("physical").add($line)
#Write-Host "--Debug-- Dict : $system"
}
}

#Write-Host "--Debug-- Show 'system' dict content"
#Write-Host "--Debug-- Value = $system"

return $system
}


Function Get-Errors ($buffer) {
$errors = @{"CRITICAL" = @() ; "WARNING" = @() ; "UNKNOWN" = @()}
$nb_ctrl = 0
$nb_array = 0
$nb_logical = 0
$nb_physical = 0

# For each controller found, check errors and find S/N
foreach ($element in $buffer.Item("ctrl"))
{
#Write-Host "--Debug-- Controller : $element"
$nb_ctrl += 1

$slot = $element.split(" ")[5]
#Write-Host "--Debug-- Slot : $slot"

$ctrl_status = & $prg ctrl slot=$slot show status

$ctrl_status = $ctrl_status | Where-Object { $_ }

foreach ($line in $ctrl_status)
{
#Write-Host "--Debug-- Controller internal status : $line"

if (Should-Line-Be-Skipped $line) {
continue;
}

if ($line -like "Smart*")
{
$hw = $line.trim()
}
if ($line -like "*Status*")
{
if ($line -notlike "*OK*")
{
$status = $line.trim()
$errors.Item("WARNING") += "$status in $hw"
}
}
}
}

# For each array found, check errors
foreach ($element in $buffer.Item("array"))
{
#Write-Host "--Debug-- Array : $element"
$nb_array += 1
}

# For each logicaldrive found, check errors
foreach ($element in $buffer.Item("logical"))
{
#Write-Host "--Debug-- Logicaldrive : $element"
$nb_logical += 1

if ($element -like "*OK*")
{
#Write-Host $element
continue
}
elseif ($element -like "*Failed*")
{
#Write-Host $element
$errors.Item("CRITICAL") += $element
}
elseif ($element -like "*Recover*")
{
#Write-Host $element
$errors.Item("WARNING") += $element
}
else
{
#Write-Host $element
$errors.Item("UNKNOWN") += $element
}
}

# For each physical drive found, check errors
foreach ($element in $buffer.Item("physical"))
{
#Write-Host "--Debug-- Physicaldrive : $element"
$nb_physical += 1

if ($element -like "*OK*")
{
#Write-Host $element
continue
}
elseif ($element -like "*Failed*")
{
#Write-Host $element
$errors.Item("CRITICAL") += $element
}
elseif ($element -like "*Rebuilding*" -or $element -like "*Predictive Failure*")
{
#Write-Host $element
$errors.Item("WARNING") += $element
}
else
{
#Write-Host $element
$errors.Item("UNKNOWN") += $element
}
}

#Write-Host "--Debug-- Errors dict : $errors"
return $errors, $nb_ctrl, $nb_array, $nb_logical, $nb_physical
}


### Core ###

$prg = Get-Storage-Executable-Path
if ($prg -eq $false) {
Write-Host "DOH! Cannot find ProLiant Array Configuration Utility or Smart Storage Administrator on this computer."
exit 3
}

$exec = & $prg 'ctrl all show config'
#Write-Host $exec

$global:Warning = 0
$global:Critical = 0
$global:Unknown = 0
$global:ToSendList = @()
$global:ToSendStr = ""

$global:blacklistItems = $Blacklist.split(",")
0..($global:blacklistItems.Length - 1) | % { $global:blacklistItems[$_] = $global:blacklistItems[$_].trim() }

try
{
# Execute Hp program with needed parameters and remove empty lines
$res = $exec | Where-Object { $_ }
#Write-Host $res

# Parse and analyse returned lines
$nagios = Read-HPSmartArrayStatus $res
#Write-Host $nagios

# Check errors
$health, $nb_ctrl, $nb_array, $nb_logical, $nb_physical = Get-Errors $nagios

#Write-Host "--Debug-- Health dict : $health"

if ($health.Item("CRITICAL").count -ne 0)
{
#Write-Host "--Debug-- Enter critical"
$global:Critical += 1
foreach ($elem in $health.Item("CRITICAL"))
{
$global:ToSendList += 'CRITICAL - ' + $elem
}
}
elseif (($health.Item("WARNING").count -ne 0) -and ($global:Critical -eq 0))
{
#Write-Host "--Debug-- Enter warning"
$global:Warning += 1
foreach ($elem in $health.Item("WARNING"))
{
$global:ToSendList += 'WARNING - ' + $elem
}
}
elseif (($health.Item("UNKNOWN").count -ne 0) -and ($global:Critical -eq 0) -and ($global:Warning -eq 0))
{
#Write-Host "--Debug-- Enter unknown"
$global:Unknown += 1
foreach ($elem in $health.Item("UNKNOWN"))
{
$global:ToSendList += 'UNKNOWN - ' + $elem
}
}
elseif (($nb_ctrl -eq 0) -and ($nb_array -eq 0) -and ($nb_logical -eq 0) -and ($nb_physical -eq 0))
{
#Write-Host "--Debug-- Enter unknown"
$global:Unknown += 1
$global:ToSendList += 'UNKNOWN - One of element of these : controller ($nb_ctrl), array ($nb_array), logicaldrive ($nb_logical) or physicaldrive ($nb_physical) is missing !'
}
else
{
$global:ToSendList += "OK - RAID status is good - Nb Ctrl : $nb_ctrl - Nb Array : $nb_array - Nb logicaldrive : $nb_logical - Nb physicaldrive : $nb_physical"
}

$global:ToSendStr = $global:ToSendList -join "; "
#Write-Host $global:ToSendStr
}
catch
{
$global:ToSendStr = $_.Exception.Message
$global:Unknown += 1;
}
finally
{
Write-Host $global:ToSendStr

if ($global:Critical -ne 0)
{ exit 2 }
elseif ($global:Warning -ne 0)
{ exit 1 }
elseif ($global:Unknown -ne 0)
{ exit 3 }
else
{ exit 0 }
}
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