Added support for --log-healthy (AIX plugins)

This commit is contained in:
patvdv 2019-03-10 16:31:15 +01:00
parent cced8a893c
commit c3cc87609d
15 changed files with 449 additions and 142 deletions

View File

@ -6,9 +6,18 @@
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************
# file (full path); maximum age in minutes since last change # specify whether to also log passed health checks
/var/adm/ras/syslog.caa;600 # (warning: this may rapidly grow the HC log)
/var/log/ntp.log;30 # [default: no]
log_healthy="no"
# specify file details
# Format:
# file:<file_path>:<max_age_minutes_since_last_change>
# Examples:
#file:/var/log/messages:60
#file:/var/log/ntp.log:30
#****************************************************************************** #******************************************************************************
# End of FILE # End of FILE

View File

@ -6,6 +6,11 @@
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************
# specify whether to also log passed health checks
# (warning: this may rapidly grow the HC log)
# [default: no]
log_healthy="no"
# name of the state file to use (will be relative to /var/opt/hc/state/persistent # name of the state file to use (will be relative to /var/opt/hc/state/persistent
# [default: discovered.file_change] # [default: discovered.file_change]
state_file=discovered.file_change state_file=discovered.file_change

View File

@ -6,10 +6,19 @@
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************
# specify whether to also log passed health checks
# (warning: this may rapidly grow the HC log)
# [default: no]
log_healthy="no"
# list of commands (or strings) that should appear in active cron entries # list of commands (or strings) that should appear in active cron entries
/opt/cfg2html/bin/cfg2html_aix.sh # Format:
/usr/local/bin/run_aix_system_backup.sh # cron:<cron_entry>
/usr/bin/nmon # Examples:
#cron:/opt/cfg2html/bin/cfg2html_aix.sh
#cron:/usr/local/bin/run_aix_system_backup.sh
#cron:/usr/bin/nmon
#****************************************************************************** #******************************************************************************
# End of FILE # End of FILE

View File

@ -6,29 +6,38 @@
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************
# specify whether to also log passed health checks
# (warning: this may rapidly grow the HC log)
# [default: no]
log_healthy="no"
# list of required active subsystems # list of required active subsystems
sendmail # Format:
syslogd # subsys:<subsystem_name>
portmap # Examples:
inetd #subsys:sendmail
snmpd #subsys:syslogd
hostmibd #subsys:portmap
snmpmibd #subsys:inetd
aixmibd #subsys:snmpd
#nimsh #subsys:hostmibd
biod #subsys:snmpmibd
rpc.statd #subsys:aixmibd
rpc.lockd #subsys:nimsh
automountd #subsys:biod
qdaemon #subsys:rpc.statd
writesrv #subsys:rpc.lockd
sshd #subsys:qdaemon
xntpd #subsys:automountd
cimsys #subsys:writesrv
ctrmc #subsys:sshd
IBM.ServiceRM #subsys:xntpd
IBM.DRM #subsys:cimsys
IBM.CSMAgentRM #subsys:ctrmc
#subsys:IBM.ServiceRM
#subsys:IBM.DRM
#subsys:IBM.CSMAgentRM
#****************************************************************************** #******************************************************************************
# End of FILE # End of FILE

View File

@ -6,6 +6,11 @@
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************
# specify whether to also log passed health checks
# (warning: this may rapidly grow the HC log)
# [default: no]
log_healthy="no"
# full path to the location of mksysb images, the tool expects sub-directories # full path to the location of mksysb images, the tool expects sub-directories
# per host underneath this location # per host underneath this location
backup_path=/export/images backup_path=/export/images
@ -17,6 +22,7 @@ mksysb_log=mksysb.log
# [default: 14] # [default: 14]
backup_age=14 backup_age=14
#****************************************************************************** #******************************************************************************
# End of FILE # End of FILE
#****************************************************************************** #******************************************************************************

View File

