Skip to content

Commit

Permalink
Merge pull request #1 from Klintrup:nagios-web-interface-bug
Browse files Browse the repository at this point in the history
Changed the "|" to a "/" in output
  • Loading branch information
Klintrup authored Dec 3, 2023
2 parents 10380bd + 52ad8b5 commit 6d70a23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
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]``
``$path/check_smartarray.sh``

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 |
|--|--|
Expand Down
17 changes: 9 additions & 8 deletions check_smartarray.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# NRPE check for Proliant SmartArray Controllers (ciss)
# Written by: Søren Klintrup <soren at klintrup.dk>
# version 1.4.1
# version 1.4.2

PATH="/sbin:/bin:/usr/sbin:/usr/bin"
DEVICES="$(camcontrol devlist|grep "COMPAQ RAID"|sed -Ee 's/.*(pass[0-9]{1,3}).*/\1/')"
Expand All @@ -15,37 +15,38 @@ do
DEVICESTRING="$(camcontrol inquiry ${DEVICE} -D|sed -n -e 's/^[^<]*<\([^>]*\)>.*$/\1/p')"
if [ "$(echo ${DEVICESTRING}|tr A-Z a-z|sed -Ee 's/.*(rea|int|rec|fai|ok).*/\1/')" = "" ]
then
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: unknown state"
ERRORSTRING="${ERRORSTRING} / ${DEVICENAME}: unknown state"
if ! [ "${ERR}" = 2 ];then ERR=3;fi
else
case $(echo ${DEVICESTRING}|tr A-Z a-z|sed -Ee 's/.*(rea|int|rec|fai|ok).*/\1/') in
int)
ERR=2
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: DEGRADED"
ERRORSTRING="${ERRORSTRING} / ${DEVICENAME}: DEGRADED"
;;
fai)
ERR=2
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: FAILED"
ERRORSTRING="${ERRORSTRING} / ${DEVICENAME}: FAILED"
;;
rec)
if ! [ "${ERR}" = 2 -o "${ERR}" = 3 ]; then ERR=1;fi
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: rebuilding"
ERRORSTRING="${ERRORSTRING} / ${DEVICENAME}: rebuilding"
;;
rea)
if ! [ "${ERR}" = 2 -o "${ERR}" = 3 ]; then ERR=1;fi
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: ready for recovery"
ERRORSTRING="${ERRORSTRING} / ${DEVICENAME}: ready for recovery"
;;
ok)
OKSTRING="${OKSTRING} | ${DEVICENAME}: ok"
OKSTRING="${OKSTRING} / ${DEVICENAME}: ok"
;;
esac
fi
done
if [ "${ERRORSTRING}" -o "${OKSTRING}" ]
then
echo ${ERRORSTRING} ${OKSTRING}|sed s/"^| "//
echo ${ERRORSTRING} ${OKSTRING}|sed s/"^\/ "//
exit ${ERR}
else
echo no raid volumes found
exit 3
fi

0 comments on commit 6d70a23

Please sign in to comment.