Added support for --log-healthy (HP-UX)
Other fixes
This commit is contained in:
parent
47d8fa272a
commit
a2f1c51bea
@ -6,6 +6,11 @@
|
||||
# [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)
|
||||
# [default: yes]
|
||||
check_clone="yes"
|
||||
|
@ -6,8 +6,18 @@
|
||||
# [default: indicates hardcoded script values if no value is defined here]
|
||||
#******************************************************************************
|
||||
|
||||
# file (full path); maximum age in minutes since last change
|
||||
/var/adm/syslog/syslog.log;60
|
||||
# specify whether to also log passed health checks
|
||||
# (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
|
||||
|
@ -6,6 +6,11 @@
|
||||
# [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
|
||||
# [default: discovered.file_change]
|
||||
state_file=discovered.file_change
|
||||
|
@ -6,6 +6,11 @@
|
||||
# [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)
|
||||
# [default: yes]
|
||||
ignore_missing_fs="yes"
|
||||
|
@ -6,12 +6,18 @@
|
||||
# [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
|
||||
# [parid;runtime_status;boot_status]
|
||||
# Format:
|
||||
# [vpar:<parid>:<runtime_status>:<boot_status>]
|
||||
# runtime_status should be 'on' or 'off'
|
||||
# boot_status should be 'auto' or 'manual'
|
||||
# Examples:
|
||||
#1;on;auto
|
||||
#vpar:1:on:auto
|
||||
|
||||
|
||||
#******************************************************************************
|
||||
|
@ -6,6 +6,11 @@
|
||||
# [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
|
||||
# [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"
|
||||
|
@ -6,7 +6,13 @@
|
||||
# [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)
|
||||
# Format:
|
||||
# [param:<param_name>:<param_value>]
|
||||
# Examples:
|
||||
#param:nproc:5000
|
||||
|
@ -6,15 +6,21 @@
|
||||
# [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)
|
||||
# [ default: 90% ]
|
||||
max_kcusage=90
|
||||
|
||||
# specify individual kernel parameters and their maximum usage threshold (percentage)
|
||||
# definitions here will overrides max_kcusage for these parameters
|
||||
# Format:
|
||||
# [param:<param_name>:<param_threshold>]
|
||||
# Examples:
|
||||
# param:nproc:70
|
||||
#param:nproc:70
|
||||
|
||||
# specify parameters that should be excluded from the check
|
||||
# comma-separated list (as shown by kctune/kcusage)
|
||||
|
@ -15,6 +15,7 @@ log_healthy="yes"
|
||||
# [default: oacore,midaemon,perfalarm,ttd,ovcd,ovbbccb,perfd (v12)]
|
||||
ovpa_daemons=""
|
||||
|
||||
|
||||
#******************************************************************************
|
||||
# End of FILE
|
||||
#******************************************************************************
|
||||
|
@ -6,8 +6,17 @@
|
||||
# [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
|
||||
/opt/cfg2html/cfg2html_hpux.sh
|
||||
# Format:
|
||||
# cron:<cron_entry>
|
||||
# Examples:
|
||||
#cron:/opt/cfg2html/cfg2html_hpux.sh
|
||||
|
||||
|
||||
#******************************************************************************
|
||||
# End of FILE
|
||||
|
@ -6,9 +6,16 @@
|
||||
# [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:
|
||||
#status=up
|
||||
#sg:status=up
|
||||
|
||||
|
||||
#******************************************************************************
|
||||
|
@ -6,9 +6,16 @@
|
||||
# [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:
|
||||
#my_package|status=up
|
||||
#sg:my_package:status=up
|
||||
|
||||
|
||||
#******************************************************************************
|
||||
|
@ -6,6 +6,11 @@
|
||||
# [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
|
||||
# [default: /var/adm/syslog/syslog.log]
|
||||
syslog_file="/var/adm/syslog/syslog.log"
|
||||
|
@ -19,12 +19,13 @@
|
||||
# @(#) MAIN: check_hpux_autopath
|
||||
# DOES: see _show_usage().
|
||||
# EXPECTS: n/a
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2013-08-29: initial version [Patrick Van der Veken]
|
||||
# @(#) 2018-05-20: added dump_logs() [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!
|
||||
#******************************************************************************
|
||||
@ -35,7 +36,7 @@ function check_hpux_autopath
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _AUTOPATH_BIN="/sbin/autopath"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -47,6 +48,7 @@ typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _STC_COUNT=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _AUTOPATH_LINE=""
|
||||
typeset _DEVICE=""
|
||||
|
||||
@ -60,6 +62,20 @@ do
|
||||
esac
|
||||
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
|
||||
if [[ ! -x ${_AUTOPATH_BIN} ]]
|
||||
then
|
||||
@ -87,13 +103,16 @@ do
|
||||
_STC=1
|
||||
_STC_COUNT=$(( _STC_COUNT + 1 ))
|
||||
|
||||
# handle unit result
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
_STC=0
|
||||
done
|
||||
|
||||
# report OK situation
|
||||
if (( _STC_COUNT == 0 ))
|
||||
if (( _LOG_HEALTHY > 0 && _STC_COUNT == 0 ))
|
||||
then
|
||||
_MSG="no failed paths detected by {${_AUTOPATH_BIN}}"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
@ -108,9 +127,9 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether failed paths exist for StorageWorks disk arrays
|
||||
using the 'autopath' utility.
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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-03-09: added support for --log-healthy [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
@ -40,7 +41,7 @@ function check_hpux_drd_status
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -50,6 +51,8 @@ init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||
typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _RC=0
|
||||
typeset _CHECK_CLONE=""
|
||||
typeset _CHECK_SYNC=""
|
||||
@ -111,6 +114,30 @@ then
|
||||
_CHECK_SYNC="yes"
|
||||
fi
|
||||
_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
|
||||
if [[ ! -x ${_DRD_BIN} ]]
|
||||
@ -145,18 +172,27 @@ then
|
||||
[[ "${_BOOTED_DISK}" = "${_ACTIVE_DISK}" ]]
|
||||
then
|
||||
_MSG="host was booted from original disk (${_ACTIVE_DISK})"
|
||||
if (( _LOG_HEALTHY > 0 ))
|
||||
then
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
_MSG="host was booted from clone disk (${_ACTIVE_DISK})"
|
||||
if (( _LOG_HEALTHY > 0 ))
|
||||
then
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# check EFI status
|
||||
_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" ]]
|
||||
then
|
||||
_MSG="clone disk ${_CLONE_DISK} has a bootable EFI partition"
|
||||
if (( _LOG_HEALTHY > 0 ))
|
||||
then
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
_MSG="clone disk ${_CLONE_DISK} does not have a bootable EFI partition"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
@ -165,7 +201,10 @@ then
|
||||
if [[ "${_EFI_ORIGINAL}" = "AUTO file present, Boot loader present" ]]
|
||||
then
|
||||
_MSG="original disk ${_ORIGINAL_DISK} has a bootable EFI partition"
|
||||
if (( _LOG_HEALTHY > 0 ))
|
||||
then
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
_MSG="original disk ${_ORIGINAL_DISK} does not have a bootable EFI partition"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
@ -195,7 +234,10 @@ then
|
||||
if (( _CLONE_EPOCH > (_NOW_EPOCH - (_CLONE_MAX_AGE * 24 * 60 * 60)) ))
|
||||
then
|
||||
_MSG="clone age is younger than ${_CLONE_MAX_AGE} days [${_CLONE_DATE}]"
|
||||
if (( _LOG_HEALTHY > 0 ))
|
||||
then
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
_MSG="clone age is older than ${_CLONE_MAX_AGE} days [${_CLONE_DATE}]"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
@ -232,7 +274,10 @@ then
|
||||
if (( _SYNC_EPOCH > (_NOW_EPOCH - (_SYNC_MAX_AGE * 24 * 60 * 60)) ))
|
||||
then
|
||||
_MSG="sync age is younger than ${_SYNC_MAX_AGE} days [${_SYNC_DATE}]"
|
||||
if (( _LOG_HEALTHY > 0 ))
|
||||
then
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
fi
|
||||
else
|
||||
_MSG="sync age is older than ${_SYNC_MAX_AGE} days [${_SYNC_DATE}]"
|
||||
log_hc "$0" 1 "${_MSG}"
|
||||
@ -261,7 +306,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
check_clone=<yes|no>
|
||||
clone_age=<max_age_of_clone_in_days>
|
||||
check_sync=<yes|no>
|
||||
@ -269,6 +315,7 @@ CONFIG : $3 with:
|
||||
PURPOSE : Checks whether the DRD clone was correctly created
|
||||
Checks for correct EFI partitions
|
||||
Checks the age of the DRD clone and/or sync
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,7 +19,8 @@
|
||||
# @(#) MAIN: check_hpux_file_age
|
||||
# DOES: 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:
|
||||
# @(#) 2013-05-27: initial version [Patrick Van der Veken]
|
||||
@ -27,6 +28,8 @@
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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-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!
|
||||
#******************************************************************************
|
||||
@ -36,7 +39,7 @@ function check_hpux_file_age
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -47,6 +50,8 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _REF_FILE="${TMP_DIR}/.$0.ref.$$"
|
||||
typeset _DO_REF=0
|
||||
typeset _ENTRY=""
|
||||
@ -54,6 +59,7 @@ typeset _FILE_PATH=""
|
||||
typeset _FILE_AGE=""
|
||||
typeset _FILE_NAME=""
|
||||
typeset _FILE_DIR=""
|
||||
typeset _IS_OLD_STYLE=0
|
||||
|
||||
# set local trap for cleanup
|
||||
# shellcheck disable=SC2064
|
||||
@ -76,14 +82,42 @@ 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 "^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
|
||||
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
|
||||
# field split
|
||||
_FILE_PATH=$(print "${_ENTRY%%;*}")
|
||||
_FILE_AGE=$(print "${_ENTRY##*;}")
|
||||
|
||||
# split file/dir
|
||||
_FILE_NAME=$(print "${_FILE_PATH##*/}")
|
||||
_FILE_DIR=$(print "${_FILE_PATH%/*}")
|
||||
@ -94,16 +128,12 @@ do
|
||||
warn "missing values in configuration file at ${_CONFIG_FILE}"
|
||||
return 1
|
||||
fi
|
||||
case "${_FILE_AGE}" in
|
||||
+([0-9])*(.)*([0-9]))
|
||||
# numeric, OK
|
||||
;;
|
||||
*)
|
||||
# not numeric
|
||||
data_is_numeric "${_FILE_AGE}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "invalid file age value '${_FILE_AGE}' in configuration file at ${_CONFIG_FILE}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# calculate reference timestamp & set reference file (once only)
|
||||
if (( _DO_REF == 0 ))
|
||||
@ -122,7 +152,7 @@ do
|
||||
fi
|
||||
_DO_REF=1
|
||||
fi
|
||||
sleep 60
|
||||
sleep 60
|
||||
# perform check
|
||||
if [[ ! -r "${_FILE_PATH}" ]]
|
||||
then
|
||||
@ -145,8 +175,11 @@ sleep 60
|
||||
fi
|
||||
fi
|
||||
|
||||
# handle unit result
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
_STC=0
|
||||
done
|
||||
|
||||
@ -162,10 +195,13 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
<file_name>;<maximum_age_in_minutes>
|
||||
CONFIG : $3 with parameters:
|
||||
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
|
||||
(requires perl!)
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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-03-09: added support for --log-healthy [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
@ -36,7 +37,7 @@ function check_hpux_file_change
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -47,6 +48,8 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _DO_META_CHECK=0
|
||||
typeset _CFG_STATE_FILE=""
|
||||
typeset _STATE_FILE=""
|
||||
@ -111,6 +114,30 @@ case "${_DO_META_CHECK}" in
|
||||
log "check for meta characters is enabled"
|
||||
;;
|
||||
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
|
||||
_OPENSSL_BIN="$(which openssl 2>>${HC_STDERR_LOG})"
|
||||
@ -293,7 +320,7 @@ do
|
||||
fi
|
||||
|
||||
# bounce failures back and jump to next file
|
||||
if (( _STC > 0 ))
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
continue
|
||||
@ -319,7 +346,11 @@ do
|
||||
printf "%s|%s|%s\n" "${_FILE_TO_CHECK}" "${_FILE_TYPE}" "${_FILE_CKSUM}" >>${_TMP2_FILE}
|
||||
|
||||
# report with curr/exp values
|
||||
if (( _LOG_HEALTHY > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}" "${_FILE_CKSUM}" "${_STATE_FILE_CKSUM}"
|
||||
continue
|
||||
fi
|
||||
done <${_TMP1_FILE}
|
||||
|
||||
# update state file (also if TMP2_FILE is empty)
|
||||
@ -350,7 +381,9 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
and formatted stanzas:
|
||||
incl:<full path>
|
||||
excl:<full path>
|
||||
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
|
||||
ages and probably will cause the plugin to time out
|
||||
(see HC_TIME_OUT). YMMV.
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,13 +19,14 @@
|
||||
# @(#) MAIN: check_hpux_fs_mounts
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: n/a
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2013-05-27: initial version [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]
|
||||
# @(#) 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!
|
||||
#******************************************************************************
|
||||
@ -34,7 +35,7 @@
|
||||
function check_hpux_fs_mounts
|
||||
{
|
||||
# ------------------------- 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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -45,6 +46,7 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _FS=""
|
||||
typeset _FS_COUNT=0
|
||||
|
||||
@ -58,6 +60,20 @@ do
|
||||
esac
|
||||
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)
|
||||
mount >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
|
||||
if (( $? > 0 ))
|
||||
@ -86,8 +102,11 @@ do
|
||||
;;
|
||||
esac
|
||||
|
||||
# handle unit result
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
_STC=0
|
||||
done
|
||||
|
||||
@ -103,8 +122,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether file systems are mounted or not
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
# @(#) MAIN: check_hpux_fs_mounts_options
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: see _show_usage()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 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]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -36,7 +37,7 @@ function check_hpux_fs_mounts_options
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -47,6 +48,8 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _CONFIG_FS=""
|
||||
typeset _CONFIG_OPTS=""
|
||||
typeset _CURR_OPTS=""
|
||||
@ -80,6 +83,30 @@ then
|
||||
# default
|
||||
_IGNORE_FS="yes"
|
||||
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)
|
||||
mount >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
|
||||
@ -117,8 +144,11 @@ do
|
||||
fi
|
||||
fi
|
||||
|
||||
# handle unit result
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}" "${_CURR_OPTS}" "${_CONFIG_OPTS}"
|
||||
fi
|
||||
_STC=0
|
||||
done
|
||||
|
||||
@ -131,11 +161,13 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
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>
|
||||
Other options:
|
||||
ignore_missing_fs=yes|no
|
||||
PURPOSE : Checks whether file systems are mounted with correct options
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
# @(#) 2019-01-30: refactored to support custom defintions with all
|
||||
# filesystems check [Patrick Van der Veken]
|
||||
# @(#) 2019-02-18: fixes + help update
|
||||
# @(#) 2019-03-09: text fixes
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
@ -36,7 +37,7 @@ function check_hpux_fs_usage
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -291,15 +292,17 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with formatted stanzas (optional):
|
||||
fs:<fs_name>:<max_inodes_usage_in_%>:<max_space_usage_in%>
|
||||
Other options:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
check_inodes_usage=<yes|no>
|
||||
check_space_usage=<yes|no>
|
||||
max_inodes_usage=<general_inodes_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
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
# @(#) 2017-05-18: initial version [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -33,7 +34,7 @@
|
||||
function check_hpux_guid_status
|
||||
{
|
||||
# ------------------------- 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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -45,6 +46,7 @@ typeset _ARG=""
|
||||
typeset _GUID_PID=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _RC=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
@ -57,6 +59,20 @@ do
|
||||
esac
|
||||
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 ----
|
||||
# 1) try using the PID way
|
||||
if [[ -r "${_GUID_PID_FILE}" ]]
|
||||
@ -101,8 +117,11 @@ case ${_STC} in
|
||||
;;
|
||||
esac
|
||||
|
||||
# handle results
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -113,8 +132,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether guid daemons (VSP GUID) are running
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -37,7 +39,7 @@ function check_hpux_hpvm_vpar_status
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -57,6 +59,8 @@ typeset _PAR_ENTRY=""
|
||||
typeset _PAR_MATCH=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _RC=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
@ -69,6 +73,46 @@ do
|
||||
esac
|
||||
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
|
||||
if [[ ! -x ${_HPVMSTATUS_BIN} || -z "${_HPVMSTATUS_BIN}" ]]
|
||||
then
|
||||
@ -86,24 +130,14 @@ ${_HPVMSTATUS_BIN} -M >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
|
||||
}
|
||||
|
||||
# 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
|
||||
# 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
|
||||
case "${_PAR_ID}" in
|
||||
+([0-9])*(.)*([0-9]))
|
||||
# numeric, OK
|
||||
;;
|
||||
*)
|
||||
# not numeric
|
||||
data_is_numeric "${_PAR_ID}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "invalid partition ID '${_PAR_ID}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case "${_PAR_CFG_STATUS}" in
|
||||
on|off)
|
||||
;;
|
||||
@ -124,13 +158,8 @@ do
|
||||
done
|
||||
|
||||
# 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
|
||||
# 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)
|
||||
_PAR_MATCH=$(grep -i "^.*:.*:${_PAR_ID}::Integrity" ${HC_STDOUT_LOG} 2>/dev/null)
|
||||
if [[ -n "${_PAR_MATCH}" ]]
|
||||
@ -157,7 +186,10 @@ do
|
||||
_MSG="partition ${_PAR_ID} has a wrong boot flag [${_PAR_RUN_BOOT}]"
|
||||
_STC=1
|
||||
fi
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}" "${_PAR_RUN_BOOT}" "${_PAR_CFG_BOOT}"
|
||||
fi
|
||||
else
|
||||
warn "could not determine status for partition ${_PAR_ID} from command output {${_HPVMSTATUS_BIN}}"
|
||||
_RC=1
|
||||
@ -173,9 +205,12 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
<parid>;<runtime_status>;<boot_status>
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
and formatted stanzas:
|
||||
vpar:<parid>:<runtime_status>:<boot_status>
|
||||
PURPOSE : Checks the status of vPars (on a VSP)
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
# @(#) 2017-04-23: initial version [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -34,7 +35,7 @@ function check_hpux_httpd_status
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -47,6 +48,7 @@ typeset _HTTPD_BIN=""
|
||||
typeset _HTTPD_PID=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _RC=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
@ -59,6 +61,20 @@ do
|
||||
esac
|
||||
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 ----
|
||||
# 1) try using the PID way
|
||||
if [[ -r "${_HTTPD_PID_FILE}" ]]
|
||||
@ -94,7 +110,11 @@ case ${_STC} in
|
||||
_MSG="could not determine status of httpd"
|
||||
;;
|
||||
esac
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
|
||||
# ---- config state ----
|
||||
_HTTPD_BIN="$(which httpd 2>>${HC_STDERR_LOG})"
|
||||
@ -110,7 +130,11 @@ then
|
||||
_MSG="httpd configuration files have syntax error(s) {httpd -s}"
|
||||
_STC=1
|
||||
fi
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -122,8 +146,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether httpd (apache) is running
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
# @(#) MAIN: check_hpux_ignite_backup
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: see _show_usage()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2013-05-28: initial version [Patrick Van der Veken]
|
||||
@ -28,7 +28,8 @@
|
||||
# @(#) 2016-06-03: small fix [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-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!
|
||||
#******************************************************************************
|
||||
@ -42,7 +43,7 @@ typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
typeset _IGNITE_NEEDLE="^DONE"
|
||||
typeset _IGNITE_SERVER_FILE="/var/opt/ignite/server/ignite.defs"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -246,8 +247,10 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
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
|
||||
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.
|
||||
|
@ -31,6 +31,7 @@
|
||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -42,7 +43,7 @@ function check_hpux_ioscan
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
typeset _IOSCAN_BIN="/usr/sbin/ioscan"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -54,6 +55,8 @@ typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _STC_COUNT=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _CLASS_LINE=""
|
||||
typeset _IOSCAN_CLASSES=""
|
||||
typeset _AGILE_VIEW=""
|
||||
@ -102,6 +105,30 @@ then
|
||||
# default
|
||||
_AGILE_VIEW="yes"
|
||||
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
|
||||
if [[ ! -x ${_IOSCAN_BIN} ]]
|
||||
@ -163,12 +190,16 @@ do
|
||||
continue
|
||||
esac
|
||||
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
_STC=0
|
||||
done
|
||||
|
||||
# report OK situation
|
||||
if (( _STC_COUNT == 0 ))
|
||||
if (( _LOG_HEALTHY > 0 && _STC_COUNT == 0 ))
|
||||
then
|
||||
_MSG="no problems detected by {${_IOSCAN_BIN}}"
|
||||
log_hc "$0" 0 "${_MSG}"
|
||||
@ -184,10 +215,13 @@ cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
ioscan_classes=<list_of_device_classes_to_check>
|
||||
kernel_mode=<yes|no>
|
||||
agile_view=<yes|no>
|
||||
PURPOSE : Checks whether 'ioscan' returns errors or not (NO_HW, ERROR)
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -37,7 +38,7 @@ function check_hpux_kernel_params
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -48,6 +49,8 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _PARAM_NAME=""
|
||||
typeset _CONFIG_VALUE=""
|
||||
typeset _CURR_VALUE=""
|
||||
@ -73,6 +76,30 @@ 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
|
||||
|
||||
# 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
|
||||
if [[ ! -x ${_KCTUNE_BIN} ]]
|
||||
@ -140,8 +167,11 @@ do
|
||||
_REPORTED_VALUE="${_EXPR_VALUE}"
|
||||
fi
|
||||
|
||||
# handle unit result
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}" "${_REPORTED_VALUE}" "${_CONFIG_VALUE}"
|
||||
fi
|
||||
_STC=0
|
||||
done
|
||||
|
||||
@ -154,9 +184,12 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with formatted stanzas:
|
||||
param:<my_param1>:<my_param1_value>
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
and formatted stanzas:
|
||||
param:<param_name>:<param_value>
|
||||
PURPOSE : Checks kernel parameters have a correct run-time value/expression
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,7 +19,8 @@
|
||||
# @(#) MAIN: check_hpux_kernel_usage
|
||||
# DOES: 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:
|
||||
# @(#) 2017-12-22: original version [Patrick Van der Veken]
|
||||
@ -28,6 +29,8 @@
|
||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -38,7 +41,7 @@ function check_hpux_kernel_usage
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -49,6 +52,8 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _MAX_KCUSAGE=0
|
||||
typeset _EXCLUDED_PARAMS=""
|
||||
typeset _HANDLED_PARAMS=""
|
||||
@ -90,6 +95,30 @@ if [[ -n "${_EXCLUDED_PARAMS}" ]]
|
||||
then
|
||||
log "excluding following kernel parameters: ${_EXCLUDED_PARAMS}"
|
||||
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
|
||||
if [[ ! -x ${_KCUSAGE_BIN} ]]
|
||||
@ -126,21 +155,19 @@ do
|
||||
return 1
|
||||
fi
|
||||
# check if the threshold value is correct (integer)
|
||||
case "${_CONFIG_VALUE}" in
|
||||
[0-9]*)
|
||||
# numeric, OK
|
||||
data_is_numeric "${_CONFIG_VALUE}"
|
||||
if (( $? == 0 ))
|
||||
then
|
||||
if (( _CONFIG_VALUE < 1 || _CONFIG_VALUE > 99 ))
|
||||
then
|
||||
warn "incorrect threshold value '${_CONFIG_VALUE}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
else
|
||||
# not numeric
|
||||
warn "invalid threshold value '${_CONFIG_VALUE}' in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
_LINE_COUNT=$(( _LINE_COUNT + 1 ))
|
||||
done
|
||||
|
||||
@ -164,8 +191,11 @@ do
|
||||
# push to handled list
|
||||
_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}"
|
||||
fi
|
||||
_STC=0
|
||||
done
|
||||
|
||||
@ -198,8 +228,11 @@ do
|
||||
_MSG="${_PARAM_NAME} is below the general threshold (${_CHECK_VALUE}% <= ${_MAX_KCUSAGE}%)"
|
||||
fi
|
||||
|
||||
# handle unit result
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}" "${_CHECK_VALUE}" "${_MAX_KCUSAGE}"
|
||||
fi
|
||||
_STC=0
|
||||
fi
|
||||
done
|
||||
@ -213,12 +246,14 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with formatted stanzas:
|
||||
param:<my_param1>:<my_param1_threshold_%>
|
||||
Other options:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
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
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
# @(#) [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-09-03: small variable fix [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# 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 _SCSIMGR_BIN="/usr/sbin/scsimgr"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -58,7 +59,6 @@ typeset _ACTIVE_PATH_COUNT=""
|
||||
typeset _ALL_PATH_COUNT=""
|
||||
typeset _FAILED_PATH_COUNT=""
|
||||
typeset _STANDBY_PATH_COUNT=""
|
||||
typeset _WWID=""
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
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]
|
||||
}
|
||||
}' ${_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
|
||||
if [[ -z "${_ACTIVE_PATH_COUNT}" ]] ||
|
||||
[[ -z "${_ALL_PATH_COUNT}" ]] ||
|
||||
@ -261,8 +261,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
|
||||
PURPOSE : Check the active and failed (non-active) lunpaths of DISK devices
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2017-01-07: initial version [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!
|
||||
#******************************************************************************
|
||||
@ -33,7 +34,7 @@ function check_hpux_named_status
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -46,6 +47,7 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _RC=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
@ -58,6 +60,20 @@ do
|
||||
esac
|
||||
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 ----
|
||||
# 1) try using the PID way
|
||||
if [[ -r "${_NAMED_PID_FILE}" ]]
|
||||
@ -93,7 +109,11 @@ case ${_STC} in
|
||||
_MSG="could not determine status of named"
|
||||
;;
|
||||
esac
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
|
||||
# ---- config state ----
|
||||
_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}"
|
||||
_STC=1
|
||||
fi
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -121,9 +145,9 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether named (BIND) service is running and whether the named
|
||||
zone files are syntactically correct.
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
# @(#) 2019-01-10: added configuration option 'ntpq_use_ipv4', fixed problem
|
||||
# @(#) with offset calculation [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!
|
||||
#------------------------------------------------------------------------------
|
||||
@ -38,7 +39,7 @@ function check_hpux_ntp_status
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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 _NTPQ_BIN="/usr/sbin/ntpq"
|
||||
typeset _NTPQ_OPTS="-pn"
|
||||
@ -183,7 +184,7 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
max_offset=<max_offset (ms)>
|
||||
force_chrony=<yes|no>
|
||||
|
@ -29,6 +29,7 @@
|
||||
# @(#) 2018-10-22: small fixes [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -38,7 +39,7 @@ function check_hpux_ovpa_status
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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 _OVPA_BIN="/opt/perf/bin/perfstat"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
@ -162,7 +163,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
ovpa_daemons=<list_of_ovpa_processes_to_check>
|
||||
PURPOSE : Checks the status of OVPA processes (OpenView Performance Agent)
|
||||
LOG HEALTHY : Supported
|
||||
|
@ -29,6 +29,7 @@
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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-03-09: text updates [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# 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 _SHOW_PATCHES_BIN="/usr/contrib/bin/show_patches"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -258,7 +259,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
required_patches=<list_of_patches_to_check>
|
||||
required_oe=<OE_version>
|
||||
check_filesets=<yes|no>
|
||||
@ -266,6 +268,7 @@ CONFIG : $3 with:
|
||||
PURPOSE : Checks whether the required OE (Operating Environment) version is installed
|
||||
Checks whether the required patches are installed
|
||||
Checks whether filesets are in a configured state
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,11 +19,12 @@
|
||||
# @(#) MAIN: check_hpux_postfix_status
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: n/a
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2016-12-01: initial version [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!
|
||||
#******************************************************************************
|
||||
@ -32,7 +33,7 @@
|
||||
function check_hpux_postfix_status
|
||||
{
|
||||
# ------------------------- 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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -44,6 +45,7 @@ typeset _ARG=""
|
||||
typeset _POSTFIX_BIN=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
for _ARG in ${_ARGS}
|
||||
@ -55,6 +57,20 @@ do
|
||||
esac
|
||||
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})"
|
||||
if [[ -x ${_POSTFIX_BIN} && -n "${_POSTFIX_BIN}" ]]
|
||||
then
|
||||
@ -71,8 +87,11 @@ else
|
||||
return 1
|
||||
fi
|
||||
|
||||
# handle results
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -83,8 +102,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether postfix (mail system) is running
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,11 +19,13 @@
|
||||
# @(#) MAIN: check_hpux_root_crontab
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: n/a
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2013-09-19: initial version [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!
|
||||
#******************************************************************************
|
||||
@ -33,7 +35,7 @@ function check_hpux_root_crontab
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -44,8 +46,11 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _CRON_ENTRY=""
|
||||
typeset _CRON_MATCH=0
|
||||
typeset _IS_OLD_STYLE=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
for _ARG in ${_ARGS}
|
||||
@ -64,12 +69,44 @@ 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 "^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
|
||||
crontab -l >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
|
||||
|
||||
# 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
|
||||
_CRON_MATCH=$(grep -v '^#' ${HC_STDOUT_LOG} 2>/dev/null |\
|
||||
grep -c -E -e "${_CRON_ENTRY}")
|
||||
@ -86,8 +123,11 @@ do
|
||||
;;
|
||||
esac
|
||||
|
||||
# handle unit result
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
_STC=0
|
||||
done
|
||||
|
||||
@ -100,8 +140,12 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
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
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2018-10-28: initial version [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!
|
||||
#******************************************************************************
|
||||
@ -37,7 +38,7 @@ typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
typeset _SFMCONFIG_BIN="/opt/sfm/bin/sfmconfig"
|
||||
typeset _EVWEB_BIN="/opt/sfm/bin/evweb"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -395,7 +396,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
check_events=<yes|no>
|
||||
events_age=<age_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)
|
||||
* sends & checks a test event (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
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -37,7 +39,7 @@ function check_hpux_sg_cluster_status
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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 _SG_DAEMON="/usr/lbin/cmcld"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
@ -49,11 +51,14 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _SG_ENTRY=""
|
||||
typeset _SG_MATCH=""
|
||||
typeset _SG_CFG_PARAM=""
|
||||
typeset _SG_CFG_VALUE=""
|
||||
typeset _SG_RUN_VALUE=""
|
||||
typeset _IS_OLD_STYLE=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
for _ARG in ${_ARGS}
|
||||
@ -72,6 +77,38 @@ 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 "^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
|
||||
if [[ ! -x ${_SG_DAEMON} ]]
|
||||
@ -91,7 +128,8 @@ fi
|
||||
|
||||
# do cluster status checks
|
||||
# (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
|
||||
# field split
|
||||
_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}]"
|
||||
_STC=1
|
||||
fi
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}" "${_SG_RUN_VALUE}" "${_SG_CFG_VALUE}"
|
||||
fi
|
||||
else
|
||||
warn "could not determine status for ${_SG_CFG_PARAM} from command output {cmviewcl}"
|
||||
fi
|
||||
@ -126,8 +167,12 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
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+)
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -37,7 +39,7 @@ function check_hpux_sg_package_status
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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 _SG_DAEMON="/usr/lbin/cmcld"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
@ -49,12 +51,15 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _SG_ENTRY=""
|
||||
typeset _SG_MATCH=""
|
||||
typeset _SG_PACKAGE=""
|
||||
typeset _SG_CFG_PARAM=""
|
||||
typeset _SG_CFG_VALUE=""
|
||||
typeset _SG_RUN_VALUE=""
|
||||
typeset _IS_OLD_STYLE=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
for _ARG in ${_ARGS}
|
||||
@ -73,6 +78,38 @@ 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 "^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
|
||||
if [[ ! -x ${_SG_DAEMON} ]]
|
||||
@ -92,7 +129,8 @@ fi
|
||||
|
||||
# do package status checks
|
||||
# (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
|
||||
# field split
|
||||
_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}]"
|
||||
_STC=1
|
||||
fi
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}" "${_SG_RUN_VALUE}" "${_SG_CFG_VALUE}"
|
||||
fi
|
||||
else
|
||||
warn "could not determine status for ${_SG_PACKAGE}/${_SG_CFG_PARAM} from command output {cmviewcl}"
|
||||
fi
|
||||
@ -128,8 +169,12 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
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+)
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,12 +19,13 @@
|
||||
# @(#) MAIN: check_hpux_sg_qs_status
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: n/a
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2017-05-01: initial version [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -33,7 +34,7 @@
|
||||
function check_hpux_sg_qs_status
|
||||
{
|
||||
# ------------------------- 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 _QS_BIN="/usr/lbin/qsc"
|
||||
typeset _QS_AUTH_FILE="/etc/cmcluster/qs_authfile"
|
||||
@ -46,6 +47,7 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
for _ARG in ${_ARGS}
|
||||
@ -57,6 +59,21 @@ do
|
||||
esac
|
||||
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
|
||||
if [[ ! -x ${_QS_BIN} ]]
|
||||
then
|
||||
@ -79,7 +96,10 @@ case ${_STC} in
|
||||
_MSG="could not determine status of QS"
|
||||
;;
|
||||
esac
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
|
||||
# ---- config state ----
|
||||
if [[ -s ${_QS_AUTH_FILE} ]]
|
||||
@ -90,7 +110,10 @@ else
|
||||
_MSG="QS authorizations file is missing or empty (${_QS_AUTH_FILE})"
|
||||
_STC=1
|
||||
fi
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -101,8 +124,8 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether the Serviceguard quorum server is running
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
# @(#) 2017-04-01: initial version [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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!
|
||||
#******************************************************************************
|
||||
@ -34,7 +36,7 @@ function check_hpux_sshd_status
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -46,6 +48,7 @@ typeset _ARG=""
|
||||
typeset _SSHD_PID=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _RC=0
|
||||
|
||||
# handle arguments (originally comma-separated)
|
||||
@ -58,6 +61,20 @@ do
|
||||
esac
|
||||
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 ----
|
||||
# 1) try using the PID way
|
||||
if [[ -r "${_SSHD_PID_FILE}" ]]
|
||||
@ -94,8 +111,11 @@ case ${_STC} in
|
||||
;;
|
||||
esac
|
||||
|
||||
# handle results
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
# report results
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -105,9 +125,10 @@ function _show_usage
|
||||
{
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether sshd (Secure Shell daemon) is running
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
# @(#) MAIN: check_hpux_syslog
|
||||
# DOES: see _show_usage()
|
||||
# EXPECTS: see _show_usage()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc()
|
||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2016-06-20: initial version [Patrick Van der Veken]
|
||||
@ -27,6 +27,7 @@
|
||||
# @(#) 2018-10-28: fixed (linter) errors [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-03-09: added support for --log-healthy [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
@ -37,7 +38,7 @@ function check_hpux_syslog
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -49,6 +50,8 @@ typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _STC_COUNT=0
|
||||
typeset _CFG_HEALTHY=""
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _TMP_FILE="${TMP_DIR}/.$0.tmp.$$"
|
||||
typeset _CLASSES_LINE=""
|
||||
typeset _SYSLOG_FILE=""
|
||||
@ -93,6 +96,30 @@ else
|
||||
# add PID qualifier to last item
|
||||
_SYSLOG_CLASSES="${_SYSLOG_CLASSES}(\[[0-9]+\])?:"
|
||||
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
|
||||
[[ -r ${_SYSLOG_FILE} ]] || _MSG="SYSLOG file ${_SYSLOG_FILE} cannot be found"
|
||||
@ -144,8 +171,11 @@ else
|
||||
_MSG="no new SYSLOG messages found"
|
||||
fi
|
||||
|
||||
# handle results
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
# report results
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
|
||||
# do cleanup
|
||||
[[ -f ${_TMP_FILE} ]] && rm -f ${_TMP_FILE} >/dev/null 2>&1
|
||||
@ -159,13 +189,15 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3 with:
|
||||
CONFIG : $3 with parameters:
|
||||
log_healthy=<yes|no>
|
||||
syslog_file=<path_to_syslog_file>
|
||||
syslog_classes=<list_of_facility_classes_to_search_for>
|
||||
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
|
||||
state file. The plugin will sort both state & SYSLOG data before doing
|
||||
the comparison.
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
# @(#) HISTORY:
|
||||
# @(#) 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]
|
||||
# @(#) 2019-03-09: text updates [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
@ -34,7 +35,7 @@ function check_hpux_syslogd_status
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _SYSLOGD_PID_FILE="/var/run/syslog.pid"
|
||||
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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -159,7 +160,6 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether syslogd service is running and whether syslogd
|
||||
is actually logging to ${_SYSLOGD_LOG_FILE}.
|
||||
LOG HEALTHY : Supported
|
||||
|
@ -24,6 +24,7 @@
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2016-04-28: initial version [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!
|
||||
#******************************************************************************
|
||||
@ -32,7 +33,7 @@
|
||||
function check_hpux_vg_minor_number
|
||||
{
|
||||
# ------------------------- 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
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@ -43,6 +44,7 @@ typeset _ARGS=$(data_comma2space "$*")
|
||||
typeset _ARG=""
|
||||
typeset _MSG=""
|
||||
typeset _STC=0
|
||||
typeset _LOG_HEALTHY=0
|
||||
typeset _VG=""
|
||||
typeset _VG_DUPE=""
|
||||
typeset _VG_DUPES=""
|
||||
@ -57,8 +59,23 @@ do
|
||||
esac
|
||||
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
|
||||
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
|
||||
ls -l ${_VG}/group >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
|
||||
done
|
||||
@ -67,19 +84,25 @@ done
|
||||
_VG_DUPES="$(awk '{ print $5":"$6 }' ${HC_STDOUT_LOG} | sort | uniq -d)"
|
||||
if [[ -n ${_VG_DUPES} ]]
|
||||
then
|
||||
print "${_VG_DUPES}" | while read _VG_DUPE
|
||||
print "${_VG_DUPES}" | while read -r _VG_DUPE
|
||||
do
|
||||
_MSG="MAJ/MIN numbers combination '${_VG_DUPE}' is not unique"
|
||||
_STC=1
|
||||
|
||||
# handle unit result
|
||||
# report result
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
_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}"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -91,8 +114,9 @@ function _show_usage
|
||||
cat <<- EOT
|
||||
NAME : $1
|
||||
VERSION : $2
|
||||
CONFIG : $3
|
||||
PURPOSE : Checks whether all volume groups have a unique minor number
|
||||
LOG HEALTHY : Supported
|
||||
|
||||
|
||||
EOT
|
||||
|
||||
|
@ -142,6 +142,8 @@ case ${_STC} in
|
||||
_MSG="could not determine status of sshd"
|
||||
;;
|
||||
esac
|
||||
|
||||
# report results
|
||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||
then
|
||||
log_hc "$0" ${_STC} "${_MSG}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user