Skip to content

Commit

Permalink
add version 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Klintrup committed Jun 20, 2019
1 parent bea7cdc commit d5346f2
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.0] - 2007-01-13
### Added
- Initial public release
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# monitor HP Smart Array from NRPE / cron for FreeBSD
## Synopsis
I wrote this little check-script for nrpe/nagios to get the status of various raids in a box, and output the failed volumes if any such exist.

## Syntax
``$path/check_smartarray.sh [email] [email]``

If no arguments are specified, the script will assume its run for NRPE.
If one or more email addresses are specified, the script will send an email in case an array reports an error.
## Output Examples
| output | description |
|--|--|
| ok | The device is reported as ok by the smart array controller |
| DEGRADED | The RAID volume is degraded, it's still working but without the safety of RAID, and in some cases with severe performance loss. |
| rebuilding | The RAID is rebuilding, will return to OK when done |
| expanding | The RAID is expanding, will return to OK when done |
| ready for recovery | The RAID is ready for recovery, but not recovering. This can happen if automatic recovery is disabled, and on some smaller versions of the Smart Array Controllers where only one RAID volume can be rebuild at a time |
| unknown state | Volume is in an unknown state. Please submit a bug report so I can udate the script, include the following output. ``camcontrol devlist``, ``camcontrol inquiry da0 -D`` - run the inquiry for every volume on the system. |

# Compability
Should work on all smartarray controllers though - if you test on another (working or not) controller, I would like to know, please mail me on soren at klintrup.dk.

I have tested the script on the following controllers

* HP Smart Array 6i
* HP Smart Array 5i
* HP Smart Array P400
* HP Smart Array P410
* HP Smart Array P420
* HP Smart Array P800
44 changes: 44 additions & 0 deletions check_smartarray.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh
# NRPE check for Proliant SmartArray Controllers (ciss)
# Written by: Søren Klintrup <soren at klintrup.dk>
# version 1.3.0

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DEVICES=$(camcontrol devlist|grep "COMPAQ"|sed -Ee 's/.*(pass[0-9]{1,3}).*/\1/')
unset ERRORSTRING
unset OKSTRING

for DEVICE in ${DEVICES}
do
DEVICENAME="$(camcontrol devlist|grep ${DEVICE}|sed -Ee 's/.*(da[0-9]{1,3}).*/\1/')"
DEVICESTRING=$(camcontrol inquiry ${DEVICE} -D|cut -d '<' -f 2|cut -d '>' -f 1)
case $(echo ${DEVICESTRING}|sed -Ee 's/.*([Rr][Ee][Aa]|[Ii][Nn][Tt]|[Rr][Ee][Cc]|[Ff][Aa][Ii]|[Oo][Kk]).*/\1/') in
[Ii][Nn][Tt])
ERR=2
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: DEGRADED"
;;
[Ff][Aa][Ii])
ERR=2
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: FAILED"
;;
[Rr][Ee][Cc])
if ! [ "${ERR}" = 2 ]; then ERR=1;fi
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: rebuilding"
;;
[Rr][Ee][Aa])
if ! [ "${ERR}" = 2 ]; then ERR=1;fi
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: ready for recovery"
;;
[Oo][Kk])
OKSTRING="${OKSTRING} | ${DEVICENAME}: ok"
;;
esac
done
if [ "${ERRORSTRING}" -o "${OKSTRING}" ]
then
echo ${ERRORSTRING} ${OKSTRING}|sed s/"^| "//
exit ${ERR}
else
echo no raid volumes found
exit 3
fi

0 comments on commit d5346f2

Please sign in to comment.