Enabled plugin timeout for --check-host + fixes
This commit is contained in:
parent
e0a642cc4a
commit
1ab55020d0
@ -10,10 +10,12 @@
|
|||||||
# [default: init]
|
# [default: init]
|
||||||
display_style=init
|
display_style=init
|
||||||
|
|
||||||
# specify the list of HC plugins that need to be executed (plugin configuration file is optional)
|
# specify the list of HC plugins that need to be executed. All parameters are
|
||||||
# [hc:HC plugin name:HC plugin configuration file]
|
# optional except 'HC plugin name'
|
||||||
|
# [hc:HC plugin name:HC plugin configuration file:HC title:HC plugin run timeout]
|
||||||
hc:plugin1
|
hc:plugin1
|
||||||
hc:plugin2
|
hc:plugin2::Test plugin
|
||||||
|
hc:plugin3:::180
|
||||||
|
|
||||||
|
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
# define the version (YYYY-MM-DD)
|
# 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
|
# location of parent directory containing KSH functions/HC plugins
|
||||||
typeset -r FPATH_PARENT="/opt/hc/lib"
|
typeset -r FPATH_PARENT="/opt/hc/lib"
|
||||||
# location of custom HC configuration files
|
# location of custom HC configuration files
|
||||||
@ -89,6 +89,8 @@ typeset ARCHIVE_RC=0
|
|||||||
typeset DISABLE_RC=0
|
typeset DISABLE_RC=0
|
||||||
typeset ENABLE_RC=0
|
typeset ENABLE_RC=0
|
||||||
typeset RUN_RC=0
|
typeset RUN_RC=0
|
||||||
|
typeset RUN_CONFIG_FILE=""
|
||||||
|
typeset RUN_TIME_OUT=0
|
||||||
typeset SORT_CMD=""
|
typeset SORT_CMD=""
|
||||||
typeset DEBUG_OPTS=""
|
typeset DEBUG_OPTS=""
|
||||||
# command-line parameters
|
# command-line parameters
|
||||||
@ -1028,12 +1030,20 @@ case ${ARG_ACTION} in
|
|||||||
>${HC_STDOUT_LOG} 2>/dev/null
|
>${HC_STDOUT_LOG} 2>/dev/null
|
||||||
>${HC_STDERR_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 ))
|
if (( ARG_CHECK_HOST == 1 ))
|
||||||
then
|
then
|
||||||
ARG_CONFIG_FILE="" # reset from previous call
|
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':')
|
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}"
|
[[ -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
|
fi
|
||||||
|
|
||||||
# run HC with or without monitor
|
# run HC with or without monitor
|
||||||
@ -1181,9 +1191,7 @@ case ${ARG_ACTION} in
|
|||||||
;;
|
;;
|
||||||
11) # show HC event statistics
|
11) # show HC event statistics
|
||||||
show_statistics
|
show_statistics
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# finish up work
|
# finish up work
|
||||||
|
@ -883,12 +883,12 @@ typeset DUMMY=""
|
|||||||
typeset HC_CONFIG=""
|
typeset HC_CONFIG=""
|
||||||
typeset HC_DESC=""
|
typeset HC_DESC=""
|
||||||
typeset HC_EXEC=""
|
typeset HC_EXEC=""
|
||||||
typeset REPORT_STYLE=""
|
typeset DISPLAY_STYLE=""
|
||||||
|
|
||||||
[[ -r ${HOST_CONFIG_FILE} ]] || die "unable to read configuration file at ${HOST_CONFIG_FILE}"
|
[[ -r ${HOST_CONFIG_FILE} ]] || die "unable to read configuration file at ${HOST_CONFIG_FILE}"
|
||||||
|
|
||||||
# read required config values
|
# 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
|
case "${REPORT_STYLE}" in
|
||||||
csv|CSV) # csv format
|
csv|CSV) # csv format
|
||||||
if (( HAS_DISPLAY_CSV == 1 ))
|
if (( HAS_DISPLAY_CSV == 1 ))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user