diff --git a/configs/etc/check_host.conf.dist b/configs/etc/check_host.conf.dist index 438849a..a7ccc61 100644 --- a/configs/etc/check_host.conf.dist +++ b/configs/etc/check_host.conf.dist @@ -10,10 +10,12 @@ # [default: init] display_style=init -# specify the list of HC plugins that need to be executed (plugin configuration file is optional) -# [hc:HC plugin name:HC plugin configuration file] +# specify the list of HC plugins that need to be executed. All parameters are +# optional except 'HC plugin name' +# [hc:HC plugin name:HC plugin configuration file:HC title:HC plugin run timeout] hc:plugin1 -hc:plugin2 +hc:plugin2::Test plugin +hc:plugin3:::180 #****************************************************************************** diff --git a/sources/bin/check_health.sh b/sources/bin/check_health.sh index 98455ed..a532174 100644 --- a/sources/bin/check_health.sh +++ b/sources/bin/check_health.sh @@ -37,7 +37,7 @@ # ------------------------- CONFIGURATION starts here ------------------------- # define the version (YYYY-MM-DD) -typeset -r SCRIPT_VERSION="2018-04-28" +typeset -r SCRIPT_VERSION="2018-05-12" # location of parent directory containing KSH functions/HC plugins typeset -r FPATH_PARENT="/opt/hc/lib" # location of custom HC configuration files @@ -89,6 +89,8 @@ typeset ARCHIVE_RC=0 typeset DISABLE_RC=0 typeset ENABLE_RC=0 typeset RUN_RC=0 +typeset RUN_CONFIG_FILE="" +typeset RUN_TIME_OUT=0 typeset SORT_CMD="" typeset DEBUG_OPTS="" # command-line parameters @@ -1028,12 +1030,20 @@ case ${ARG_ACTION} in >${HC_STDOUT_LOG} 2>/dev/null >${HC_STDERR_LOG} 2>/dev/null - # --check-host handling: alternative configuration file, mangle ARG_CONFIG_FILE + # --check-host handling: alternative configuration file, mangle ARG_CONFIG_FILE & HC_TIME_OUT if (( ARG_CHECK_HOST == 1 )) then ARG_CONFIG_FILE="" # reset from previous call RUN_CONFIG_FILE=$(grep -i -E -e "^hc:${HC_RUN}:" ${HOST_CONFIG_FILE} 2>/dev/null | cut -f3 -d':') [[ -n "${RUN_CONFIG_FILE}" ]] && ARG_CONFIG_FILE="${CONFIG_DIR}/${RUN_CONFIG_FILE}" + RUN_TIME_OUT=$(grep -i -E -e "^hc:${HC_RUN}:" ${HOST_CONFIG_FILE} 2>/dev/null | cut -f5 -d':') + if [[ -n "${RUN_TIME_OUT}" ]] + then + (( RUN_TIME_OUT > HC_TIME_OUT )) && HC_TIME_OUT=${RUN_TIME_OUT} + else + # reset for next HC + HC_TIME_OUT=60 + fi fi # run HC with or without monitor @@ -1181,9 +1191,7 @@ case ${ARG_ACTION} in ;; 11) # show HC event statistics show_statistics - ;; - - + ;; esac # finish up work diff --git a/sources/lib/core/include_core.sh b/sources/lib/core/include_core.sh index bb83988..7eda240 100644 --- a/sources/lib/core/include_core.sh +++ b/sources/lib/core/include_core.sh @@ -883,12 +883,12 @@ typeset DUMMY="" typeset HC_CONFIG="" typeset HC_DESC="" typeset HC_EXEC="" -typeset REPORT_STYLE="" +typeset DISPLAY_STYLE="" [[ -r ${HOST_CONFIG_FILE} ]] || die "unable to read configuration file at ${HOST_CONFIG_FILE}" # read required config values -REPORT_STYLE="$(grep -i '^report_style=' ${HOST_CONFIG_FILE} | cut -f2 -d'=' | tr -d '\"')" +DISPLAY_STYLE=$(_CONFIG_FILE="${HOST_CONFIG_FILE}" data_get_lvalue_from_config 'display_style') case "${REPORT_STYLE}" in csv|CSV) # csv format if (( HAS_DISPLAY_CSV == 1 ))