Fixed in clusterware plugins & others

This commit is contained in:
Patrick Van der Veken 2019-04-26 13:07:52 +02:00
parent 556da803d7
commit a6c907f236
5 changed files with 56 additions and 32 deletions

View File

@ -11,6 +11,10 @@
# [default: no] # [default: no]
log_healthy="no" log_healthy="no"
# location of the crsctl tool
# [default: null (autodiscovery)]
crsctl_bin=""
# stanza(s) of resource definitions (case sensitive). # stanza(s) of resource definitions (case sensitive).
# Example: # Example:
#[myresource] #[myresource]

View File

@ -11,6 +11,10 @@
# [default: no] # [default: no]
log_healthy="no" log_healthy="no"
# location of the crsctl tool
# [default: null (autodiscovery)]
crsctl_bin=""
# list of required resource statuses # list of required resource statuses
# Format: # Format:
# crs:<resource_name>:<*|node>=<ONLINE|OFFLINE>,<*|node>=<ONLINE|OFFLINE>,... # crs:<resource_name>:<*|node>=<ONLINE|OFFLINE>,<*|node>=<ONLINE|OFFLINE>,...

View File

@ -23,6 +23,7 @@
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2019-04-20: merged HP-UX+Linux version + fixes [Patrick Van der Veken] # @(#) 2019-04-20: merged HP-UX+Linux version + fixes [Patrick Van der Veken]
# @(#) 2019-04-26: made _CRSCTL_BIN path configurable + fix [Patrick Van der Veken]
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! # DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
#****************************************************************************** #******************************************************************************
@ -32,7 +33,7 @@ function check_clusterware_resource_config
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-04-20" # YYYY-MM-DD typeset _VERSION="2019-04-26" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
typeset _MAX_LENGTH_VALUE_STRING=30 typeset _MAX_LENGTH_VALUE_STRING=30
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -88,6 +89,19 @@ case "${_CFG_HEALTHY}" in
(( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0 (( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0
;; ;;
esac esac
_CRSCTL_BIN=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'crsctl_bin')
if [[ -z "${_CRSCTL_BIN}" ]]
then
_CRSCTL_BIN="$(command -v crsctl 2>>${HC_STDERR_LOG})"
[[ -n "${_CRSCTL_BIN}" ]] && (( ARG_DEBUG > 0 )) && debug "crsctl path: ${_CRSCTL_BIN} (discover)"
else
(( ARG_DEBUG > 0 )) && debug "crsctl path: ${_CRSCTL_BIN} (config)"
fi
if [[ -z "${_CRSCTL_BIN}" || ! -x ${_CRSCTL_BIN} ]]
then
warn "could not determine location for CRS {crsctl} (or it is not installed here)"
return 1
fi
# log_healthy # log_healthy
(( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1 (( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1
@ -116,25 +130,18 @@ then
fi fi
# get resource information from crsctl # get resource information from crsctl
_CRSCTL_BIN="$(command -v crsctl 2>>${HC_STDERR_LOG})" for _RES_INSTANCE in ${_RES_INSTANCES}
if [[ -z "${_CRSCTL_BIN}" || ! -x ${_CRSCTL_BIN} ]] do
then ${_CRSCTL_BIN} status resource ${_RES_INSTANCE} -f 2>>${HC_STDERR_LOG} |\
warn "CRS {crsctl} is not installed here"
return 1
else
for _RES_INSTANCE in ${_RES_INSTANCES}
do
crsctl status resource ${_RES_INSTANCE} -f 2>>${HC_STDERR_LOG} |\
tr -d ' \t' >${_RES_RUN_FILE}.${_RES_INSTANCE} 2>/dev/null tr -d ' \t' >${_RES_RUN_FILE}.${_RES_INSTANCE} 2>/dev/null
[[ -s ${_RES_RUN_FILE}.${_RES_INSTANCE} ]] || { [[ -s ${_RES_RUN_FILE}.${_RES_INSTANCE} ]] || {
_MSG="unable to gather configuration cluster resource ${_RES_INSTANCE}" _MSG="unable to run command: {${_CRSCTL_BIN} status resource -f ${_RES_INSTANCE}}"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
# dump debug info # dump debug info
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs (( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1 return 1
} }
done done
fi
# gather resource information from healthcheck configuration # gather resource information from healthcheck configuration
for _RES_INSTANCE in ${_RES_INSTANCES} for _RES_INSTANCE in ${_RES_INSTANCES}
@ -221,6 +228,7 @@ NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with parameters: CONFIG : $3 with parameters:
log_healthy=<yes|no> log_healthy=<yes|no>
crsctl_bin=<path_to_crsctl>
and formatted stanzas for resource definitions and formatted stanzas for resource definitions
PURPOSE : Checks the configuration of Clusterware resources (parameters/values) PURPOSE : Checks the configuration of Clusterware resources (parameters/values)
(comparing serialized strings from the HC configuration file to the (comparing serialized strings from the HC configuration file to the

View File

@ -24,6 +24,7 @@
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2019-04-20: merged HP-UX+Linux version [Patrick Van der Veken] # @(#) 2019-04-20: merged HP-UX+Linux version [Patrick Van der Veken]
# @(#) 2019-04-26: made _CRSCTL_BIN path configurable + fix [Patrick Van der Veken]
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! # DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
#****************************************************************************** #******************************************************************************
@ -33,7 +34,7 @@ function check_clusterware_resource_status
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-04-20" # YYYY-MM-DD typeset _VERSION="2019-04-26" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -85,6 +86,19 @@ case "${_CFG_HEALTHY}" in
(( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0 (( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0
;; ;;
esac esac
_CRSCTL_BIN=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'crsctl_bin')
if [[ -z "${_CRSCTL_BIN}" ]]
then
_CRSCTL_BIN="$(command -v crsctl 2>>${HC_STDERR_LOG})"
[[ -n "${_CRSCTL_BIN}" ]] && (( ARG_DEBUG > 0 )) && debug "crsctl path: ${_CRSCTL_BIN} (discover)"
else
(( ARG_DEBUG > 0 )) && debug "crsctl path: ${_CRSCTL_BIN} (config)"
fi
if [[ -z "${_CRSCTL_BIN}" || ! -x ${_CRSCTL_BIN} ]]
then
warn "could not determine location for CRS {crsctl} (or it is not installed here)"
return 1
fi
# log_healthy # log_healthy
(( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1 (( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1
@ -100,24 +114,16 @@ else
log "not logging/showing passed health checks" log "not logging/showing passed health checks"
fi fi
# check for clusterware
_CRSCTL_BIN="$(command -v crsctl 2>>${HC_STDERR_LOG})"
if [[ -z "${_CRSCTL_BIN}" || ! -x ${_CRSCTL_BIN} ]]
then
warn "CRS {crsctl} is not installed here"
return 1
fi
# do resource status checks # do resource status checks
grep -E -e "^crs:" ${_CONFIG_FILE} 2>/dev/null |\ grep -E -e "^crs:" ${_CONFIG_FILE} 2>/dev/null |\
while IFS=":" read -r _ _CRS_RESOURCE _CRS_STATES while IFS=":" read -r _ _CRS_RESOURCE _CRS_STATES
do do
# get actual resource info # get actual resource info
(( ARG_DEBUG > 0 )) && debug "checking for resource: ${_CRS_RESOURCE}" (( ARG_DEBUG > 0 )) && debug "checking for resource: ${_CRS_RESOURCE}"
_CRSCTL_STATUS=$(crsctl status resource "${_CRS_RESOURCE}" 2>>${HC_STDERR_LOG}) _CRSCTL_STATUS=$(${_CRSCTL_BIN} status resource "${_CRS_RESOURCE}" 2>>${HC_STDERR_LOG})
if (( $? > 0 )) || [[ -z "${_CRSCTL_STATUS}" ]] if (( $? > 0 )) || [[ -z "${_CRSCTL_STATUS}" ]]
then then
_MSG="unable to run command: {crsctl status resource ${_CRS_RESOURCE}}" _MSG="unable to run command: {${_CRSCTL_BIN} status resource ${_CRS_RESOURCE}}"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
# dump debug info # dump debug info
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs (( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
@ -202,6 +208,7 @@ NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with parameters: CONFIG : $3 with parameters:
log_healthy=<yes|no> log_healthy=<yes|no>
crsctl_bin=<path_to_crsctl>
and formatted stanzas: and formatted stanzas:
crs:<resource_name>:<*|node>=<ONLINE|OFFLINE>,<*|node>=<ONLINE|OFFLINE>,... crs:<resource_name>:<*|node>=<ONLINE|OFFLINE>,<*|node>=<ONLINE|OFFLINE>,...
PURPOSE : Checks the STATE of CRS resource(s) PURPOSE : Checks the STATE of CRS resource(s)

View File

@ -29,6 +29,7 @@
# @(#) 2019-02-04: fix in cleanup [Patrick Van der Veken] # @(#) 2019-02-04: fix in cleanup [Patrick Van der Veken]
# @(#) 2019-02-18: fixes + help update [Patrick Van der Veken] # @(#) 2019-02-18: fixes + help update [Patrick Van der Veken]
# @(#) 2019-03-25: exclude /dev/loop* + rationalization [Patrick Van der Veken] # @(#) 2019-03-25: exclude /dev/loop* + rationalization [Patrick Van der Veken]
# @(#) 2019-04-26: small string fix [Patrick Van der Veken]
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! # DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
#****************************************************************************** #******************************************************************************
@ -38,7 +39,7 @@ function check_linux_fs_usage
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-03-25" # YYYY-MM-DD typeset _VERSION="2019-04-26" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -160,7 +161,7 @@ then
if (( $? > 0 )) if (( $? > 0 ))
then then
# df exits >0 if there are issues with some filesystems, consider non-fatal # df exits >0 if there are issues with some filesystems, consider non-fatal
warn "error(s) occurred executing the {df -Pil}" warn "error(s) occurred executing {df -Pil}"
fi fi
fi fi
if (( _DO_SPACE > 0 )) if (( _DO_SPACE > 0 ))