Added support for --log-healthy (HP-UX)

Other fixes
This commit is contained in:
patvdv 2019-03-10 20:36:58 +01:00
parent 47d8fa272a
commit a2f1c51bea
45 changed files with 1290 additions and 552 deletions

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"
# check clone age? (yes|no) # check clone age? (yes|no)
# [default: yes] # [default: yes]
check_clone="yes" check_clone="yes"

View File

@ -6,8 +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/syslog/syslog.log;60 # (warning: this may rapidly grow the HC log)
# [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,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"
# specify whether non-mounted FS should be alerted on (yes|no) # specify whether non-mounted FS should be alerted on (yes|no)
# [default: yes] # [default: yes]
ignore_missing_fs="yes" ignore_missing_fs="yes"

View File

@ -6,12 +6,18 @@
# [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"
# specify properties as displayed by the 'vzlist -a -H -o ctid,status,onboot' command # specify properties as displayed by the 'vzlist -a -H -o ctid,status,onboot' command
# [parid;runtime_status;boot_status] # Format:
# [vpar:<parid>:<runtime_status>:<boot_status>]
# runtime_status should be 'on' or 'off' # runtime_status should be 'on' or 'off'
# boot_status should be 'auto' or 'manual' # boot_status should be 'auto' or 'manual'
# Examples: # Examples:
#1;on;auto #vpar:1:on:auto
#****************************************************************************** #******************************************************************************

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"
# comma-separated list of HW device classes that should be checked # comma-separated list of HW device classes that should be checked
# [default: ctl,diag,disk,ext_bus,fc,fcp,i2o,ipmi,lan,lvm,olar,vxvm] # [default: ctl,diag,disk,ext_bus,fc,fcp,i2o,ipmi,lan,lvm,olar,vxvm]
ioscan_classes="ctl,diag,disk,ext_bus,fc,fcp,i2o,ipmi,lan,lvm,olar,vxvm" ioscan_classes="ctl,diag,disk,ext_bus,fc,fcp,i2o,ipmi,lan,lvm,olar,vxvm"

View File

@ -6,7 +6,13 @@
# [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"
# specify kernel parameters and their values or expression (as reported by kctune) # specify kernel parameters and their values or expression (as reported by kctune)
# Format:
# [param:<param_name>:<param_value>] # [param:<param_name>:<param_value>]
# Examples: # Examples:
#param:nproc:5000 #param:nproc:5000

View File

@ -6,15 +6,21 @@
# [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"
# specify a general maximum usage threshold (percentage) # specify a general maximum usage threshold (percentage)
# [ default: 90% ] # [ default: 90% ]
max_kcusage=90 max_kcusage=90
# specify individual kernel parameters and their maximum usage threshold (percentage) # specify individual kernel parameters and their maximum usage threshold (percentage)
# definitions here will overrides max_kcusage for these parameters # definitions here will overrides max_kcusage for these parameters
# Format:
# [param:<param_name>:<param_threshold>] # [param:<param_name>:<param_threshold>]
# Examples: # Examples:
# param:nproc:70 #param:nproc:70
# specify parameters that should be excluded from the check # specify parameters that should be excluded from the check
# comma-separated list (as shown by kctune/kcusage) # comma-separated list (as shown by kctune/kcusage)

View File

@ -15,6 +15,7 @@ log_healthy="yes"
# [default: oacore,midaemon,perfalarm,ttd,ovcd,ovbbccb,perfd (v12)] # [default: oacore,midaemon,perfalarm,ttd,ovcd,ovbbccb,perfd (v12)]
ovpa_daemons="" ovpa_daemons=""
#****************************************************************************** #******************************************************************************
# End of FILE # End of FILE
#****************************************************************************** #******************************************************************************

View File

@ -6,8 +6,17 @@
# [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/cfg2html_hpux.sh # Format:
# cron:<cron_entry>
# Examples:
#cron:/opt/cfg2html/cfg2html_hpux.sh
#****************************************************************************** #******************************************************************************
# End of FILE # End of FILE

View File

@ -6,9 +6,16 @@
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************
# list of required cluster statuses (format : "parameter=value") # specify whether to also log passed health checks
# (warning: this may rapidly grow the HC log)
# [default: no]
log_healthy="no"
# list of required cluster statuses
# Format:
# sg:<parameter>=<value>
# Examples: # Examples:
#status=up #sg:status=up
#****************************************************************************** #******************************************************************************

View File

@ -6,9 +6,16 @@
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************
# list of required package statuses (format : "package_name:parameter=value") # specify whether to also log passed health checks
# (warning: this may rapidly grow the HC log)
# [default: no]
log_healthy="no"
# list of required package statuses
# Format:
# sg:<package_name>:<parameter>=<value>
# Examples: # Examples:
#my_package|status=up #sg:my_package:status=up
#****************************************************************************** #******************************************************************************

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"
# path to the SYSLOG file # path to the SYSLOG file
# [default: /var/adm/syslog/syslog.log] # [default: /var/adm/syslog/syslog.log]
syslog_file="/var/adm/syslog/syslog.log" syslog_file="/var/adm/syslog/syslog.log"

View File

@ -19,12 +19,13 @@
# @(#) MAIN: check_hpux_autopath # @(#) MAIN: check_hpux_autopath
# DOES: see _show_usage(). # DOES: see _show_usage().
# EXPECTS: n/a # EXPECTS: n/a
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-08-29: initial version [Patrick Van der Veken] # @(#) 2013-08-29: initial version [Patrick Van der Veken]
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken] # @(#) 2018-05-20: added dump_logs() [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_hpux_autopath
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _AUTOPATH_BIN="/sbin/autopath" typeset _AUTOPATH_BIN="/sbin/autopath"
typeset _AUTOPATH_NEEDLE="Failed" typeset _AUTOPATH_NEEDLE="Failed"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -47,6 +48,7 @@ typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _STC_COUNT=0 typeset _STC_COUNT=0
typeset _LOG_HEALTHY=0
typeset _AUTOPATH_LINE="" typeset _AUTOPATH_LINE=""
typeset _DEVICE="" typeset _DEVICE=""
@ -60,6 +62,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 autopath presence # check autopath presence
if [[ ! -x ${_AUTOPATH_BIN} ]] if [[ ! -x ${_AUTOPATH_BIN} ]]
then then
@ -87,13 +103,16 @@ do
_STC=1 _STC=1
_STC_COUNT=$(( _STC_COUNT + 1 )) _STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
# report OK situation # report OK situation
if (( _STC_COUNT == 0 )) if (( _LOG_HEALTHY > 0 && _STC_COUNT == 0 ))
then then
_MSG="no failed paths detected by {${_AUTOPATH_BIN}}" _MSG="no failed paths detected by {${_AUTOPATH_BIN}}"
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"
@ -108,9 +127,9 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether failed paths exist for StorageWorks disk arrays PURPOSE : Checks whether failed paths exist for StorageWorks disk arrays
using the 'autopath' utility. using the 'autopath' utility.
LOG HEALTHY : Supported
EOT EOT

View File