@ -27,6 +27,7 @@
# @(#) 2013-06-24: big fix errpt last check time [Patrick Van der Veken] # @(#) 2013-06-24: big fix errpt last check time [Patrick Van der Veken]
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken] # @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added support for --log-healthy [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!
#****************************************************************************** #******************************************************************************
@ -35,7 +36,7 @@
function check_aix_errpt function check_aix_errpt
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -46,6 +47,7 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _LOG_HEALTHY=0
typeset _LAST_TIME_CHECK="" typeset _LAST_TIME_CHECK=""
typeset _LAST_TIME_FILE="" typeset _LAST_TIME_FILE=""
typeset _LABEL="" typeset _LABEL=""
@ -61,6 +63,20 @@ do
esac esac
done done
# 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 for last known check date # check for last known check date
_LAST_TIME_FILE="${STATE_DIR}/$0.lasttime" _LAST_TIME_FILE="${STATE_DIR}/$0.lasttime"
if [[ -r ${_LAST_TIME_FILE} ]] if [[ -r ${_LAST_TIME_FILE} ]]
@ -79,8 +95,8 @@ then
errpt -A >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} errpt -A >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
else else
errpt -s "${_LAST_TIME_CHECK}" |\ errpt -s "${_LAST_TIME_CHECK}" |\
grep -v "${_LAST_TIME_CHECK}" | grep -v "_IDENTIFIER" |\ grep -v "${_LAST_TIME_CHECK}" 2>/dev/null | grep -v "_IDENTIFIER" 2>/dev/null |\
awk '{ print $1}' | uniq | while read _LABEL awk '{ print $1}' 2>/dev/null | uniq 2>/dev/null | while read _LABEL
do do
errpt -a -j ${_LABEL} -s "${_LAST_TIME_CHECK}" \ errpt -a -j ${_LABEL} -s "${_LAST_TIME_CHECK}" \
>>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
@ -99,7 +115,7 @@ fi
# update last known check date/time (potential race condition here, # update last known check date/time (potential race condition here,
# but we can live it :-)) # but we can live it :-))
_NEW_CHECK_TIME="$(errpt 2>/dev/null | head -n 2 | tail -n 1 | awk '{print $2}')" _NEW_CHECK_TIME="$(errpt 2>/dev/null | head -n 2 2>/dev/null | tail -n 1 2>/dev/null | awk '{print $2}' 2>/dev/null)"
# blank result indicates either no errpt entries or exist the time call failed # blank result indicates either no errpt entries or exist the time call failed
if [[ -n "${_NEW_CHECK_TIME}" ]] if [[ -n "${_NEW_CHECK_TIME}" ]]
then then
@ -110,7 +126,10 @@ else
fi fi
# handle results # handle results
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
return 0 return 0
} }
@ -119,10 +138,10 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 PURPOSE : Checks AIX errpt for new error(s)
PURPOSE : Checks AIX errpt for new error(s) LOG HEALTHY : Supported
EOT EOT

View File

