From 57fae3655a7427c1403d4aefa46d8f6ac83bdce1 Mon Sep 17 00:00:00 2001 From: Patrick Van der Veken Date: Mon, 8 Jan 2018 09:56:55 +0100 Subject: [PATCH] Fix + extra config checks --- .../platform/hp-ux/check_hpux_kernel_usage.sh | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/sources/lib/platform/hp-ux/check_hpux_kernel_usage.sh b/sources/lib/platform/hp-ux/check_hpux_kernel_usage.sh index 77aefef..2da559f 100644 --- a/sources/lib/platform/hp-ux/check_hpux_kernel_usage.sh +++ b/sources/lib/platform/hp-ux/check_hpux_kernel_usage.sh @@ -119,6 +119,22 @@ do warn "parameter '${_PARAM_NAME}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT} is not an existing kernel parameter" return 1 fi + # check if the threshold value is correct (integer) + case "${_CONFIG_VALUE}" in + [0-9]*) + # numeric, OK + if (( _CONFIG_VALUE < 1 || _CONFIG_VALUE > 99 )) + then + warn "incorrect threshold value '${_CONFIG_VALUE}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}" + return 1 + fi + ;; + *) + # not numeric + warn "invalid threshold value '${_CONFIG_VALUE}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}" + return 1 + ;; + esac _LINE_COUNT=$(( _LINE_COUNT + 1 )) done @@ -175,11 +191,11 @@ do else _MSG="${_PARAM_NAME} is below the general threshold (${_CHECK_VALUE} <= ${_MAX_KCUSAGE})" fi + + # handle unit result + log_hc "$0" ${_STC} "${_MSG}" "${_CHECK_VALUE}" "${_MAX_KCUSAGE}" + _STC=0 fi - - # handle unit result - log_hc "$0" ${_STC} "${_MSG}" "${_CHECK_VALUE}" "${_MAX_KCUSAGE}" - _STC=0 done return 0