This commit is contained in:
Patrick Van der Veken 2020-07-07 14:39:28 +02:00
commit 6aedc6d180
6 changed files with 19 additions and 8 deletions

View File

@ -91,6 +91,10 @@ Additionally, there may be bundles for display or notification plugins, e.g.:
* hc-notify-eif * hc-notify-eif
* hc-notify-sms * hc-notify-sms
## Configure & deploy
An Ansible role is available at: https://github.com/patvdv/kudos.check_health
## Execute (examples) ## Execute (examples)
* **Listing** available health checks: * **Listing** available health checks:

View File

@ -1,4 +1,3 @@
/etc/opt/hc/core/templates/check_health.conf
/etc/opt/hc/core/templates/mail_body.tpl /etc/opt/hc/core/templates/mail_body.tpl
/etc/opt/hc/core/templates/mail_footer.tpl /etc/opt/hc/core/templates/mail_footer.tpl
/etc/opt/hc/core/templates/mail_header.tpl /etc/opt/hc/core/templates/mail_header.tpl

View File

@ -1,7 +1,7 @@
#****************************************************************************** #******************************************************************************
# @(#) check_linux_autofs.conf # @(#) check_hpux_autofs.conf
#****************************************************************************** #******************************************************************************
# This is a configuration file for the check_linux_autofs HC plugin. # This is a configuration file for the check_hpux_autofs HC plugin.
# All lines starting with a '#' are comment lines. # All lines starting with a '#' are comment lines.
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************

View File

@ -11,7 +11,7 @@
# [default: no] # [default: no]
log_healthy="no" log_healthy="no"
# specify properties as displayed by the 'vzlist -a -H -o ctid,status,onboot' command # specify properties as displayed by the 'hpvmstatus -M' command
# Format: # Format:
# [vpar:<parid>:<runtime_status>:<boot_status>] # [vpar:<parid>:<runtime_status>:<boot_status>]
# runtime_status should be 'on' or 'off' # runtime_status should be 'on' or 'off'

View File

@ -1,7 +1,7 @@
#****************************************************************************** #******************************************************************************
# @(#) check_linux_sg_package_status.conf # @(#) check_serviceguard_package_status.conf
#****************************************************************************** #******************************************************************************
# This is a configuration file for the check_linux_sg_package_status HC plugin. # This is a configuration file for the check_serviceguard_package_status HC plugin.
# All lines starting with a '#' are comment lines. # All lines starting with a '#' are comment lines.
# [default: indicates hardcoded script values if no value is defined here] # [default: indicates hardcoded script values if no value is defined here]
#****************************************************************************** #******************************************************************************

View File

@ -31,6 +31,7 @@
# @(#) 2019-03-09: added support for --log-healthy [Patrick Van der Veken] # @(#) 2019-03-09: added support for --log-healthy [Patrick Van der Veken]
# @(#) 2019-03-16: replace 'which' [Patrick Van der Veken] # @(#) 2019-03-16: replace 'which' [Patrick Van der Veken]
# @(#) 2019-03-25: fix for older Debian & Ubuntu [Patrick Van der Veken] # @(#) 2019-03-25: fix for older Debian & Ubuntu [Patrick Van der Veken]
# @(#) 2020-05-08: add pgrep als fallback check [Patrick Van der Veken]
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! # DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
#****************************************************************************** #******************************************************************************
@ -41,7 +42,7 @@ function check_linux_postfix_status
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _POSTFIX_INIT_SCRIPT="/etc/init.d/postfix" typeset _POSTFIX_INIT_SCRIPT="/etc/init.d/postfix"
typeset _POSTFIX_SYSTEMD_SERVICE="postfix.service" typeset _POSTFIX_SYSTEMD_SERVICE="postfix.service"
typeset _VERSION="2019-03-25" # YYYY-MM-DD typeset _VERSION="2020-05-08" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -135,7 +136,8 @@ then
then then
if (( $(${_POSTFIX_BIN} status 2>>${HC_STDERR_LOG} | grep -c -i 'is running' 2>/dev/null) == 0 )) if (( $(${_POSTFIX_BIN} status 2>>${HC_STDERR_LOG} | grep -c -i 'is running' 2>/dev/null) == 0 ))
then then
_STC=1 _RC=1
fi fi
else else
warn "postfix is not installed here" warn "postfix is not installed here"
@ -143,6 +145,12 @@ then
fi fi
fi fi
# 3) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC > 0 ))
then
(( $(pgrep -u postfix pickup 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=1
fi
# evaluate results # evaluate results
case ${_STC} in case ${_STC} in
0) 0)