* Fix in check_hpux_lunpaths()

* Added support for chronyd in check_linux_ntp_status()
* Added support for --log-healthy in check_hpux_ntp_status() +
check_linux_ntp_status()
This commit is contained in:
patvdv
2018-10-31 07:43:44 +01:00
parent 393c000deb
commit 7c6b4c2a9d
3 changed files with 218 additions and 61 deletions
@@ -126,7 +126,7 @@ then
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
return 1
fi
# collect scsimgr info for all LUNs
@@ -138,7 +138,7 @@ then
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
return 1
fi
# parse ioscan + scsimgr results (WWID is the glue)
@@ -46,6 +46,8 @@ typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
typeset _MSG=""
typeset _STC=0
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _CURR_OFFSET=0
typeset _MAX_OFFSET=0
typeset _NTP_PEER=""
@@ -74,6 +76,30 @@ then
# default
_MAX_OFFSET=500
fi
_CFG_HEALTHY=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'log_healthy')
case "${_CFG_HEALTHY}" in
yes|YES|Yes)
_LOG_HEALTHY=1
;;
*)
# do not override hc_arg
(( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0
;;
esac
# log_healthy
(( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1
if (( _LOG_HEALTHY > 0 ))
then
if (( ARG_LOG > 0 ))
then
log "logging/showing passed health checks"
else
log "showing passed health checks (but not logging)"
fi
else
log "not logging/showing passed health checks"
fi
# check & get NTP status
if [[ ! -x ${_NTPQ_BIN} ]]
@@ -85,10 +111,7 @@ else
# RC is always 0
fi
#------------------------------------------------------------------------------
# evaluate ntpq results
#------------------------------------------------------------------------------
# 1) active server
_NTP_PEER="$(grep -E -e '^\*' 2>/dev/null ${HC_STDOUT_LOG} | awk '{ print $1 }')"
case ${_NTP_PEER} in
@@ -96,14 +119,10 @@ case ${_NTP_PEER} in
_MSG="NTP is synchronizing against its internal clock"
_STC=1
;;
\*[0-9]*)
*)
# some valid server
_MSG="NTP is synchronizing against ${_NTP_PEER##*\*}"
;;
*)
_MSG="NTP is not synchronizing or NTP daemon is not running"
_STC=1
;;
esac
log_hc "$0" ${_STC} "${_MSG}"