@ -25,6 +25,8 @@
# @(#) 2013-05-27: initial version [Patrick Van der Veken] # @(#) 2013-05-27: initial version [Patrick Van der Veken]
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken] # @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added code for data_is_numeric(), changed format of configuration
# @(#) file (; -> :) & added support for --log-healthy [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!
#****************************************************************************** #******************************************************************************
@ -34,7 +36,7 @@ function check_aix_file_age
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -45,12 +47,14 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _ENTRY="" typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _AGE_CHECK="" typeset _AGE_CHECK=""
typeset _FILE_PATH="" typeset _FILE_PATH=""
typeset _FILE_AGE="" typeset _FILE_AGE=""
typeset _FILE_NAME="" typeset _FILE_NAME=""
typeset _FILE_DIR="" typeset _FILE_DIR=""
typeset _IS_OLD_STYLE=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
for _ARG in ${_ARGS} for _ARG in ${_ARGS}
@ -69,14 +73,42 @@ then
warn "unable to read configuration file at ${_CONFIG_FILE}" warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1 return 1
fi 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
# check for old-style configuration file (non-prefixed stanzas)
_IS_OLD_STYLE=$(grep -c -E -e "^file:" ${_CONFIG_FILE} 2>/dev/null)
if (( _IS_OLD_STYLE == 0 ))
then
warn "no 'file:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?"
return 1
fi
# 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
# perform check # perform check
grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | while read _ENTRY grep -E -e "^file:" ${_CONFIG_FILE} 2>/dev/null | while IFS=":" read -r _ _FILE_PATH _FILE_AGE
do do
# field split
_FILE_PATH="$(print ${_ENTRY%%;*})"
_FILE_AGE="$(print ${_ENTRY##*;})"
# split file/dir # split file/dir
_FILE_NAME="$(print ${_FILE_PATH##*/})" _FILE_NAME="$(print ${_FILE_PATH##*/})"
_FILE_DIR="$(print ${_FILE_PATH%/*})" _FILE_DIR="$(print ${_FILE_PATH%/*})"
@ -87,16 +119,12 @@ do
warn "missing values in configuration file at ${_CONFIG_FILE}" warn "missing values in configuration file at ${_CONFIG_FILE}"
return 1 return 1
fi fi
case "${_FILE_AGE}" in data_is_numeric "${_FILE_AGE}"
+([0-9])*(.)*([0-9])) if (( $? > 0 ))
# numeric, OK then
;; warn "invalid file age value '${_FILE_AGE}' in configuration file at ${_CONFIG_FILE}"
*) return 1
# not numeric fi
warn "invalid file age value '${_FILE_AGE}' in configuration file at ${_CONFIG_FILE}"
return 1
;;
esac
# perform check # perform check
if [[ ! -r "${_FILE_PATH}" ]] if [[ ! -r "${_FILE_PATH}" ]]
@ -119,8 +147,11 @@ do
fi fi
fi fi
# handle unit result # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
@ -131,12 +162,15 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
<file_name>;<maximum_age_in_minutes> log_healthy=<yes|no>
PURPOSE : Checks whether given files have been changed in the last n minutes and formatted stanzas:
Requires {find -mmin}. file:<file_path>:<max_age_in_minutes>
PURPOSE : Checks whether given files have been changed in the last n minutes
Requires {find -mmin}.
LOG HEALTHY : Supported
EOT EOT

View File

@ -27,6 +27,7 @@
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken] # @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
# @(#) 2018-11-18: do not trap on signal 0 [Patrick Van der Veken] # @(#) 2018-11-18: do not trap on signal 0 [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added support for --log-healthy [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!
#****************************************************************************** #******************************************************************************
@ -36,7 +37,7 @@ function check_aix_file_change
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -47,6 +48,8 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _DO_META_CHECK=0 typeset _DO_META_CHECK=0
typeset _CFG_STATE_FILE="" typeset _CFG_STATE_FILE=""
typeset _STATE_FILE="" typeset _STATE_FILE=""
@ -111,6 +114,30 @@ case "${_DO_META_CHECK}" in
log "check for meta characters is enabled" log "check for meta characters is enabled"
;; ;;
esac esac
_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 for checksum tools # check for checksum tools
_OPENSSL_BIN="$(which openssl 2>>${HC_STDERR_LOG})" _OPENSSL_BIN="$(which openssl 2>>${HC_STDERR_LOG})"
@ -293,7 +320,7 @@ do
fi fi
# bounce failures back and jump to next file # bounce failures back and jump to next file
if (( _STC > 0 )) if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
continue continue
@ -319,7 +346,11 @@ do
printf "%s|%s|%s\n" "${_FILE_TO_CHECK}" "${_FILE_TYPE}" "${_FILE_CKSUM}" >>${_TMP2_FILE} printf "%s|%s|%s\n" "${_FILE_TO_CHECK}" "${_FILE_TYPE}" "${_FILE_CKSUM}" >>${_TMP2_FILE}
# report with curr/exp values # report with curr/exp values
log_hc "$0" ${_STC} "${_MSG}" "${_FILE_CKSUM}" "${_STATE_FILE_CKSUM}" if (( _LOG_HEALTHY > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_FILE_CKSUM}" "${_STATE_FILE_CKSUM}"
continue
fi
done <${_TMP1_FILE} done <${_TMP1_FILE}
# update state file (also if TMP2_FILE is empty) # update state file (also if TMP2_FILE is empty)
@ -348,23 +379,26 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with formatted stanzas: CONFIG : $3 with parameters:
incl:<full path> log_healthy=<yes|no>
excl:<full path> and formatted stanzas:
PURPOSE : a KISS file integrity checker (like AIDE). Supports includes and excludes incl:<full path>
of files and directories (automatically expanded). Excludes have a higher excl:<full path>
priority than includes. Integrity checks will only be performed on files. PURPOSE : a KISS file integrity checker (like AIDE). Supports includes and excludes
Will detect changed, new & deleted files (but not when deleted files of files and directories (automatically expanded). Excludes have a higher
occur in an expanded directory tree). If you wish to detect deleted files: priority than includes. Integrity checks will only be performed on files.
use only direct file references in the configuration file. Uses by preference Will detect changed, new & deleted files (but not when deleted files
openssl for hash calculation, with cksum as fall-back). occur in an expanded directory tree). If you wish to detect deleted files:
Updated and deleted files will cause a HC failure, new files will not. use only direct file references in the configuration file. Uses by preference
CAVEAT EMPTOR: use only to check a relatively small number of files. 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.
Processing a big number of files is likely to take 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. (see HC_TIME_OUT). YMMV.
LOG HEALTHY : Supported
EOT EOT