@ -30,6 +30,7 @@
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken] # @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
# @(#) 2018-10-31: better result check for DRD output [Patrick Van der Veken] # @(#) 2018-10-31: better result check for DRD output [Patrick Van der Veken]
# @(#) 2019-02-08: fix for mirrored boot disks [Patrick Van der Veken] # @(#) 2019-02-08: fix for mirrored boot disks [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!
#****************************************************************************** #******************************************************************************
@ -40,7 +41,7 @@ function check_hpux_drd_status
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _DRD_BIN="/opt/drd/bin/drd" typeset _DRD_BIN="/opt/drd/bin/drd"
typeset _VERSION="2019-02-08" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -50,6 +51,8 @@ init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_comma2space "$*") typeset _ARGS=$(data_comma2space "$*")
typeset _ARG="" typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _RC=0 typeset _RC=0
typeset _CHECK_CLONE="" typeset _CHECK_CLONE=""
typeset _CHECK_SYNC="" typeset _CHECK_SYNC=""
@ -111,6 +114,30 @@ then
_CHECK_SYNC="yes" _CHECK_SYNC="yes"
fi fi
_SYNC_MAX_AGE=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'sync_age') _SYNC_MAX_AGE=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'sync_age')
_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
# get drd status # get drd status
if [[ ! -x ${_DRD_BIN} ]] if [[ ! -x ${_DRD_BIN} ]]
@ -145,18 +172,27 @@ then
[[ "${_BOOTED_DISK}" = "${_ACTIVE_DISK}" ]] [[ "${_BOOTED_DISK}" = "${_ACTIVE_DISK}" ]]
then then
_MSG="host was booted from original disk (${_ACTIVE_DISK})" _MSG="host was booted from original disk (${_ACTIVE_DISK})"
if (( _LOG_HEALTHY > 0 ))
then
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"
fi
else else
_MSG="host was booted from clone disk (${_ACTIVE_DISK})" _MSG="host was booted from clone disk (${_ACTIVE_DISK})"
if (( _LOG_HEALTHY > 0 ))
then
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"
fi fi
fi
# check EFI status # check EFI status
_EFI_CLONE=$(data_strip_outer_space "$(grep 'Clone EFI Partition:' ${HC_STDOUT_LOG} 2>/dev/null | cut -f2 -d':')") _EFI_CLONE=$(data_strip_outer_space "$(grep 'Clone EFI Partition:' ${HC_STDOUT_LOG} 2>/dev/null | cut -f2 -d':')")
if [[ "${_EFI_CLONE}" = "AUTO file present, Boot loader present" ]] if [[ "${_EFI_CLONE}" = "AUTO file present, Boot loader present" ]]
then then
_MSG="clone disk ${_CLONE_DISK} has a bootable EFI partition" _MSG="clone disk ${_CLONE_DISK} has a bootable EFI partition"
if (( _LOG_HEALTHY > 0 ))
then
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"
fi
else else
_MSG="clone disk ${_CLONE_DISK} does not have a bootable EFI partition" _MSG="clone disk ${_CLONE_DISK} does not have a bootable EFI partition"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
@ -165,7 +201,10 @@ then
if [[ "${_EFI_ORIGINAL}" = "AUTO file present, Boot loader present" ]] if [[ "${_EFI_ORIGINAL}" = "AUTO file present, Boot loader present" ]]
then then
_MSG="original disk ${_ORIGINAL_DISK} has a bootable EFI partition" _MSG="original disk ${_ORIGINAL_DISK} has a bootable EFI partition"
if (( _LOG_HEALTHY > 0 ))
then
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"
fi
else else
_MSG="original disk ${_ORIGINAL_DISK} does not have a bootable EFI partition" _MSG="original disk ${_ORIGINAL_DISK} does not have a bootable EFI partition"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
@ -195,7 +234,10 @@ then
if (( _CLONE_EPOCH > (_NOW_EPOCH - (_CLONE_MAX_AGE * 24 * 60 * 60)) )) if (( _CLONE_EPOCH > (_NOW_EPOCH - (_CLONE_MAX_AGE * 24 * 60 * 60)) ))
then then
_MSG="clone age is younger than ${_CLONE_MAX_AGE} days [${_CLONE_DATE}]" _MSG="clone age is younger than ${_CLONE_MAX_AGE} days [${_CLONE_DATE}]"
if (( _LOG_HEALTHY > 0 ))
then
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"
fi
else else
_MSG="clone age is older than ${_CLONE_MAX_AGE} days [${_CLONE_DATE}]" _MSG="clone age is older than ${_CLONE_MAX_AGE} days [${_CLONE_DATE}]"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
@ -232,7 +274,10 @@ then
if (( _SYNC_EPOCH > (_NOW_EPOCH - (_SYNC_MAX_AGE * 24 * 60 * 60)) )) if (( _SYNC_EPOCH > (_NOW_EPOCH - (_SYNC_MAX_AGE * 24 * 60 * 60)) ))
then then
_MSG="sync age is younger than ${_SYNC_MAX_AGE} days [${_SYNC_DATE}]" _MSG="sync age is younger than ${_SYNC_MAX_AGE} days [${_SYNC_DATE}]"
if (( _LOG_HEALTHY > 0 ))
then
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"
fi
else else
_MSG="sync age is older than ${_SYNC_MAX_AGE} days [${_SYNC_DATE}]" _MSG="sync age is older than ${_SYNC_MAX_AGE} days [${_SYNC_DATE}]"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
@ -261,7 +306,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
log_healthy=<yes|no>
check_clone=<yes|no> check_clone=<yes|no>
clone_age=<max_age_of_clone_in_days> clone_age=<max_age_of_clone_in_days>
check_sync=<yes|no> check_sync=<yes|no>
@ -269,6 +315,7 @@ CONFIG : $3 with:
PURPOSE : Checks whether the DRD clone was correctly created PURPOSE : Checks whether the DRD clone was correctly created
Checks for correct EFI partitions Checks for correct EFI partitions
Checks the age of the DRD clone and/or sync Checks the age of the DRD clone and/or sync
LOG HEALTHY : Supported
EOT EOT

View File

