Improved detection of LOG_HEALTHY

This commit is contained in:
Patrick Van der Veken 2018-09-25 11:24:18 +02:00
parent cc9efabb68
commit e78a6dcf40

View File

@ -1475,6 +1475,26 @@ do
if (( HAS_FCONFIG != 0 )) if (( HAS_FCONFIG != 0 ))
then then
FCONFIG="Yes" FCONFIG="Yes"
# *.conf.dist first
if [[ -r ${CONFIG_DIR}/${FNAME#function *}.conf.dist ]]
then
# check for log_healthy parameter (config file)
HAS_FHEALTHY=$(_CONFIG_FILE="${CONFIG_DIR}/${FNAME#function *}.conf.dist" data_get_lvalue_from_config 'log_healthy')
case "${HAS_FHEALTHY}" in
no|NO|No)
FHEALTHY="No"
;;
yes|YES|Yes)
FHEALTHY="Yes"
;;
*)
FHEALTHY="N/S"
;;
esac
else
FHEALTHY="N/S"
fi
# *.conf next
if [[ -r ${CONFIG_DIR}/${FNAME#function *}.conf ]] if [[ -r ${CONFIG_DIR}/${FNAME#function *}.conf ]]
then then
# check for log_healthy parameter (config file) # check for log_healthy parameter (config file)
@ -1490,8 +1510,6 @@ do
FHEALTHY="N/S" FHEALTHY="N/S"
;; ;;
esac esac
else
FHEALTHY="N/S"
fi fi
# check for log_healthy support through --hc-args (plugin) # check for log_healthy support through --hc-args (plugin)
elif (( $(grep -c -E -e "_LOG_HEALTHY" "${FFILE}" 2>/dev/null) > 0 )) elif (( $(grep -c -E -e "_LOG_HEALTHY" "${FFILE}" 2>/dev/null) > 0 ))