* Fixes on trap settings

* Updated check_hpux_drd_status() plugin (boot check fix)
* Added check_hpux_lunpaths() plugin
* Updated check_hpux_patch_version() plugin with fileset state check
This commit is contained in:
Patrick Van der Veken
2018-10-22 09:48:20 +02:00
parent 3a67452848
commit af81b7eb67
21 changed files with 263 additions and 427 deletions
@@ -69,7 +69,12 @@ set -o noglob # no file globbing
trap "[[ -f ${_TMP1_FILE} ]] && rm -f ${_TMP1_FILE} >/dev/null 2>&1;
[[ -f ${_TMP2_FILE} ]] && rm -f ${_TMP2_FILE} >/dev/null 2>&1;
[[ -f ${_TMP_INCL_FILE} ]] && rm -f ${_TMP_INCL_FILE} >/dev/null 2>&1;
[[ -f ${_TMP_EXCL_FILE} ]] && rm -f ${_TMP_EXCL_FILE} >/dev/null 2>&1;
[[ -f ${_TMP_EXCL_FILE} ]] && rm -f ${_TMP_EXCL_FILE} >/dev/null 2>&1;
return 0" 0
trap "[[ -f ${_TMP1_FILE} ]] && rm -f ${_TMP1_FILE} >/dev/null 2>&1;
[[ -f ${_TMP2_FILE} ]] && rm -f ${_TMP2_FILE} >/dev/null 2>&1;
[[ -f ${_TMP_INCL_FILE} ]] && rm -f ${_TMP_INCL_FILE} >/dev/null 2>&1;
[[ -f ${_TMP_EXCL_FILE} ]] && rm -f ${_TMP_EXCL_FILE} >/dev/null 2>&1;
return 1" 1 2 3 15
# handle arguments (originally comma-separated)
@@ -78,13 +83,13 @@ do
case "${_ARG}" in
help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;;
;;
esac
done
# handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]]
if [[ ! -r ${_CONFIG_FILE} ]]
then
warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1
@@ -132,29 +137,29 @@ fi
>${_STATE_FILE}
(( $? > 0 )) && {
warn "failed to create new state file at ${_STATE_FILE}"
return 1
return 1
}
log "created new state file at ${_STATE_FILE}"
}
>${_TMP_INCL_FILE}
(( $? > 0 )) && {
warn "failed to create temporary file at ${_TMP_INCL_FILE}"
return 1
return 1
}
>${_TMP_EXCL_FILE}
(( $? > 0 )) && {
warn "failed to create temporary file at ${_TMP_EXCL_FILE}"
return 1
return 1
}
>${_TMP1_FILE}
(( $? > 0 )) && {
warn "failed to create temporary file at ${_TMP1_FILE}"
return 1
return 1
}
>${_TMP2_FILE}
(( $? > 0 )) && {
warn "failed to create temporary file at ${_TMP2_FILE}"
return 1
return 1
}
# build list of configured objects: inclusion
@@ -171,7 +176,7 @@ do
;;
esac
fi
# expand directories
if [[ -d ${_INCL_OBJECT} ]]
then
@@ -195,7 +200,7 @@ do
;;
esac
fi
# expand directories
if [[ -d ${_EXCL_OBJECT} ]]
then
@@ -217,7 +222,7 @@ do
_STC=0
_MSG=""
_IS_NEW=0
# object to check must be a file (and be present)
if [[ ! -f ${_FILE_TO_CHECK} ]]
then
@@ -226,18 +231,18 @@ do
log_hc "$0" ${_STC} "${_MSG}"
continue
fi
# read entry from state file
_STATE_FILE_LINE=$(grep -E -e "^${_FILE_TO_CHECK}\|" ${_STATE_FILE} 2>/dev/null)
if [[ -n "${_STATE_FILE_LINE}" ]]
then
# field 1 is the file name
_STATE_FILE_TYPE=$(print "${_STATE_FILE_LINE}" | cut -f2 -d'|' 2>/dev/null)
_STATE_FILE_CKSUM=$(print "${_STATE_FILE_LINE}" | cut -f3 -d'|' 2>/dev/null)
_STATE_FILE_CKSUM=$(print "${_STATE_FILE_LINE}" | cut -f3 -d'|' 2>/dev/null)
else
_IS_NEW=1
fi
# compute new checksum (keep the same type as before)
if (( _IS_NEW == 0 ))
then
@@ -282,14 +287,14 @@ do
_STC=1
fi
fi
# check for failed checksums
if [[ -z "${_FILE_CKSUM}" ]]
then
_MSG="did not receive checksum (openssl/cksum) for ${_FILE_TO_CHECK}"
_STC=1
_STC=1
fi
# bounce failures back and jump to next file
if (( _STC != 0 ))
then
@@ -303,7 +308,7 @@ do
if [[ "${_STATE_FILE_CKSUM}" != "${_FILE_CKSUM}" ]]
then
_MSG="${_FILE_TO_CHECK} has a changed checksum [${_FILE_TYPE}]"
_STC=1
_STC=1
else
_MSG="${_FILE_TO_CHECK} has the same checksum [${_FILE_TYPE}]"
_STC=0
@@ -312,10 +317,10 @@ do
_MSG="${_FILE_TO_CHECK} is a new file [${_FILE_TYPE}]"
_STC=0
fi
# save entry to temp file
printf "%s|%s|%s\n" "${_FILE_TO_CHECK}" "${_FILE_TYPE}" "${_FILE_CKSUM}" >>${_TMP2_FILE}
# report with curr/exp values
log_hc "$0" ${_STC} "${_MSG}" "${_FILE_CKSUM}" "${_STATE_FILE_CKSUM}"
done <${_TMP1_FILE}
@@ -329,7 +334,7 @@ then
mv ${_TMP2_FILE} ${_STATE_FILE} >/dev/null 2>&1
(( $? > 0 )) && {
warn "failed to move temporary state file"
return 1
return 1
}
fi
@@ -352,18 +357,18 @@ CONFIG : $3 with formatted stanzas:
incl:<full path>
excl:<full path>
PURPOSE : a KISS file integrity checker (like AIDE). Supports includes and excludes
of files and directories (automatically expanded). Excludes have a higher
priority than includes. Integrity checks will only be performed on files.
of files and directories (automatically expanded). Excludes have a higher
priority than includes. Integrity checks will only be performed on files.
Will detect changed, new & deleted files (but not when deleted files
occur in an expanded directory tree). If you wish to detect deleted files:
use only direct file references in the configuration file. Uses by preference
openssl for hash calculation, with cksum as fall-back).
occur in an expanded directory tree). If you wish to detect deleted files:
use only direct file references in the configuration file. Uses by preference
openssl for hash calculation, with cksum as fall-back).
Updated and deleted files will cause a HC failure, new files will not.
CAVEAT EMPTOR: use only to check a relatively small number of files.
CAVEAT EMPTOR: use only to check a relatively small number of files.
Processing a big number of files is likely to take
ages and probably will cause the plugin to time out
ages and probably will cause the plugin to time out
(see HC_TIME_OUT). YMMV.
EOT
@@ -57,6 +57,7 @@ typeset _DO_ACU_LOGL=1
typeset _DO_CHECK=0
# set local trap for cleanup
trap "[[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1; return 0" 0
trap "[[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1; return 1" 1 2 3 15
# handle arguments (originally comma-separated)
@@ -65,13 +66,13 @@ do
case "${_ARG}" in
help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;;
;;
esac
done
# handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]]
if [[ ! -r ${_CONFIG_FILE} ]]
then
warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1
@@ -88,7 +89,7 @@ case "${_DO_ACU_CTRL}" in
0|1)
# on/off, OK
;;
*)
*)
# set default
warn "illegal value for 'do_acu_controller' in ${_CONFIG_FILE}, using default"
_DO_ACU_CTRL=1
@@ -99,7 +100,7 @@ case "${_DO_ACU_ENCL}" in
0|1)
# on/off, OK
;;
*)
*)
# set default
warn "illegal value for 'do_acu_enclosure' in ${_CONFIG_FILE}, using default"
_DO_ACU_ENCL=1
@@ -110,7 +111,7 @@ case "${_DO_ACU_PHYS}" in
0|1)
# on/off, OK
;;
*)
*)
# set default
warn "illegal value for 'do_acu_physical' in ${_CONFIG_FILE}, using default"
_DO_ACU_PHYS=1
@@ -121,7 +122,7 @@ case "${_DO_ACU_LOGL}" in
0|1)
# on/off, OK
;;
*)
*)
# set default
warn "illegal value for 'do_acu_logical' in ${_CONFIG_FILE}, using default"
_DO_ACU_LOGL=1
@@ -137,7 +138,7 @@ then
fi
# check for HP tools
if [[ ! -x ${_HPACUCLI_BIN} || -z "${_HPACUCLI_BIN}" ]]
if [[ ! -x ${_HPACUCLI_BIN} || -z "${_HPACUCLI_BIN}" ]]
then
warn "${_HPACUCLI_BIN} is not installed here"
return 1
@@ -156,7 +157,7 @@ then
_MSG="failure in controller"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done
print "=== ACU controller(s) ===" >>${HC_STDOUT_LOG}
cat ${_TMP_FILE} >>${HC_STDOUT_LOG}
@@ -173,12 +174,12 @@ then
# non-numeric
warn "found RAID controller at illegal slot?: ${_SLOT_NUM}"
;;
esac
esac
done
else
warn "${_HPACUCLI_BIN}: do_acu_controller check is not enabled"
fi
# ENCLOSURE(s)
if (( _DO_ACU_ENCL != 0 ))
then
@@ -195,7 +196,7 @@ then
_MSG="failure in enclosure for controller ${_CTRL_SLOT}"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done
print "=== ACU enclosure(s) ===" >>${HC_STDOUT_LOG}
cat ${_TMP_FILE} >>${HC_STDOUT_LOG}
@@ -220,15 +221,15 @@ then
_MSG="failure in physical drive(s) for controller ${_CTRL_SLOT}"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done
print "=== ACU physical drive(s) ===" >>${HC_STDOUT_LOG}
cat ${_TMP_FILE} >>${HC_STDOUT_LOG}
done
else
warn "${_HPACUCLI_BIN}: do_acu_physical check is not enabled"
fi
fi
# LOGICAL DRIVE(s)
if (( _DO_ACU_LOGL != 0 ))
then
@@ -245,14 +246,14 @@ then
_MSG="failure in logical drive(s) for controller ${_CTRL_SLOT}"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done
print "=== ACU logical drive(s) ===" >>${HC_STDOUT_LOG}
cat ${_TMP_FILE} >>${HC_STDOUT_LOG}
done
else
warn "${_HPACUCLI_BIN}: do_acu_logical check is not enabled"
fi
fi
# report OK situation
if (( _STC_COUNT == 0 ))
@@ -62,6 +62,7 @@ typeset _THRES_VALUE=""
typeset _TEMP_UNIT=""
# set local trap for cleanup
trap "[[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1; return 0" 0
trap "[[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1; return 1" 1 2 3 15
# handle arguments (originally comma-separated)
@@ -70,7 +71,7 @@ do
case "${_ARG}" in
help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;;
;;
esac
done
@@ -55,6 +55,9 @@ typeset _SEVERITY_ENTRY=""
typeset _EVENT_ENTRY=""
# set local trap for cleanup
trap "[[ -f ${_TMP1_FILE} ]] && rm -f ${_TMP1_FILE} >/dev/null 2>&1
[[ -f ${_TMP2_FILE} ]] && rm -f ${_TMP2_FILE} >/dev/null 2>&1
return 0" 0
trap "[[ -f ${_TMP1_FILE} ]] && rm -f ${_TMP1_FILE} >/dev/null 2>&1
[[ -f ${_TMP2_FILE} ]] && rm -f ${_TMP2_FILE} >/dev/null 2>&1
return 1" 1 2 3 15
@@ -65,13 +68,13 @@ do
case "${_ARG}" in
help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;;
;;
esac
done
# handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]]
if [[ ! -r ${_CONFIG_FILE} ]]
then
warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1
@@ -93,7 +96,7 @@ else
_HPLOG_SEVERITIES="^"
print "${_SEVERITIES_LINE}" | tr ',' '\n' 2>/dev/null | while read -r _SEVERITY_ENTRY
do
_HPLOG_SEVERITIES="${_HPLOG_SEVERITIES}(([0-9]+)\s*${_SEVERITY_ENTRY})|"
_HPLOG_SEVERITIES="${_HPLOG_SEVERITIES}(([0-9]+)\s*${_SEVERITY_ENTRY})|"
done
# delete last 'OR'
_HPLOG_SEVERITIES=${_HPLOG_SEVERITIES%?}
@@ -121,7 +124,7 @@ ${_HPLOG_BIN} -v >${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
print "## this file sorted! Do not edit manually!" >${_STATE_FILE}
(( $? > 0 )) && {
warn "failed to create new state file"
return 1
return 1
}
log "created new state file at ${_STATE_FILE}"
}
@@ -139,7 +142,7 @@ do
_MSG="${_EVENT_ENTRY}"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done <${_TMP2_FILE}
if (( _STC_COUNT > 0 ))
then
@@ -149,8 +152,8 @@ then
sort -u ${_TMP1_FILE} ${_TMP2_FILE} >${_STATE_FILE} 2>/dev/null
(( $? > 0 )) && {
warn "failed to sort temporary state file"
return 1
}
return 1
}
else
_MSG="no new HPLOG messages found"
fi
@@ -57,6 +57,7 @@ typeset _DO_SSA_LOGL=1
typeset _DO_CHECK=0
# set local trap for cleanup
trap "[[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1; return 0" 0
trap "[[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1; return 1" 1 2 3 15
# handle arguments (originally comma-separated)
@@ -65,13 +66,13 @@ do
case "${_ARG}" in
help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;;
;;
esac
done
# handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]]
if [[ ! -r ${_CONFIG_FILE} ]]
then
warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1
@@ -88,7 +89,7 @@ case "${_DO_SSA_CTRL}" in
0|1)
# on/off, OK
;;
*)
*)
# set default
warn "illegal value for 'do_ssa_controller' in ${_CONFIG_FILE}, using default"
_DO_SSA_CTRL=1
@@ -99,7 +100,7 @@ case "${_DO_SSA_ENCL}" in
0|1)
# on/off, OK
;;
*)
*)
# set default
warn "illegal value for 'do_ssa_enclosure' in ${_CONFIG_FILE}, using default"
_DO_SSA_ENCL=1
@@ -110,7 +111,7 @@ case "${_DO_SSA_PHYS}" in
0|1)
# on/off, OK
;;
*)
*)
# set default
warn "illegal value for 'do_ssa_physical' in ${_CONFIG_FILE}, using default"
_DO_SSA_PHYS=1
@@ -121,7 +122,7 @@ case "${_DO_SSA_LOGL}" in
0|1)
# on/off, OK
;;
*)
*)
# set default
warn "illegal value for 'do_ssa_logical' in ${_CONFIG_FILE}, using default"
_DO_SSA_LOGL=1
@@ -137,7 +138,7 @@ then
fi
# check for HP tools
if [[ ! -x ${_HPSSACLI_BIN} || -z "${_HPSSACLI_BIN}" ]]
if [[ ! -x ${_HPSSACLI_BIN} || -z "${_HPSSACLI_BIN}" ]]
then
warn "${_HPSSACLI_BIN} is not installed here"
return 1
@@ -156,7 +157,7 @@ then
_MSG="failure in controller"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done
print "=== SSA controller(s) ===" >>${HC_STDOUT_LOG}
cat ${_TMP_FILE} >>${HC_STDOUT_LOG}
@@ -173,12 +174,12 @@ then
# non-numeric
warn "found RAID controller at illegal slot?: ${_SLOT_NUM}"
;;
esac
esac
done
else
warn "${_HPSSACLI_BIN}: do_ssa_controller check is not enabled"
fi
# ENCLOSURE(s)
if (( _DO_SSA_ENCL != 0 ))
then
@@ -195,7 +196,7 @@ then
_MSG="failure in enclosure for controller ${_CTRL_SLOT}"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done
print "=== SSA enclosure(s) ===" >>${HC_STDOUT_LOG}
cat ${_TMP_FILE} >>${HC_STDOUT_LOG}
@@ -220,15 +221,15 @@ then
_MSG="failure in physical drive(s) for controller ${_CTRL_SLOT}"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done
print "=== SSA physical drive(s) ===" >>${HC_STDOUT_LOG}
cat ${_TMP_FILE} >>${HC_STDOUT_LOG}
done
else
warn "${_HPSSACLI_BIN}: do_ssa_physical check is not enabled"
fi
fi
# LOGICAL DRIVE(s)
if (( _DO_SSA_LOGL != 0 ))
then
@@ -245,14 +246,14 @@ then
_MSG="failure in logical drive(s) for controller ${_CTRL_SLOT}"
_STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result
log_hc "$0" 1 "${_MSG}"
log_hc "$0" 1 "${_MSG}"
done
print "=== SSA logical drive(s) ===" >>${HC_STDOUT_LOG}
cat ${_TMP_FILE} >>${HC_STDOUT_LOG}
done
else
warn "${_HPSSACLI_BIN}: do_ssa_logical check is not enabled"
fi
fi
# report OK situation
if (( _STC_COUNT == 0 ))
@@ -66,6 +66,7 @@ typeset _USER_PS_PID=""
typeset _USER_PS_COMM=""
# set local trap for cleanup
trap "rm -f ${_INSTANCE_RUN_FILE}.* >/dev/null 2>&1; return 0" 0
trap "rm -f ${_INSTANCE_RUN_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
# handle arguments (originally comma-separated)
@@ -92,7 +93,7 @@ case "${_CFG_HEALTHY}" in
_LOG_HEALTHY=1
;;
*)
# do not override hc_arg
# do not override hc_arg
(( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0
;;
esac
@@ -320,14 +321,14 @@ then
awk -v f="${_LIMIT_FIELD}" '{ print $f}' 2>/dev/null)
_MSG_BIT="${_LIMIT_PID}/${_LIMIT_USER}/${_LIMIT_PROCESS}"
;;
"Max processes")
"Max processes")
case "${_LIMIT_TYPE}" in
soft)
_LIMIT_COMMAND="ulimit -a"
;;
hard)
_LIMIT_COMMAND="ulimit -Ha"
;;
;;
esac
_LIMIT_VALUE=$(su - ${_LIMIT_USER} -c "${_LIMIT_COMMAND}" 2>/dev/null |\
grep -i "max user processes" 2>/dev/null | sed -s "s/max user processes//g" 2>/dev/null |\
@@ -337,8 +338,8 @@ then
warn "${_LIMIT_TYPE}: unable to gather limits information (${_LIMIT_USER})"
return 1
fi
_MSG_BIT="${_LIMIT_USER}"
;;
_MSG_BIT="${_LIMIT_USER}"
;;
esac
# check limit value -> threshold
if [[ "${_LIMIT_VALUE}" = "unlimited" ]]
@@ -37,7 +37,7 @@ typeset _VERSION="2018-05-21" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
# rubbish that cmgetconf outputs to STDOUT instead of STDERR
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
@@ -59,6 +59,7 @@ typeset _CLUSTER_PARAM=""
typeset _CLUSTER_VALUE=""
# set local trap for cleanup
trap "rm -f ${_CLUSTER_RUN_FILE}.* ${_CLUSTER_CFG_FILE}.* >/dev/null 2>&1; return 0" 0
trap "rm -f ${_CLUSTER_RUN_FILE}.* ${_CLUSTER_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
# handle arguments (originally comma-separated)
@@ -67,13 +68,13 @@ do
case "${_ARG}" in
help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;;
;;
esac
done
# handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]]
if [[ ! -r ${_CONFIG_FILE} ]]
then
warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1
@@ -92,7 +93,7 @@ then
fi
# check serviceguard status & gather cluster information from running cluster (compressed lines)
if [[ ! -x ${_SG_DAEMON} ]]
if [[ ! -x ${_SG_DAEMON} ]]
then
warn "${_SG_DAEMON} is not installed here"
return 1
@@ -118,10 +119,10 @@ do
BEGIN { found = 0; needle = "^\["cluster"\]" }
# skip blank lines
/^\s*$/ { next; }
/^\s*$/ { next; }
# skip comment lines
/^#/ { next; }
/^#/ { next; }
# end marker
( $0 ~ /^\[.*\]/ && found ) {
found = 0;
@@ -160,7 +161,7 @@ do
else
_MSG="'${_CLUSTER_PARAM} (${_CLUSTER_VALUE} ...)' is configured for ${_CLUSTER_INSTANCE}"
fi
# handle unit result
log_hc "$0" ${_STC} "${_MSG}"
_STC=0
@@ -37,7 +37,7 @@ typeset _VERSION="2018-05-21" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
# rubbish that cmgetconf outputs to STDOUT instead of STDERR
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
@@ -59,6 +59,7 @@ typeset _PKG_PARAM=""
typeset _PKG_VALUE=""
# set local trap for cleanup
trap "rm -f ${_PKG_RUN_FILE}.* ${_PKG_CFG_FILE}.* >/dev/null 2>&1; return 0" 0
trap "rm -f ${_PKG_RUN_FILE}.* ${_PKG_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
# handle arguments (originally comma-separated)
@@ -67,13 +68,13 @@ do
case "${_ARG}" in
help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;;
;;
esac
done
# handle config file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]]
if [[ ! -r ${_CONFIG_FILE} ]]
then
warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1
@@ -92,7 +93,7 @@ then
fi
# check serviceguard status & gather package information from running cluster (compressed lines)
if [[ ! -x ${_SG_DAEMON} ]]
if [[ ! -x ${_SG_DAEMON} ]]
then
warn "${_SG_DAEMON} is not installed here"
return 1
@@ -118,10 +119,10 @@ do
BEGIN { found = 0; needle = "^\["package"\]" }
# skip blank lines
/^\s*$/ { next; }
/^\s*$/ { next; }
# skip comment lines
/^#/ { next; }
/^#/ { next; }
# end marker
( $0 ~ /^\[.*\]/ && found ) {
found = 0;
@@ -160,13 +161,13 @@ do
else
_MSG="'${_PKG_PARAM} (${_PKG_VALUE} ...)' is configured for ${_PKG_INSTANCE}"
fi
# handle unit result
log_hc "$0" ${_STC} "${_MSG}"
_STC=0
done <${_PKG_CFG_FILE}.${_PKG_INSTANCE}
done
# remove working files
rm -f ${_PKG_RUN_FILE}.* ${_PKG_CFG_FILE}.* >/dev/null 2>&1
@@ -181,7 +182,7 @@ NAME : $1
VERSION : $2
CONFIG : $3
PURPOSE : Checks the configuration of Serviceguard package parameters (SG 11.16+)
(comparing serialized strings from the HC configuration file to the
(comparing serialized strings from the HC configuration file to the
running cluster configuration)
EOT