diff --git a/CHANGELOG.md b/CHANGELOG.md index 2863a3c..1f4f836 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,3 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.4.0] - 2007-02-08 ### Changed - If a volume didn't have a known state, it just wouldn't show that volume, it now exits with errorcode3 and outputs as "unknown state" +## [1.4.1] - 2007-02-14 +### Changed +- Patch by Christoph Schug applied to replace two (cut) systemcalls with one (sed) when getting DEVICESTRING. +- Added quotes in various places for consistency +- Don't set state to unknown if state is already critical (for code added in 1.4) +- unset $ERR before doing anything to avoid problems if the variable is already set diff --git a/check_smartarray.sh b/check_smartarray.sh index 9abe278..dca4ed4 100644 --- a/check_smartarray.sh +++ b/check_smartarray.sh @@ -1,21 +1,22 @@ #!/bin/sh # NRPE check for Proliant SmartArray Controllers (ciss) # Written by: Søren Klintrup -# version 1.4.0 +# version 1.4.1 -PATH=/sbin:/bin:/usr/sbin:/usr/bin -DEVICES=$(camcontrol devlist|grep "COMPAQ RAID"|sed -Ee 's/.*(pass[0-9]{1,3}).*/\1/') +PATH="/sbin:/bin:/usr/sbin:/usr/bin" +DEVICES="$(camcontrol devlist|grep "COMPAQ RAID"|sed -Ee 's/.*(pass[0-9]{1,3}).*/\1/')" unset ERRORSTRING unset OKSTRING +unset ERR 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) + 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" - ERR = 3 + 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)