@ -19,7 +19,8 @@
# @(#) MAIN: check_hpux_file_age # @(#) MAIN: check_hpux_file_age
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: see _show_usage() # EXPECTS: see _show_usage()
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: Perl, data_comma2space(), data_is_numeric(), init_hc(),
# log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-05-27: initial version [Patrick Van der Veken] # @(#) 2013-05-27: initial version [Patrick Van der Veken]
@ -27,6 +28,8 @@
# @(#) 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 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!
#****************************************************************************** #******************************************************************************
@ -36,7 +39,7 @@ function check_hpux_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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -47,6 +50,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 _REF_FILE="${TMP_DIR}/.$0.ref.$$" typeset _REF_FILE="${TMP_DIR}/.$0.ref.$$"
typeset _DO_REF=0 typeset _DO_REF=0
typeset _ENTRY="" typeset _ENTRY=""
@ -54,6 +59,7 @@ 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
# set local trap for cleanup # set local trap for cleanup
# shellcheck disable=SC2064 # shellcheck disable=SC2064
@ -76,14 +82,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
cat ${_CONFIG_FILE} | grep -v -E -e '^$' -e '^#' | 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%/*}")
@ -94,16 +128,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
;;
*)
# not numeric
warn "invalid file age value '${_FILE_AGE}' in configuration file at ${_CONFIG_FILE}" warn "invalid file age value '${_FILE_AGE}' in configuration file at ${_CONFIG_FILE}"
return 1 return 1
;; fi
esac
# calculate reference timestamp & set reference file (once only) # calculate reference timestamp & set reference file (once only)
if (( _DO_REF == 0 )) if (( _DO_REF == 0 ))
@ -122,7 +152,7 @@ do
fi fi
_DO_REF=1 _DO_REF=1
fi fi
sleep 60 sleep 60
# perform check # perform check
if [[ ! -r "${_FILE_PATH}" ]] if [[ ! -r "${_FILE_PATH}" ]]
then then
@ -145,8 +175,11 @@ sleep 60
fi fi
fi fi
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
@ -162,10 +195,13 @@ 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>
and formatted stanzas:
file:<file_path>:<max_age_in_minutes>
PURPOSE : Checks whether given files have been changed in the last n minutes PURPOSE : Checks whether given files have been changed in the last n minutes
(requires perl!) (requires perl!)
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_hpux_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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # 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
if (( _LOG_HEALTHY > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_FILE_CKSUM}" "${_STATE_FILE_CKSUM}" 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)
@ -350,7 +381,9 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
log_healthy=<yes|no>
and formatted stanzas:
incl:<full path> incl:<full path>
excl:<full path> excl:<full path>
PURPOSE : a KISS file integrity checker (like AIDE). Supports includes and excludes PURPOSE : a KISS file integrity checker (like AIDE). Supports includes and excludes
@ -365,6 +398,7 @@ PURPOSE : a KISS file integrity checker (like AIDE). Supports includes and exclu
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

@ -19,13 +19,14 @@
# @(#) MAIN: check_hpux_fs_mounts # @(#) MAIN: check_hpux_fs_mounts
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: n/a # EXPECTS: n/a
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-05-27: initial version [Patrick Van der Veken] # @(#) 2013-05-27: initial version [Patrick Van der Veken]
# @(#) 2016-04-04: exclude dump/swap spaces (...) [Patrick Van der Veken] # @(#) 2016-04-04: exclude dump/swap spaces (...) [Patrick Van der Veken]
# @(#) 2016-07-04: fix for nfs exclusion [Patrick Van der Veken] # @(#) 2016-07-04: fix for nfs exclusion [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!
#****************************************************************************** #******************************************************************************
@ -34,7 +35,7 @@
function check_hpux_fs_mounts function check_hpux_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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -45,6 +46,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=0 typeset _FS_COUNT=0
@ -58,6 +60,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 only) # collect data (mount only)
mount >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} mount >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
if (( $? > 0 )) if (( $? > 0 ))
@ -86,8 +102,11 @@ do
;; ;;
esac esac
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
@ -103,8 +122,8 @@ 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 PURPOSE : Checks whether file systems are mounted or not
LOG HEALTHY : Supported
EOT EOT

View File

@ -19,7 +19,7 @@
# @(#) MAIN: check_hpux_fs_mounts_options # @(#) MAIN: check_hpux_fs_mounts_options
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: see _show_usage() # EXPECTS: see _show_usage()
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2016-04-04: original version [Patrick Van der Veken] # @(#) 2016-04-04: original version [Patrick Van der Veken]
@ -27,6 +27,7 @@
# @(#) 2017-07-31: added support for current/expected value output [Patrick Van der Veken] # @(#) 2017-07-31: added support for current/expected value output [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!
#****************************************************************************** #******************************************************************************
@ -36,7 +37,7 @@ function check_hpux_fs_mounts_options
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # 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 _CONFIG_FS="" typeset _CONFIG_FS=""
typeset _CONFIG_OPTS="" typeset _CONFIG_OPTS=""
typeset _CURR_OPTS="" typeset _CURR_OPTS=""
@ -80,6 +83,30 @@ then
# default # default
_IGNORE_FS="yes" _IGNORE_FS="yes"
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
# 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 only) # collect data (mount only)
mount >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} mount >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
@ -117,8 +144,11 @@ do
fi fi
fi fi
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_CURR_OPTS}" "${_CONFIG_OPTS}" log_hc "$0" ${_STC} "${_MSG}" "${_CURR_OPTS}" "${_CONFIG_OPTS}"
fi
_STC=0 _STC=0
done done
@ -131,11 +161,13 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with formatted stanzas: CONFIG : $3 with parameters:
log_healthy=<yes|no>
ignore_missing_fs=<yes|no>
and formatted stanzas:
fs:<my_fs1>:<my_fs_opts1> fs:<my_fs1>:<my_fs_opts1>
Other options:
ignore_missing_fs=yes|no
PURPOSE : Checks whether file systems are mounted with correct options PURPOSE : Checks whether file systems are mounted with correct options
LOG HEALTHY : Supported
EOT EOT

View File

@ -27,6 +27,7 @@
# @(#) 2019-01-30: refactored to support custom defintions with all # @(#) 2019-01-30: refactored to support custom defintions with all
# filesystems check [Patrick Van der Veken] # filesystems check [Patrick Van der Veken]
# @(#) 2019-02-18: fixes + help update # @(#) 2019-02-18: fixes + help update
# @(#) 2019-03-09: text fixes
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# 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_hpux_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-02-18" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -291,15 +292,17 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with formatted stanzas (optional): CONFIG : $3 with parameters:
fs:<fs_name>:<max_inodes_usage_in_%>:<max_space_usage_in%>
Other options:
log_healthy=<yes|no> log_healthy=<yes|no>
check_inodes_usage=<yes|no> check_inodes_usage=<yes|no>
check_space_usage=<yes|no> check_space_usage=<yes|no>
max_inodes_usage=<general_inodes_usage_treshold> max_inodes_usage=<general_inodes_usage_treshold>
max_space_usage=<general_space_usage_treshold> max_space_usage=<general_space_usage_treshold>
with formatted stanzas (optional):
fs:<fs_name>:<max_inodes_usage_%>:<max_space_usage_%>
EXT OPTIONS : --hc-args=check_inodes, --hc-args=check_space
PURPOSE : Checks the inodes & space usage for the configured or all (local) filesystems PURPOSE : Checks the inodes & space usage for the configured or all (local) filesystems
LOG HEALTHY : Supported
EOT EOT

View File

@ -25,6 +25,7 @@
# @(#) 2017-05-18: initial version [Patrick Van der Veken] # @(#) 2017-05-18: 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 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_hpux_guid_status function check_hpux_guid_status
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -45,6 +46,7 @@ typeset _ARG=""
typeset _GUID_PID="" typeset _GUID_PID=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _LOG_HEALTHY=0
typeset _RC=0 typeset _RC=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
@ -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
# ---- process state ---- # ---- process state ----
# 1) try using the PID way # 1) try using the PID way
if [[ -r "${_GUID_PID_FILE}" ]] if [[ -r "${_GUID_PID_FILE}" ]]
@ -101,8 +117,11 @@ case ${_STC} 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
} }
@ -113,8 +132,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether guid daemons (VSP GUID) are running PURPOSE : Checks whether guid daemons (VSP GUID) are running
LOG HEALTHY : Supported
EOT EOT

View File

@ -27,6 +27,8 @@
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken] # @(#) 2018-05-20: added dump_logs() [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!
#****************************************************************************** #******************************************************************************
@ -37,7 +39,7 @@ function check_hpux_hpvm_vpar_status
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _HPVMSTATUS_BIN="/opt/hpvm/bin/hpvmstatus" typeset _HPVMSTATUS_BIN="/opt/hpvm/bin/hpvmstatus"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -57,6 +59,8 @@ typeset _PAR_ENTRY=""
typeset _PAR_MATCH="" typeset _PAR_MATCH=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _RC=0 typeset _RC=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
@ -69,6 +73,46 @@ do
esac esac
done done
# handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]]
then
warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1
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 "^vpar:" ${_CONFIG_FILE} 2>/dev/null)
if (( _IS_OLD_STYLE == 0 ))
then
warn "no 'vpar:' 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
# check HPVM # check HPVM
if [[ ! -x ${_HPVMSTATUS_BIN} || -z "${_HPVMSTATUS_BIN}" ]] if [[ ! -x ${_HPVMSTATUS_BIN} || -z "${_HPVMSTATUS_BIN}" ]]
then then
@ -86,24 +130,14 @@ ${_HPVMSTATUS_BIN} -M >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
} }
# check configuration values # check configuration values
grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | while read _PAR_ENTRY grep -E -e "^vpar:" ${_CONFIG_FILE} 2>/dev/null | while IFS=":" read -r _ _PAR_ID _PAR_CFG_STATUS _PAR_CFG_BOOT
do do
# field split
_PAR_ID=$(print "${_PAR_ENTRY}" | cut -f1 -d';')
_PAR_CFG_STATUS=$(data_lc "$(print \"${_PAR_ENTRY}\" | cut -f2 -d';')")
_PAR_CFG_BOOT=$(data_lc "$(print \"${_PAR_ENTRY}\" | cut -f3 -d';')")
# check configuration # check configuration
case "${_PAR_ID}" in data_is_numeric "${_PAR_ID}"
+([0-9])*(.)*([0-9])) if (( $? > 0 ))
# numeric, OK then
;;
*)
# not numeric
warn "invalid partition ID '${_PAR_ID}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}" warn "invalid partition ID '${_PAR_ID}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
return 1 fi
;;
esac
case "${_PAR_CFG_STATUS}" in case "${_PAR_CFG_STATUS}" in
on|off) on|off)
;; ;;
@ -124,13 +158,8 @@ do
done done
# perform checks # perform checks
grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | while read _PAR_ENTRY grep -E -e "^vpar:" ${_CONFIG_FILE} 2>/dev/null | while IFS=":" read -r _ _PAR_ID _PAR_CFG_STATUS _PAR_CFG_BOOT
do do
# field split
_PAR_ID=$(print "${_PAR_ENTRY}" | cut -f1 -d';')
_PAR_CFG_STATUS=$(data_lc "$(print \"${_PAR_ENTRY}\" | cut -f2 -d';')")
_PAR_CFG_BOOT=$(data_lc "$(print \"${_PAR_ENTRY}\" | cut -f3 -d';')")
# check run-time values (we need to make the needle sufficiently less greedy) # check run-time values (we need to make the needle sufficiently less greedy)
_PAR_MATCH=$(grep -i "^.*:.*:${_PAR_ID}::Integrity" ${HC_STDOUT_LOG} 2>/dev/null) _PAR_MATCH=$(grep -i "^.*:.*:${_PAR_ID}::Integrity" ${HC_STDOUT_LOG} 2>/dev/null)
if [[ -n "${_PAR_MATCH}" ]] if [[ -n "${_PAR_MATCH}" ]]
@ -157,7 +186,10 @@ do
_MSG="partition ${_PAR_ID} has a wrong boot flag [${_PAR_RUN_BOOT}]" _MSG="partition ${_PAR_ID} has a wrong boot flag [${_PAR_RUN_BOOT}]"
_STC=1 _STC=1
fi fi
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_PAR_RUN_BOOT}" "${_PAR_CFG_BOOT}" log_hc "$0" ${_STC} "${_MSG}" "${_PAR_RUN_BOOT}" "${_PAR_CFG_BOOT}"
fi
else else
warn "could not determine status for partition ${_PAR_ID} from command output {${_HPVMSTATUS_BIN}}" warn "could not determine status for partition ${_PAR_ID} from command output {${_HPVMSTATUS_BIN}}"
_RC=1 _RC=1
@ -173,9 +205,12 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
<parid>;<runtime_status>;<boot_status> log_healthy=<yes|no>
and formatted stanzas:
vpar:<parid>:<runtime_status>:<boot_status>
PURPOSE : Checks the status of vPars (on a VSP) PURPOSE : Checks the status of vPars (on a VSP)
LOG HEALTHY : Supported
EOT EOT

View File

@ -25,6 +25,7 @@
# @(#) 2017-04-23: initial version [Patrick Van der Veken] # @(#) 2017-04-23: 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 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 +35,7 @@ function check_hpux_httpd_status
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _HTTPD_PID_FILE="/var/run/httpd/httpd.pid" typeset _HTTPD_PID_FILE="/var/run/httpd/httpd.pid"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -47,6 +48,7 @@ typeset _HTTPD_BIN=""
typeset _HTTPD_PID="" typeset _HTTPD_PID=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _LOG_HEALTHY=0
typeset _RC=0 typeset _RC=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
@ -59,6 +61,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
# ---- process state ---- # ---- process state ----
# 1) try using the PID way # 1) try using the PID way
if [[ -r "${_HTTPD_PID_FILE}" ]] if [[ -r "${_HTTPD_PID_FILE}" ]]
@ -94,7 +110,11 @@ case ${_STC} in
_MSG="could not determine status of httpd" _MSG="could not determine status of httpd"
;; ;;
esac esac
log_hc "$0" ${_STC} "${_MSG}" # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
# ---- config state ---- # ---- config state ----
_HTTPD_BIN="$(which httpd 2>>${HC_STDERR_LOG})" _HTTPD_BIN="$(which httpd 2>>${HC_STDERR_LOG})"
@ -110,7 +130,11 @@ then
_MSG="httpd configuration files have syntax error(s) {httpd -s}" _MSG="httpd configuration files have syntax error(s) {httpd -s}"
_STC=1 _STC=1
fi fi
# report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
fi fi
return 0 return 0
@ -122,8 +146,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether httpd (apache) is running PURPOSE : Checks whether httpd (apache) is running
LOG HEALTHY : Supported
EOT EOT

View File

@ -19,7 +19,7 @@
# @(#) MAIN: check_hpux_ignite_backup # @(#) MAIN: check_hpux_ignite_backup
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: see _show_usage() # EXPECTS: see _show_usage()
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2013-05-28: initial version [Patrick Van der Veken] # @(#) 2013-05-28: initial version [Patrick Van der Veken]
@ -28,7 +28,8 @@
# @(#) 2016-06-03: small fix [Patrick Van der Veken] # @(#) 2016-06-03: small fix [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-01-31: Improve discovery routine + add log_healthy [Patrick Van der Veken] # @(#) 2019-01-31: improve discovery routine + add log_healthy [Patrick Van der Veken]
# @(#) 2019-03-09: text updates [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!
#****************************************************************************** #******************************************************************************
@ -42,7 +43,7 @@ typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _IGNITE_NEEDLE="^DONE" typeset _IGNITE_NEEDLE="^DONE"
typeset _IGNITE_SERVER_FILE="/var/opt/ignite/server/ignite.defs" typeset _IGNITE_SERVER_FILE="/var/opt/ignite/server/ignite.defs"
typeset _IGNITE_CLIENTS_DIR="/var/opt/ignite/clients" typeset _IGNITE_CLIENTS_DIR="/var/opt/ignite/clients"
typeset _VERSION="2019-01-31" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -246,8 +247,10 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
log_healthy=<yes|no>
backup_age=<days_till_last_backup> backup_age=<days_till_last_backup>
exclude_hosts=<list_of_hosts>
PURPOSE : Checks the state and age of saved Ignite-UX client backups (should only be PURPOSE : Checks the state and age of saved Ignite-UX client backups (should only be
run only on the Ignite-UX server). Backups with warnings are considered run only on the Ignite-UX server). Backups with warnings are considered
to OK. Backups older than \$backup_age will not pass the health check. to OK. Backups older than \$backup_age will not pass the health check.

View File

@ -31,6 +31,7 @@
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken] # @(#) 2018-05-20: added dump_logs() [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!
#****************************************************************************** #******************************************************************************
@ -42,7 +43,7 @@ function check_hpux_ioscan
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _IOSCAN_BIN="/usr/sbin/ioscan" typeset _IOSCAN_BIN="/usr/sbin/ioscan"
typeset _IOSCAN_OPTS="-Fn" typeset _IOSCAN_OPTS="-Fn"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -54,6 +55,8 @@ typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _STC_COUNT=0 typeset _STC_COUNT=0
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _CLASS_LINE="" typeset _CLASS_LINE=""
typeset _IOSCAN_CLASSES="" typeset _IOSCAN_CLASSES=""
typeset _AGILE_VIEW="" typeset _AGILE_VIEW=""
@ -102,6 +105,30 @@ then
# default # default
_AGILE_VIEW="yes" _AGILE_VIEW="yes"
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
# 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 and get ioscan stuff # check and get ioscan stuff
if [[ ! -x ${_IOSCAN_BIN} ]] if [[ ! -x ${_IOSCAN_BIN} ]]
@ -163,12 +190,16 @@ do
continue continue
esac esac
# report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
# report OK situation # report OK situation
if (( _STC_COUNT == 0 )) if (( _LOG_HEALTHY > 0 && _STC_COUNT == 0 ))
then then
_MSG="no problems detected by {${_IOSCAN_BIN}}" _MSG="no problems detected by {${_IOSCAN_BIN}}"
log_hc "$0" 0 "${_MSG}" log_hc "$0" 0 "${_MSG}"
@ -184,10 +215,13 @@ cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with:
CONFIG : $3 with parameters:
log_healthy=<yes|no>
ioscan_classes=<list_of_device_classes_to_check> ioscan_classes=<list_of_device_classes_to_check>
kernel_mode=<yes|no> kernel_mode=<yes|no>
agile_view=<yes|no> agile_view=<yes|no>
PURPOSE : Checks whether 'ioscan' returns errors or not (NO_HW, ERROR) PURPOSE : Checks whether 'ioscan' returns errors or not (NO_HW, ERROR)
LOG HEALTHY : Supported
EOT EOT

View File

@ -27,6 +27,7 @@
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken] # @(#) 2018-05-20: added dump_logs() [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!
#****************************************************************************** #******************************************************************************
@ -37,7 +38,7 @@ function check_hpux_kernel_params
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _KCTUNE_BIN="/usr/sbin/kctune" typeset _KCTUNE_BIN="/usr/sbin/kctune"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -48,6 +49,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 _PARAM_NAME="" typeset _PARAM_NAME=""
typeset _CONFIG_VALUE="" typeset _CONFIG_VALUE=""
typeset _CURR_VALUE="" typeset _CURR_VALUE=""
@ -73,6 +76,30 @@ 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
# 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 kctune information # check & get kctune information
if [[ ! -x ${_KCTUNE_BIN} ]] if [[ ! -x ${_KCTUNE_BIN} ]]
@ -140,8 +167,11 @@ do
_REPORTED_VALUE="${_EXPR_VALUE}" _REPORTED_VALUE="${_EXPR_VALUE}"
fi fi
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_REPORTED_VALUE}" "${_CONFIG_VALUE}" log_hc "$0" ${_STC} "${_MSG}" "${_REPORTED_VALUE}" "${_CONFIG_VALUE}"
fi
_STC=0 _STC=0
done done
@ -154,9 +184,12 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with formatted stanzas: CONFIG : $3 with parameters:
param:<my_param1>:<my_param1_value> log_healthy=<yes|no>
and formatted stanzas:
param:<param_name>:<param_value>
PURPOSE : Checks kernel parameters have a correct run-time value/expression PURPOSE : Checks kernel parameters have a correct run-time value/expression
LOG HEALTHY : Supported
EOT EOT

View File

@ -19,7 +19,8 @@
# @(#) MAIN: check_hpux_kernel_usage # @(#) MAIN: check_hpux_kernel_usage
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: see _show_usage() # EXPECTS: see _show_usage()
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc() # REQUIRES: data_comma2space(), data_is_numeric(), dump_logs(), init_hc(),
# log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2017-12-22: original version [Patrick Van der Veken] # @(#) 2017-12-22: original version [Patrick Van der Veken]
@ -28,6 +29,8 @@
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken] # @(#) 2018-05-20: added dump_logs() [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() &
# @(#) 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!
#****************************************************************************** #******************************************************************************
@ -38,7 +41,7 @@ function check_hpux_kernel_usage
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _KCUSAGE_BIN="/usr/sbin/kcusage" typeset _KCUSAGE_BIN="/usr/sbin/kcusage"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -49,6 +52,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 _MAX_KCUSAGE=0 typeset _MAX_KCUSAGE=0
typeset _EXCLUDED_PARAMS="" typeset _EXCLUDED_PARAMS=""
typeset _HANDLED_PARAMS="" typeset _HANDLED_PARAMS=""
@ -90,6 +95,30 @@ if [[ -n "${_EXCLUDED_PARAMS}" ]]
then then
log "excluding following kernel parameters: ${_EXCLUDED_PARAMS}" log "excluding following kernel parameters: ${_EXCLUDED_PARAMS}"
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
# 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 kcusage information # check & get kcusage information
if [[ ! -x ${_KCUSAGE_BIN} ]] if [[ ! -x ${_KCUSAGE_BIN} ]]
@ -126,21 +155,19 @@ do
return 1 return 1
fi fi
# check if the threshold value is correct (integer) # check if the threshold value is correct (integer)
case "${_CONFIG_VALUE}" in data_is_numeric "${_CONFIG_VALUE}"
[0-9]*) if (( $? == 0 ))
# numeric, OK then
if (( _CONFIG_VALUE < 1 || _CONFIG_VALUE > 99 )) if (( _CONFIG_VALUE < 1 || _CONFIG_VALUE > 99 ))
then then
warn "incorrect threshold value '${_CONFIG_VALUE}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}" warn "incorrect threshold value '${_CONFIG_VALUE}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
return 1 return 1
fi fi
;; else
*)
# not numeric # not numeric
warn "invalid threshold value '${_CONFIG_VALUE}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}" warn "invalid threshold value '${_CONFIG_VALUE}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
return 1 return 1
;; fi
esac
_LINE_COUNT=$(( _LINE_COUNT + 1 )) _LINE_COUNT=$(( _LINE_COUNT + 1 ))
done done
@ -164,8 +191,11 @@ do
# push to handled list # push to handled list
_HANDLED_PARAMS="${_HANDLED_PARAMS}\n${_PARAM_NAME}" _HANDLED_PARAMS="${_HANDLED_PARAMS}\n${_PARAM_NAME}"
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_CHECK_VALUE}" "${_CONFIG_VALUE}" log_hc "$0" ${_STC} "${_MSG}" "${_CHECK_VALUE}" "${_CONFIG_VALUE}"
fi
_STC=0 _STC=0
done done
@ -198,8 +228,11 @@ do
_MSG="${_PARAM_NAME} is below the general threshold (${_CHECK_VALUE}% <= ${_MAX_KCUSAGE}%)" _MSG="${_PARAM_NAME} is below the general threshold (${_CHECK_VALUE}% <= ${_MAX_KCUSAGE}%)"
fi fi
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_CHECK_VALUE}" "${_MAX_KCUSAGE}" log_hc "$0" ${_STC} "${_MSG}" "${_CHECK_VALUE}" "${_MAX_KCUSAGE}"
fi
_STC=0 _STC=0
fi fi
done done
@ -213,12 +246,14 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with formatted stanzas: CONFIG : $3 with parameters:
param:<my_param1>:<my_param1_threshold_%> log_healthy=<yes|no>
Other options:
max_kcusage=<threshold_%> max_kcusage=<threshold_%>
exclude_params=<list_of_exluded_parameters> exclude_params=<list_of_excluded_parameters>
and formatted stanzas:
param:<param_name>:<param_value>
PURPOSE : Checks the current usage of kernel paremeter resources PURPOSE : Checks the current usage of kernel paremeter resources
LOG HEALTHY : Supported
EOT EOT

View File

@ -27,6 +27,7 @@
# @(#) [Patrick Van der Veken] # @(#) [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-09-03: small variable 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!
#****************************************************************************** #******************************************************************************
@ -39,7 +40,7 @@ typeset _IOSCAN_BIN="/usr/sbin/ioscan"
typeset _IOSCAN_OPTS="-C disk -P wwid" typeset _IOSCAN_OPTS="-C disk -P wwid"
typeset _SCSIMGR_BIN="/usr/sbin/scsimgr" typeset _SCSIMGR_BIN="/usr/sbin/scsimgr"
typeset _SCSIMGR_OPTS="-v get_info all_lun" typeset _SCSIMGR_OPTS="-v get_info all_lun"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -58,7 +59,6 @@ typeset _ACTIVE_PATH_COUNT=""
typeset _ALL_PATH_COUNT="" typeset _ALL_PATH_COUNT=""
typeset _FAILED_PATH_COUNT="" typeset _FAILED_PATH_COUNT=""
typeset _STANDBY_PATH_COUNT="" typeset _STANDBY_PATH_COUNT=""
typeset _WWID=""
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
for _ARG in ${_ARGS} for _ARG in ${_ARGS}
@ -210,7 +210,7 @@ awk 'BEGIN { wwid = ""; active_paths = ""; all_paths = ""; failed_paths = ""; st
print wwid "|" disks[wwid] "|" paths_active[wwid] "|" paths_all[wwid] "|" paths_failed[wwid] "|" paths_standby[wwid] print wwid "|" disks[wwid] "|" paths_active[wwid] "|" paths_all[wwid] "|" paths_failed[wwid] "|" paths_standby[wwid]
} }
}' ${_TMP1_FILE} ${_TMP2_FILE} 2>/dev/null |\ }' ${_TMP1_FILE} ${_TMP2_FILE} 2>/dev/null |\
while IFS='|' read -r _WWID _HW_PATH _ACTIVE_PATH_COUNT _ALL_PATH_COUNT _FAILED_PATH_COUNT _STANDBY_PATH_COUNT while IFS='|' read -r _ _HW_PATH _ACTIVE_PATH_COUNT _ALL_PATH_COUNT _FAILED_PATH_COUNT _STANDBY_PATH_COUNT
do do
if [[ -z "${_ACTIVE_PATH_COUNT}" ]] || if [[ -z "${_ACTIVE_PATH_COUNT}" ]] ||
[[ -z "${_ALL_PATH_COUNT}" ]] || [[ -z "${_ALL_PATH_COUNT}" ]] ||
@ -261,8 +261,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
PURPOSE : Check the active and failed (non-active) lunpaths of DISK devices PURPOSE : Check the active and failed (non-active) lunpaths of DISK devices
LOG HEALTHY : Supported
EOT EOT

View File

@ -24,6 +24,7 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2017-01-07: initial version [Patrick Van der Veken] # @(#) 2017-01-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!
#****************************************************************************** #******************************************************************************
@ -33,7 +34,7 @@ function check_hpux_named_status
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _NAMED_PID_FILE="/var/run/named/named.pid" typeset _NAMED_PID_FILE="/var/run/named/named.pid"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # 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 _RC=0 typeset _RC=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
@ -58,6 +60,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
# ---- process state ---- # ---- process state ----
# 1) try using the PID way # 1) try using the PID way
if [[ -r "${_NAMED_PID_FILE}" ]] if [[ -r "${_NAMED_PID_FILE}" ]]
@ -93,7 +109,11 @@ case ${_STC} in
_MSG="could not determine status of named" _MSG="could not determine status of named"
;; ;;
esac esac
log_hc "$0" ${_STC} "${_MSG}" # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
# ---- config state ---- # ---- config state ----
_NAMED_CHECKCONF_BIN="$(which named-checkconf 2>>${HC_STDERR_LOG})" _NAMED_CHECKCONF_BIN="$(which named-checkconf 2>>${HC_STDERR_LOG})"
@ -109,7 +129,11 @@ then
_MSG="named configuration and/or zone files have syntax error(s) {named-checkconf -z}" _MSG="named configuration and/or zone files have syntax error(s) {named-checkconf -z}"
_STC=1 _STC=1
fi fi
# report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
fi fi
return 0 return 0
@ -121,9 +145,9 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether named (BIND) service is running and whether the named PURPOSE : Checks whether named (BIND) service is running and whether the named
zone files are syntactically correct. zone files are syntactically correct.
LOG HEALTHY : Supported
EOT EOT

View File

@ -29,6 +29,7 @@
# @(#) 2019-01-10: added configuration option 'ntpq_use_ipv4', fixed problem # @(#) 2019-01-10: added configuration option 'ntpq_use_ipv4', fixed problem
# @(#) with offset calculation [Patrick Van der Veken] # @(#) with offset calculation [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: Text updates [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_hpux_ntp_status
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
typeset _NTPQ_BIN="/usr/sbin/ntpq" typeset _NTPQ_BIN="/usr/sbin/ntpq"
typeset _NTPQ_OPTS="-pn" typeset _NTPQ_OPTS="-pn"
@ -183,7 +184,7 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
log_healthy=<yes|no> log_healthy=<yes|no>
max_offset=<max_offset (ms)> max_offset=<max_offset (ms)>
force_chrony=<yes|no> force_chrony=<yes|no>

View File

@ -29,6 +29,7 @@
# @(#) 2018-10-22: small fixes [Patrick Van der Veken] # @(#) 2018-10-22: small fixes [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: text updates [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_hpux_ovpa_status
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
typeset _OVPA_BIN="/opt/perf/bin/perfstat" typeset _OVPA_BIN="/opt/perf/bin/perfstat"
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -162,7 +163,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
log_healthy=<yes|no>
ovpa_daemons=<list_of_ovpa_processes_to_check> ovpa_daemons=<list_of_ovpa_processes_to_check>
PURPOSE : Checks the status of OVPA processes (OpenView Performance Agent) PURPOSE : Checks the status of OVPA processes (OpenView Performance Agent)
LOG HEALTHY : Supported LOG HEALTHY : Supported

View File

@ -29,6 +29,7 @@
# @(#) 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-02-19: fix in exclude checking [Patrick Van der Veken] # @(#) 2019-02-19: fix in exclude checking [Patrick Van der Veken]
# @(#) 2019-03-09: text updates [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!
#****************************************************************************** #******************************************************************************
@ -42,7 +43,7 @@ typeset _SWLIST_BIN="/usr/sbin/swlist"
typeset _SWLIST_OPTS="" typeset _SWLIST_OPTS=""
typeset _SHOW_PATCHES_BIN="/usr/contrib/bin/show_patches" typeset _SHOW_PATCHES_BIN="/usr/contrib/bin/show_patches"
typeset _SHOW_PATCHES_OPTS="" typeset _SHOW_PATCHES_OPTS=""
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -258,7 +259,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
log_healthy=<yes|no>
required_patches=<list_of_patches_to_check> required_patches=<list_of_patches_to_check>
required_oe=<OE_version> required_oe=<OE_version>
check_filesets=<yes|no> check_filesets=<yes|no>
@ -266,6 +268,7 @@ CONFIG : $3 with:
PURPOSE : Checks whether the required OE (Operating Environment) version is installed PURPOSE : Checks whether the required OE (Operating Environment) version is installed
Checks whether the required patches are installed Checks whether the required patches are installed
Checks whether filesets are in a configured state Checks whether filesets are in a configured state
LOG HEALTHY : Supported
EOT EOT

View File

@ -19,11 +19,12 @@
# @(#) MAIN: check_hpux_postfix_status # @(#) MAIN: check_hpux_postfix_status
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: n/a # EXPECTS: n/a
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2016-12-01: initial version [Patrick Van der Veken] # @(#) 2016-12-01: 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_hpux_postfix_status function check_hpux_postfix_status
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -44,6 +45,7 @@ typeset _ARG=""
typeset _POSTFIX_BIN="" typeset _POSTFIX_BIN=""
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}
@ -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
_POSTFIX_BIN="$(which postfix 2>>${HC_STDERR_LOG})" _POSTFIX_BIN="$(which postfix 2>>${HC_STDERR_LOG})"
if [[ -x ${_POSTFIX_BIN} && -n "${_POSTFIX_BIN}" ]] if [[ -x ${_POSTFIX_BIN} && -n "${_POSTFIX_BIN}" ]]
then then
@ -71,8 +87,11 @@ else
return 1 return 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
} }
@ -83,8 +102,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether postfix (mail system) is running PURPOSE : Checks whether postfix (mail system) is running
LOG HEALTHY : Supported
EOT EOT

View File

@ -19,11 +19,13 @@
# @(#) MAIN: check_hpux_root_crontab # @(#) MAIN: check_hpux_root_crontab
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: n/a # EXPECTS: n/a
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
# #
# @(#) 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_hpux_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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # 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}
@ -64,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}")
@ -86,8 +123,11 @@ do
;; ;;
esac esac
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
_STC=0 _STC=0
done done
@ -100,8 +140,12 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 CONFIG : $3 with parameters:
log_healthy=<yes|no>
and formatted stanzas:
cron:<cron_entry>
PURPOSE : Checks the content of the 'root' crontab for required entries PURPOSE : Checks the content of the 'root' crontab for required entries
LOG HEALTHY : Supported
EOT EOT

View File

@ -25,6 +25,7 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2018-10-28: initial version [Patrick Van der Veken] # @(#) 2018-10-28: initial version [Patrick Van der Veken]
# @(#) 2019-01-27: arguments fix [Patrick Van der Veken] # @(#) 2019-01-27: arguments fix [Patrick Van der Veken]
# @(#) 2019-03-09: text updates [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!
#****************************************************************************** #******************************************************************************
@ -37,7 +38,7 @@ typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _SFMCONFIG_BIN="/opt/sfm/bin/sfmconfig" typeset _SFMCONFIG_BIN="/opt/sfm/bin/sfmconfig"
typeset _EVWEB_BIN="/opt/sfm/bin/evweb" typeset _EVWEB_BIN="/opt/sfm/bin/evweb"
typeset _CIMPROVIDER_BIN="/opt/wbem/bin/cimprovider" typeset _CIMPROVIDER_BIN="/opt/wbem/bin/cimprovider"
typeset _VERSION="2019-01-27" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -395,7 +396,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
log_healthy=<yes|no>
check_events=<yes|no> check_events=<yes|no>
events_age=<age_of_open_events> events_age=<age_of_open_events>
events_severity=<severities_of_open_events> events_severity=<severities_of_open_events>
@ -408,7 +410,8 @@ PURPOSE : Checks the heath of SFM (System Fault Management)
* checks external event subscriber (optional) * checks external event subscriber (optional)
* sends & checks a test event (optional) * sends & checks a test event (optional)
* checks current events (optional) * checks current events (optional)
NOTE: Test events should not be generated more than once a day LOG HEALTHY : Supported
NOTE : Test events should not be generated more than once a day
EOT EOT

View File

@ -28,6 +28,8 @@
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken] # @(#) 2018-05-20: added dump_logs() [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: 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!
#****************************************************************************** #******************************************************************************
@ -37,7 +39,7 @@ function check_hpux_sg_cluster_status
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
typeset _SG_DAEMON="/usr/lbin/cmcld" typeset _SG_DAEMON="/usr/lbin/cmcld"
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -49,11 +51,14 @@ 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 _SG_ENTRY="" typeset _SG_ENTRY=""
typeset _SG_MATCH="" typeset _SG_MATCH=""
typeset _SG_CFG_PARAM="" typeset _SG_CFG_PARAM=""
typeset _SG_CFG_VALUE="" typeset _SG_CFG_VALUE=""
typeset _SG_RUN_VALUE="" typeset _SG_RUN_VALUE=""
typeset _IS_OLD_STYLE=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
for _ARG in ${_ARGS} for _ARG in ${_ARGS}
@ -72,6 +77,38 @@ 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 "^sg:" ${_CONFIG_FILE} 2>/dev/null)
if (( _IS_OLD_STYLE == 0 ))
then
warn "no 'sg:' 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
# check & get serviceguard status # check & get serviceguard status
if [[ ! -x ${_SG_DAEMON} ]] if [[ ! -x ${_SG_DAEMON} ]]
@ -91,7 +128,8 @@ fi
# do cluster status checks # do cluster status checks
# (replace ':' by '|' for cmcviewcl output) # (replace ':' by '|' for cmcviewcl output)
grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' | while read _SG_ENTRY grep -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' 2>/dev/null |\
while read -r _ _SG_ENTRY
do do
# field split # field split
_SG_CFG_PARAM="$(print ${_SG_ENTRY} | cut -f1 -d'=')" # field 1 _SG_CFG_PARAM="$(print ${_SG_ENTRY} | cut -f1 -d'=')" # field 1
@ -111,7 +149,10 @@ do
_MSG="cluster parameter ${_SG_CFG_PARAM} has a wrong value [${_SG_RUN_VALUE}]" _MSG="cluster parameter ${_SG_CFG_PARAM} has a wrong value [${_SG_RUN_VALUE}]"
_STC=1 _STC=1
fi fi
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_SG_RUN_VALUE}" "${_SG_CFG_VALUE}" log_hc "$0" ${_STC} "${_MSG}" "${_SG_RUN_VALUE}" "${_SG_CFG_VALUE}"
fi
else else
warn "could not determine status for ${_SG_CFG_PARAM} from command output {cmviewcl}" warn "could not determine status for ${_SG_CFG_PARAM} from command output {cmviewcl}"
fi fi
@ -126,8 +167,12 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 CONFIG : $3 with parameters:
log_healthy=<yes|no>
and formatted stanzas:
sg:<param>=<value>
PURPOSE : Checks the status of Serviceguard cluster parameters (SG 11.16+) PURPOSE : Checks the status of Serviceguard cluster parameters (SG 11.16+)
LOG HEALTHY : Supported
EOT EOT

View File

@ -28,6 +28,8 @@
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken] # @(#) 2018-05-20: added dump_logs() [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: 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!
#****************************************************************************** #******************************************************************************
@ -37,7 +39,7 @@ function check_hpux_sg_package_status
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
typeset _SG_DAEMON="/usr/lbin/cmcld" typeset _SG_DAEMON="/usr/lbin/cmcld"
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -49,12 +51,15 @@ 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 _SG_ENTRY="" typeset _SG_ENTRY=""
typeset _SG_MATCH="" typeset _SG_MATCH=""
typeset _SG_PACKAGE="" typeset _SG_PACKAGE=""
typeset _SG_CFG_PARAM="" typeset _SG_CFG_PARAM=""
typeset _SG_CFG_VALUE="" typeset _SG_CFG_VALUE=""
typeset _SG_RUN_VALUE="" typeset _SG_RUN_VALUE=""
typeset _IS_OLD_STYLE=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
for _ARG in ${_ARGS} for _ARG in ${_ARGS}
@ -73,6 +78,38 @@ 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 "^sg:" ${_CONFIG_FILE} 2>/dev/null)
if (( _IS_OLD_STYLE == 0 ))
then
warn "no 'sg:' 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
# check & get serviceguard status # check & get serviceguard status
if [[ ! -x ${_SG_DAEMON} ]] if [[ ! -x ${_SG_DAEMON} ]]
@ -92,7 +129,8 @@ fi
# do package status checks # do package status checks
# (replace ':' by '|' for cmcviewcl output) # (replace ':' by '|' for cmcviewcl output)
grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' | while read _SG_ENTRY grep -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' 2>/dev/null |\
while read -r _ _SG_ENTRY
do do
# field split # field split
_SG_PACKAGE="$(print ${_SG_ENTRY} | cut -f1 -d':')" _SG_PACKAGE="$(print ${_SG_ENTRY} | cut -f1 -d':')"
@ -113,7 +151,10 @@ do
_MSG="package ${_SG_PACKAGE} parameter ${_SG_CFG_PARAM} has a wrong value [${_SG_RUN_VALUE}]" _MSG="package ${_SG_PACKAGE} parameter ${_SG_CFG_PARAM} has a wrong value [${_SG_RUN_VALUE}]"
_STC=1 _STC=1
fi fi
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" "${_SG_RUN_VALUE}" "${_SG_CFG_VALUE}" log_hc "$0" ${_STC} "${_MSG}" "${_SG_RUN_VALUE}" "${_SG_CFG_VALUE}"
fi
else else
warn "could not determine status for ${_SG_PACKAGE}/${_SG_CFG_PARAM} from command output {cmviewcl}" warn "could not determine status for ${_SG_PACKAGE}/${_SG_CFG_PARAM} from command output {cmviewcl}"
fi fi
@ -128,8 +169,12 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 CONFIG : $3 with parameters:
log_healthy=<yes|no>
and formatted stanzas:
sg:<package_name>:<parameter>=<value>
PURPOSE : Checks the status of Serviceguard package parameters (SG 11.16+) PURPOSE : Checks the status of Serviceguard package parameters (SG 11.16+)
LOG HEALTHY : Supported
EOT EOT

View File

@ -19,12 +19,13 @@
# @(#) MAIN: check_hpux_sg_qs_status # @(#) MAIN: check_hpux_sg_qs_status
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: n/a # EXPECTS: n/a
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2017-05-01: initial version [Patrick Van der Veken] # @(#) 2017-05-01: 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 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_hpux_sg_qs_status function check_hpux_sg_qs_status
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
typeset _QS_BIN="/usr/lbin/qsc" typeset _QS_BIN="/usr/lbin/qsc"
typeset _QS_AUTH_FILE="/etc/cmcluster/qs_authfile" typeset _QS_AUTH_FILE="/etc/cmcluster/qs_authfile"
@ -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
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
for _ARG in ${_ARGS} for _ARG in ${_ARGS}
@ -57,6 +59,21 @@ 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 QS presence # check QS presence
if [[ ! -x ${_QS_BIN} ]] if [[ ! -x ${_QS_BIN} ]]
then then
@ -79,7 +96,10 @@ case ${_STC} in
_MSG="could not determine status of QS" _MSG="could not determine status of QS"
;; ;;
esac esac
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
# ---- config state ---- # ---- config state ----
if [[ -s ${_QS_AUTH_FILE} ]] if [[ -s ${_QS_AUTH_FILE} ]]
@ -90,7 +110,10 @@ else
_MSG="QS authorizations file is missing or empty (${_QS_AUTH_FILE})" _MSG="QS authorizations file is missing or empty (${_QS_AUTH_FILE})"
_STC=1 _STC=1
fi fi
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
return 0 return 0
} }
@ -101,8 +124,8 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether the Serviceguard quorum server is running PURPOSE : Checks whether the Serviceguard quorum server is running
LOG HEALTHY : Supported
EOT EOT

View File

@ -25,6 +25,8 @@
# @(#) 2017-04-01: initial version [Patrick Van der Veken] # @(#) 2017-04-01: 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 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_hpux_sshd_status
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _SSHD_PID_FILE="/var/run/sshd/sshd.pid" typeset _SSHD_PID_FILE="/var/run/sshd/sshd.pid"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -46,6 +48,7 @@ typeset _ARG=""
typeset _SSHD_PID="" typeset _SSHD_PID=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _LOG_HEALTHY=0
typeset _RC=0 typeset _RC=0
# handle arguments (originally comma-separated) # handle arguments (originally comma-separated)
@ -58,6 +61,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
# ---- process state ---- # ---- process state ----
# 1) try using the PID way # 1) try using the PID way
if [[ -r "${_SSHD_PID_FILE}" ]] if [[ -r "${_SSHD_PID_FILE}" ]]
@ -94,8 +111,11 @@ case ${_STC} in
;; ;;
esac esac
# handle results # report results
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
return 0 return 0
} }
@ -105,9 +125,10 @@ function _show_usage
{ {
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether sshd (Secure Shell daemon) is running PURPOSE : Checks whether sshd (Secure Shell daemon) is running
LOG HEALTHY : Supported
EOT EOT

View File

@ -19,7 +19,7 @@
# @(#) MAIN: check_hpux_syslog # @(#) MAIN: check_hpux_syslog
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: see _show_usage() # EXPECTS: see _show_usage()
# REQUIRES: data_comma2space(), init_hc(), log_hc() # REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2016-06-20: initial version [Patrick Van der Veken] # @(#) 2016-06-20: initial version [Patrick Van der Veken]
@ -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!
#****************************************************************************** #******************************************************************************
@ -37,7 +38,7 @@ function check_hpux_syslog
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf" typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
typeset _STATE_FILE="${STATE_PERM_DIR}/discovered.syslog" typeset _STATE_FILE="${STATE_PERM_DIR}/discovered.syslog"
typeset _VERSION="2019-01-24" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -49,6 +50,8 @@ typeset _ARG=""
typeset _MSG="" typeset _MSG=""
typeset _STC=0 typeset _STC=0
typeset _STC_COUNT=0 typeset _STC_COUNT=0
typeset _CFG_HEALTHY=""
typeset _LOG_HEALTHY=0
typeset _TMP_FILE="${TMP_DIR}/.$0.tmp.$$" typeset _TMP_FILE="${TMP_DIR}/.$0.tmp.$$"
typeset _CLASSES_LINE="" typeset _CLASSES_LINE=""
typeset _SYSLOG_FILE="" typeset _SYSLOG_FILE=""
@ -93,6 +96,30 @@ else
# add PID qualifier to last item # add PID qualifier to last item
_SYSLOG_CLASSES="${_SYSLOG_CLASSES}(\[[0-9]+\])?:" _SYSLOG_CLASSES="${_SYSLOG_CLASSES}(\[[0-9]+\])?:"
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
# 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 SYSLOG file # check SYSLOG file
[[ -r ${_SYSLOG_FILE} ]] || _MSG="SYSLOG file ${_SYSLOG_FILE} cannot be found" [[ -r ${_SYSLOG_FILE} ]] || _MSG="SYSLOG file ${_SYSLOG_FILE} cannot be found"
@ -144,8 +171,11 @@ else
_MSG="no new SYSLOG messages found" _MSG="no new SYSLOG messages found"
fi fi
# handle results # report results
log_hc "$0" ${_STC} "${_MSG}" if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
fi
# do cleanup # do cleanup
[[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1 [[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1
@ -159,13 +189,15 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 with: CONFIG : $3 with parameters:
log_healthy=<yes|no>
syslog_file=<path_to_syslog_file> syslog_file=<path_to_syslog_file>
syslog_classes=<list_of_facility_classes_to_search_for> syslog_classes=<list_of_facility_classes_to_search_for>
PURPOSE : Provides a KISS syslog monitor (keep tracks of already discovered messages in PURPOSE : Provides a KISS syslog monitor (keep tracks of already discovered messages in
a state file and compares new lines in SYSLOG to the ones kept in the a state file and compares new lines in SYSLOG to the ones kept in the
state file. The plugin will sort both state & SYSLOG data before doing state file. The plugin will sort both state & SYSLOG data before doing
the comparison. the comparison.
LOG HEALTHY : Supported
EOT EOT

View File

@ -24,6 +24,7 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2018-02-08: initial version [Patrick Van der Veken] # @(#) 2018-02-08: initial version [Patrick Van der Veken]
# @(#) 2018-02-13: fix to avoid log check if syslogd is not active [Patrick Van der Veken] # @(#) 2018-02-13: fix to avoid log check if syslogd is not active [Patrick Van der Veken]
# @(#) 2019-03-09: text updates [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 +35,7 @@ function check_hpux_syslogd_status
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _SYSLOGD_PID_FILE="/var/run/syslog.pid" typeset _SYSLOGD_PID_FILE="/var/run/syslog.pid"
typeset _SYSLOGD_LOG_FILE="/var/adm/syslog.log" typeset _SYSLOGD_LOG_FILE="/var/adm/syslog.log"
typeset _VERSION="2019-02-13" # YYYY-MM-DD typeset _VERSION="2019-03-09" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -159,7 +160,6 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether syslogd service is running and whether syslogd PURPOSE : Checks whether syslogd service is running and whether syslogd
is actually logging to ${_SYSLOGD_LOG_FILE}. is actually logging to ${_SYSLOGD_LOG_FILE}.
LOG HEALTHY : Supported LOG HEALTHY : Supported

View File

@ -24,6 +24,7 @@
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2016-04-28: initial version [Patrick Van der Veken] # @(#) 2016-04-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!
#****************************************************************************** #******************************************************************************
@ -32,7 +33,7 @@
function check_hpux_vg_minor_number function check_hpux_vg_minor_number
{ {
# ------------------------- 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="HP-UX" # uname -s match typeset _SUPPORTED_PLATFORMS="HP-UX" # 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 _VG="" typeset _VG=""
typeset _VG_DUPE="" typeset _VG_DUPE=""
typeset _VG_DUPES="" typeset _VG_DUPES=""
@ -57,8 +59,23 @@ 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
# get list of major and minor numbers for vgs # get list of major and minor numbers for vgs
vgdisplay -F | cut -f1 -d':' | cut -f2 -d'=' | while read _VG vgdisplay -F 2>>${HC_STDERR_LOG} | cut -f1 -d':' 2>/dev/null | cut -f2 -d'=' 2>/dev/null |\
while read -r _VG
do do
ls -l ${_VG}/group >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} ls -l ${_VG}/group >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
done done
@ -67,19 +84,25 @@ done
_VG_DUPES="$(awk '{ print $5":"$6 }' ${HC_STDOUT_LOG} | sort | uniq -d)" _VG_DUPES="$(awk '{ print $5":"$6 }' ${HC_STDOUT_LOG} | sort | uniq -d)"
if [[ -n ${_VG_DUPES} ]] if [[ -n ${_VG_DUPES} ]]
then then
print "${_VG_DUPES}" | while read _VG_DUPE print "${_VG_DUPES}" | while read -r _VG_DUPE
do do
_MSG="MAJ/MIN numbers combination '${_VG_DUPE}' is not unique" _MSG="MAJ/MIN numbers combination '${_VG_DUPE}' is not unique"
_STC=1 _STC=1
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
done done
else else
_MSG="no VGs with duplicate MAJ/MIN numbers detected" _MSG="no VGs with duplicate MAJ/MIN numbers detected"
# handle unit result # report result
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi
fi fi
return 0 return 0
@ -91,8 +114,9 @@ function _show_usage
cat <<- EOT cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3
PURPOSE : Checks whether all volume groups have a unique minor number PURPOSE : Checks whether all volume groups have a unique minor number
LOG HEALTHY : Supported
EOT EOT

View File

@ -142,6 +142,8 @@ case ${_STC} in
_MSG="could not determine status of sshd" _MSG="could not determine status of sshd"
;; ;;
esac esac
# report results
if (( _LOG_HEALTHY > 0 || _STC > 0 )) if (( _LOG_HEALTHY > 0 || _STC > 0 ))
then then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"