View File

@ -24,6 +24,7 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-05-15: initial version [Patrick Van der Veken] # @(#) 2013-05-15: initial version [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added support for --log-healthy [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_aix_fs_mounts function check_aix_fs_mounts
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -43,6 +44,7 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _LOG_HEALTHY=0
typeset _FS="" typeset _FS=""
typeset _FS_COUNT="" typeset _FS_COUNT=""
@ -56,6 +58,20 @@ do
esac esac
done done
# 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
# collect data (mount & lsfs output may be safely merged) # collect data (mount & lsfs output may be safely merged)
mount >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} mount >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? == 0)) || return $? (( $? == 0)) || return $?
@ -83,8 +99,11 @@ do
;; ;;
esac esac
# handle unit result # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
@ -95,10 +114,10 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 PURPOSE : Checks whether file systems are mounted or not {lsfs/mount}
PURPOSE : Checks whether file systems are mounted or not {lsfs/mount} LOG HEALTHY : Supported
EOT EOT

View File

@ -24,6 +24,7 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-05-17: initial version [Patrick Van der Veken] # @(#) 2013-05-17: initial version [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added support for --log-healthy [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_aix_lppchk function check_aix_lppchk
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -43,6 +44,7 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _LOG_HEALTHY=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
for _ARG in ${_ARGS} for _ARG in ${_ARGS}
@ -54,6 +56,20 @@ do
esac esac
done done
# 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
# collect data # collect data
lppchk -v -m1 >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} lppchk -v -m1 >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? == 0)) || return $? (( $? == 0)) || return $?
@ -67,8 +83,11 @@ else
_MSG="lppchk passed without errors" _MSG="lppchk passed without errors"
fi fi
# handle results # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
return 0 return 0
} }
@ -77,10 +96,10 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 PURPOSE : Run {lppchk -v}
PURPOSE : Run {lppchk -v} LOG HEALTHY : Supported
EOT EOT

View File

@ -24,6 +24,7 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-05-07: initial version [Patrick Van der Veken] # @(#) 2013-05-07: initial version [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added support for --log-healthy [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_aix_paths function check_aix_paths
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -43,6 +44,7 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _LOG_HEALTHY=0
typeset _PATH="" typeset _PATH=""
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
@ -55,6 +57,20 @@ do
esac esac
done done
# 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
# collect data # collect data
lspath >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} lspath >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? == 0)) || return $? (( $? == 0)) || return $?
@ -71,8 +87,11 @@ case ${_PATH} in
;; ;;
esac esac
# handle results # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
return 0 return 0
} }
@ -81,10 +100,10 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 PURPOSE : Checks whether any hardware paths are missing {lspath}
PURPOSE : Checks whether any hardware paths are missing {lspath} LOG HEALTHY : Supported
EOT EOT

View File

