Skip to content

Commit

Permalink
Using tr to replace the string-output from camcontrol, for a more hum…
Browse files Browse the repository at this point in the history
…an-readable script, no changes in functionality
  • Loading branch information
Klintrup committed Jun 20, 2019
1 parent d5346f2 commit b671838
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.3.0] - 2007-01-13
### Added
- Initial public release
## [1.3.1] - 2007-01-19
### Added
- Using tr to replace the string-output from camcontrol, for a more human-readable script, no changes in functionality.
16 changes: 8 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.3.0
# version 1.3.1

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DEVICES=$(camcontrol devlist|grep "COMPAQ"|sed -Ee 's/.*(pass[0-9]{1,3}).*/\1/')
Expand All @@ -12,27 +12,27 @@ 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])
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"
;;
[Ff][Aa][Ii])
fai)
ERR=2
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: FAILED"
;;
[Rr][Ee][Cc])
rec)
if ! [ "${ERR}" = 2 ]; then ERR=1;fi
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: rebuilding"
;;
[Rr][Ee][Aa])
rea)
if ! [ "${ERR}" = 2 ]; then ERR=1;fi
ERRORSTRING="${ERRORSTRING} | ${DEVICENAME}: ready for recovery"
;;
[Oo][Kk])
ok)
OKSTRING="${OKSTRING} | ${DEVICENAME}: ok"
;;
esac
esac
done
if [ "${ERRORSTRING}" -o "${OKSTRING}" ]
then
Expand Down

0 comments on commit b671838

Please sign in to comment.