Fixes for slot detection & reporting in check_linux_hpacucli & check_linux_hpssacli

This commit is contained in:
Patrick Van der Veken 2021-02-03 11:43:10 +01:00
parent c108237765
commit 47484d1e09
2 changed files with 8 additions and 5 deletions

View File

@ -29,6 +29,7 @@
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added code for data_is_numeric() & support for # @(#) 2019-03-09: added code for data_is_numeric() & support for
# @(#) --log-healthy [Patrick Van der Veken] # @(#) --log-healthy [Patrick Van der Veken]
# @(#) 2020-02-03: made slot num detection smarter [Patrick Van der Veken]
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! # DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
#****************************************************************************** #******************************************************************************
@ -38,7 +39,7 @@ function check_linux_hpacucli
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-03-09" # YYYY-MM-DD typeset _VERSION="2020-02-03" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -193,7 +194,7 @@ then
# get all slot numbers for multiple raid controllers # get all slot numbers for multiple raid controllers
cat ${_TMP_FILE} | grep "in Slot [0-9]" 2>/dev/null | while read _ACU_LINE cat ${_TMP_FILE} | grep "in Slot [0-9]" 2>/dev/null | while read _ACU_LINE
do do
_SLOT_NUM="$(print ${_ACU_LINE} | cut -f6 -d' ' 2>/dev/null)" _SLOT_NUM="$(print ${_ACU_LINE} | sed 's/.*in Slot \([0-9][0-9]*\).*/\1/' 2>/dev/null)"
data_is_numeric "${_SLOT_NUM}" data_is_numeric "${_SLOT_NUM}"
if (( $? == 0 )) if (( $? == 0 ))
then then

View File

@ -29,6 +29,8 @@
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added code for data_is_numeric() & support for # @(#) 2019-03-09: added code for data_is_numeric() & support for
# @(#) --log-healthy [Patrick Van der Veken] # @(#) --log-healthy [Patrick Van der Veken]
# @(#) 2020-02-03: made slot num detection smarter + fixed error in reporting
# @(#) when no problems [Patrick Van der Veken]
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! # DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
#****************************************************************************** #******************************************************************************
@ -38,7 +40,7 @@ function check_linux_hpssacli
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-03-09" # YYYY-MM-DD typeset _VERSION="2020-02-03" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -193,7 +195,7 @@ then
# get all slot numbers for multiple raid controllers # get all slot numbers for multiple raid controllers
cat ${_TMP_FILE} | grep "in Slot [0-9]" 2>/dev/null | while read _SSA_LINE cat ${_TMP_FILE} | grep "in Slot [0-9]" 2>/dev/null | while read _SSA_LINE
do do
_SLOT_NUM="$(print ${_SSA_LINE} | cut -f6 -d' ' 2>/dev/null)" _SLOT_NUM="$(print ${_SSA_LINE} | sed 's/.*in Slot \([0-9][0-9]*\).*/\1/' 2>/dev/null)"
data_is_numeric "${_SLOT_NUM}" data_is_numeric "${_SLOT_NUM}"
if (( $? == 0 )) if (( $? == 0 ))
then then
@ -279,7 +281,7 @@ else
fi fi
# report OK situation # report OK situation
if (( _LOG_HEALTHY > 0 && _STC_COUNT > 0 )) if (( _LOG_HEALTHY > 0 && _STC_COUNT == 0 ))
then then
_MSG="no problems detected by {${_HPSSACLI_BIN}}" _MSG="no problems detected by {${_HPSSACLI_BIN}}"
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"