@ -24,6 +24,8 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-09-19: initial version [Patrick Van der Veken] # @(#) 2013-09-19: initial version [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: changed format of stanzas in configuration file &
# @(#) added support for --log-healthy [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 +35,7 @@ function check_aix_root_crontab
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -44,8 +46,11 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _CRON_ENTRY="" typeset _CRON_ENTRY=""
typeset _CRON_MATCH=0 typeset _CRON_MATCH=0
typeset _IS_OLD_STYLE=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
for _ARG in ${_ARGS} for _ARG in ${_ARGS}
@ -57,7 +62,6 @@ do
esac esac
done done
# handle configuration file # handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}" [[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]] if [[ ! -r ${_CONFIG_FILE} ]]
@ -65,12 +69,44 @@ then
warn "unable to read configuration file at ${_CONFIG_FILE}" warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1 return 1
fi 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
# check for old-style configuration file (non-prefixed stanzas)
_IS_OLD_STYLE=$(grep -c -E -e "^cron:" ${_CONFIG_FILE} 2>/dev/null)
if (( _IS_OLD_STYLE == 0 ))
then
warn "no 'cron:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?"
return 1
fi
# 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
# collect data # collect data
crontab -l >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} crontab -l >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
# perform check # perform check
grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | while read _CRON_ENTRY grep -E -e "^cron:" ${_CONFIG_FILE} 2>/dev/null | while IFS=":" read -r _ _CRON_ENTRY
do do
_CRON_MATCH=$(grep -v '^#' ${HC_STDOUT_LOG} 2>/dev/null |\ _CRON_MATCH=$(grep -v '^#' ${HC_STDOUT_LOG} 2>/dev/null |\
grep -c -E -e "${_CRON_ENTRY}") grep -c -E -e "${_CRON_ENTRY}")
@ -87,8 +123,11 @@ do
;; ;;
esac esac
# handle unit result # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
@ -99,10 +138,14 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 CONFIG : $3 with parameters:
PURPOSE : Checks the content of the 'root' user crontab for required entries log_healthy=<yes|no>
and formatted stanzas:
cron:<cron_entry>
PURPOSE : Checks the content of the 'root' user crontab for required entries
LOG HEALTHY : Supported
EOT EOT

View File

@ -24,6 +24,8 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-05-07: initial version [Patrick Van der Veken] # @(#) 2013-05-07: initial version [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: changed format of stanzas in configuration file &
# @(#) added support for --log-healthy [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 +35,7 @@ function check_aix_subsystems
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -44,7 +46,10 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _STATUS="" typeset _STATUS=""
typeset _IS_OLD_STYLE=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
for _ARG in ${_ARGS} for _ARG in ${_ARGS}
@ -64,13 +69,31 @@ then
warn "unable to read configuration file at ${_CONFIG_FILE}" warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1 return 1
fi 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
# check for old-style configuration file (non-prefixed stanzas)
_IS_OLD_STYLE=$(grep -c -E -e "^subsys:" ${_CONFIG_FILE} 2>/dev/null)
if (( _IS_OLD_STYLE == 0 ))
then
warn "no 'subsys:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?"
return 1
fi
# collect data # collect data
lssrc -a >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} lssrc -a >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? == 0)) || return $? (( $? == 0)) || return $?
# perform check # perform check
grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | while read _SUBSYS grep -E -e "^subsys:" ${_CONFIG_FILE} 2>/dev/null | while IFS=":" read -r _ _SUBSYS
do do
_STATUS="$(grep -E -e ${_SUBSYS} ${HC_STDOUT_LOG} 2>/dev/null)" _STATUS="$(grep -E -e ${_SUBSYS} ${HC_STDOUT_LOG} 2>/dev/null)"
case "${_STATUS}" in case "${_STATUS}" in
@ -86,8 +109,11 @@ do
;; ;;
esac esac
# handle unit result # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
@ -98,12 +124,14 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
subsys1 log_healthy=<yes|no>
subsys2 and formatted stanzas:
PURPOSE : Checks whether subsystem(s) are active/operative {lssrc} subsys:<subsystem_name>
PURPOSE : Checks whether subsystem(s) are active/operative {lssrc}
LOG HEALTHY : Supported
EOT EOT

View File

@ -24,6 +24,7 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-05-28: initial version [Patrick Van der Veken] # @(#) 2013-05-28: initial version [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added support for --log-healthy [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!
#****************************************************************************** #******************************************************************************
@ -35,7 +36,7 @@ function check_aix_sysbackup
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
# mksysb identifier prefix of error code(s) # mksysb identifier prefix of error code(s)
typeset _MKSYSB_NEEDLE="^0512" typeset _MKSYSB_NEEDLE="^0512"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -46,6 +47,8 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _BACKUP_PATH="" typeset _BACKUP_PATH=""
typeset _BACKUP_HOST="" typeset _BACKUP_HOST=""
typeset _BACKUP_LOG="" typeset _BACKUP_LOG=""
@ -99,9 +102,33 @@ case "${_BACKUP_AGE}" in
_BACKUP_AGE=14 _BACKUP_AGE=14
;; ;;
esac esac
_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
# perform state check on mksysb log files # perform state check on mksysb log files
ls -1 ${_BACKUP_PATH} | while read _BACKUP_HOST ls -1 ${_BACKUP_PATH} 2>>${HC_STDERR_LOG} | while read -r _BACKUP_HOST
do do
_BACKUP_LOG="${_BACKUP_PATH}/${_BACKUP_HOST}/curr/${_MKSYSB_LOG}" _BACKUP_LOG="${_BACKUP_PATH}/${_BACKUP_HOST}/curr/${_MKSYSB_LOG}"
if [[ -r "${_BACKUP_LOG}" ]] if [[ -r "${_BACKUP_LOG}" ]]
@ -134,13 +161,16 @@ do
continue continue
fi fi
# handle unit result # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
# perform age check on mksysb log files # perform age check on mksysb log files
ls -1 ${_BACKUP_PATH} | while read _BACKUP_HOST ls -1 ${_BACKUP_PATH} 2>>${HC_STDERR_LOG} | while read -r _BACKUP_HOST
do do
_BACKUP_LOG="${_BACKUP_PATH}/${_BACKUP_HOST}/curr/${_MKSYSB_LOG}" _BACKUP_LOG="${_BACKUP_PATH}/${_BACKUP_HOST}/curr/${_MKSYSB_LOG}"
if [[ -r "${_BACKUP_LOG}" ]] if [[ -r "${_BACKUP_LOG}" ]]
@ -163,8 +193,11 @@ do
continue continue
fi fi
# handle unit result # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
@ -175,15 +208,17 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
backup_path=<location_of_mksysb_images> log_healthy=<yes|no>
mksysb_log=<name_of_standard_standard_mksysb_log> backup_path=<location_of_mksysb_images>
backup_age=<days_till_last_backup> mksysb_log=<name_of_standard_standard_mksysb_log>
PURPOSE : Checks the state of saved mksysb client backups (should typically be backup_age=<days_till_last_backup>
run only on the NIM master or server that is acting as mksysb repo, PURPOSE : Checks the state of saved mksysb client backups (should typically be
do NOT run on a typical client LPAR) run only on the NIM master or server that is acting as mksysb repo,
do NOT run on a typical client LPAR)
LOG HEALTHY : Supported
EOT EOT

View File

@ -25,6 +25,7 @@
# @(#) 2013-05-07: initial version [Patrick Van der Veken] # @(#) 2013-05-07: initial version [Patrick Van der Veken]
# @(#) 2013-08-16: comparison fix [Patrick Van der Veken] # @(#) 2013-08-16: comparison fix [Patrick Van der Veken]
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken] # @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: added support for --log-healthy [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_aix_topasrec function check_aix_topasrec
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -44,6 +45,7 @@ typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _LOG_HEALTHY=0
typeset _TOPAS=0 typeset _TOPAS=0
typeset _NMON=0 typeset _NMON=0
@ -57,6 +59,20 @@ do
esac esac
done done
# 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
# collect data # collect data
topasrec -l >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} topasrec -l >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? == 0 )) || return $? (( $? == 0 )) || return $?
@ -70,8 +86,11 @@ then
_STC=1 _STC=1
fi fi
# handle results # report result
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
return 0 return 0
} }
@ -80,10 +99,10 @@ return 0
function _show_usage function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 PURPOSE : Checks on the active topasrec/nmon processes (only 1 should be running)
PURPOSE : Checks on the active topasrec/nmon processes (only 1 should be running) LOG HEALTHY : Supported
EOT EOT