From 7371dc12da2986825d4065d989599dc780742814 Mon Sep 17 00:00:00 2001 From: patvdv Date: Sun, 10 Mar 2019 12:05:43 +0100 Subject: [PATCH] Fixes!! --- configs/etc/check_linux_file_age.conf.dist | 2 +- configs/etc/check_linux_file_change.conf.dist | 2 +- configs/etc/check_linux_fs_usage.conf.dist | 2 +- configs/etc/check_linux_hpacucli.conf.dist | 2 +- configs/etc/check_linux_hpasmcli.conf.dist | 2 +- configs/etc/check_linux_hplog.conf.dist | 2 +- configs/etc/check_linux_hpssacli.conf.dist | 2 +- .../etc/check_linux_mysqld_status.conf.dist | 2 +- configs/etc/check_linux_ntp_status.conf.dist | 2 +- .../etc/check_linux_process_limits.conf.dist | 2 +- .../etc/check_linux_root_crontab.conf.dist | 2 +- .../check_linux_sg_cluster_status.conf.dist | 2 +- .../check_linux_sg_package_status.conf.dist | 2 +- .../etc/check_linux_vz_ct_counters.conf.dist | 2 +- .../etc/check_linux_vz_ct_status.conf.dist | 2 +- .../platform/linux/check_linux_burp_backup.sh | 23 ++++++++++--------- .../platform/linux/check_linux_file_age.sh | 3 ++- .../platform/linux/check_linux_file_change.sh | 1 + .../platform/linux/check_linux_hpacucli.sh | 1 + .../platform/linux/check_linux_hpasmcli.sh | 1 + .../lib/platform/linux/check_linux_hplog.sh | 1 + .../platform/linux/check_linux_hpssacli.sh | 1 + .../linux/check_linux_root_crontab.sh | 3 ++- .../linux/check_linux_sg_cluster_status.sh | 2 +- .../linux/check_linux_sg_package_status.sh | 2 +- 25 files changed, 38 insertions(+), 30 deletions(-) diff --git a/configs/etc/check_linux_file_age.conf.dist b/configs/etc/check_linux_file_age.conf.dist index 4fd1889..19fc432 100644 --- a/configs/etc/check_linux_file_age.conf.dist +++ b/configs/etc/check_linux_file_age.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # specify file details # Format: diff --git a/configs/etc/check_linux_file_change.conf.dist b/configs/etc/check_linux_file_change.conf.dist index ec19e2d..e11bf26 100644 --- a/configs/etc/check_linux_file_change.conf.dist +++ b/configs/etc/check_linux_file_change.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # name of the state file to use (will be relative to /var/opt/hc/state/persistent # [default: discovered.file_change] diff --git a/configs/etc/check_linux_fs_usage.conf.dist b/configs/etc/check_linux_fs_usage.conf.dist index 61d55d7..0949e5c 100644 --- a/configs/etc/check_linux_fs_usage.conf.dist +++ b/configs/etc/check_linux_fs_usage.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # specify whether to perform inode usage check # [default: yes] diff --git a/configs/etc/check_linux_hpacucli.conf.dist b/configs/etc/check_linux_hpacucli.conf.dist index 708fdba..1579a55 100644 --- a/configs/etc/check_linux_hpacucli.conf.dist +++ b/configs/etc/check_linux_hpacucli.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # location of 'hpacucli' tool hpacucli_bin="/usr/sbin/hpacucli" diff --git a/configs/etc/check_linux_hpasmcli.conf.dist b/configs/etc/check_linux_hpasmcli.conf.dist index 6072978..6127e62 100644 --- a/configs/etc/check_linux_hpasmcli.conf.dist +++ b/configs/etc/check_linux_hpasmcli.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # location of 'hpasmcli' tool hpasmcli_bin="/sbin/hpasmcli" diff --git a/configs/etc/check_linux_hplog.conf.dist b/configs/etc/check_linux_hplog.conf.dist index 1c2e83e..ac0ac65 100644 --- a/configs/etc/check_linux_hplog.conf.dist +++ b/configs/etc/check_linux_hplog.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # location of 'hpacucli' tool hplog_bin="/sbin/hplog" diff --git a/configs/etc/check_linux_hpssacli.conf.dist b/configs/etc/check_linux_hpssacli.conf.dist index d8f0f0a..95a5a07 100644 --- a/configs/etc/check_linux_hpssacli.conf.dist +++ b/configs/etc/check_linux_hpssacli.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # location of 'hpssacli' tool hpssacli_bin="/usr/sbin/hpssacli" diff --git a/configs/etc/check_linux_mysqld_status.conf.dist b/configs/etc/check_linux_mysqld_status.conf.dist index d023a13..99e03f2 100644 --- a/configs/etc/check_linux_mysqld_status.conf.dist +++ b/configs/etc/check_linux_mysqld_status.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # specify whether to perform table checks (mysqlcheck) # MySQL privileges required: SHOW DATABASES, SELECT (global or per database) diff --git a/configs/etc/check_linux_ntp_status.conf.dist b/configs/etc/check_linux_ntp_status.conf.dist index f6d33e7..947043c 100644 --- a/configs/etc/check_linux_ntp_status.conf.dist +++ b/configs/etc/check_linux_ntp_status.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # whether to force the use of chronyd? # [default: no] diff --git a/configs/etc/check_linux_process_limits.conf.dist b/configs/etc/check_linux_process_limits.conf.dist index 75e7aee..c0dc65c 100644 --- a/configs/etc/check_linux_process_limits.conf.dist +++ b/configs/etc/check_linux_process_limits.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="no" +log_healthy="yes" # -- user stanzas -- # supported limit checks: Max open files; Max processes diff --git a/configs/etc/check_linux_root_crontab.conf.dist b/configs/etc/check_linux_root_crontab.conf.dist index c54bb3e..24f3ac8 100644 --- a/configs/etc/check_linux_root_crontab.conf.dist +++ b/configs/etc/check_linux_root_crontab.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # list of commands (or strings) that should appear in active cron entries # Format: diff --git a/configs/etc/check_linux_sg_cluster_status.conf.dist b/configs/etc/check_linux_sg_cluster_status.conf.dist index 4f51da3..a79665e 100644 --- a/configs/etc/check_linux_sg_cluster_status.conf.dist +++ b/configs/etc/check_linux_sg_cluster_status.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # list of required cluster statuses # Format: diff --git a/configs/etc/check_linux_sg_package_status.conf.dist b/configs/etc/check_linux_sg_package_status.conf.dist index 8de6379..c449f8a 100644 --- a/configs/etc/check_linux_sg_package_status.conf.dist +++ b/configs/etc/check_linux_sg_package_status.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # list of required package statuses # Format: diff --git a/configs/etc/check_linux_vz_ct_counters.conf.dist b/configs/etc/check_linux_vz_ct_counters.conf.dist index bd3f2f0..ad9b0e1 100644 --- a/configs/etc/check_linux_vz_ct_counters.conf.dist +++ b/configs/etc/check_linux_vz_ct_counters.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # specify containers for which to check the UBC # Format: diff --git a/configs/etc/check_linux_vz_ct_status.conf.dist b/configs/etc/check_linux_vz_ct_status.conf.dist index 7ba951c..240e998 100644 --- a/configs/etc/check_linux_vz_ct_status.conf.dist +++ b/configs/etc/check_linux_vz_ct_status.conf.dist @@ -9,7 +9,7 @@ # specify whether to also log passed health checks # (warning: this may rapidly grow the HC log) # [default: no] -log_healthy="yes" +log_healthy="no" # specify properties as displayed by the 'vzlist -a -H -o ctid,status,onboot' command # Format: diff --git a/sources/lib/platform/linux/check_linux_burp_backup.sh b/sources/lib/platform/linux/check_linux_burp_backup.sh index 4e53a41..ac78cad 100644 --- a/sources/lib/platform/linux/check_linux_burp_backup.sh +++ b/sources/lib/platform/linux/check_linux_burp_backup.sh @@ -19,7 +19,8 @@ # @(#) MAIN: check_linux_burp_backup # DOES: see _show_usage() # EXPECTS: see _show_usage() -# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn() +# REQUIRES: data_comma2space(), data_is_numeric(), data_strip_outer_space(), +# init_hc(), log_hc(), warn() # GNU date that can calculate UNIX epoch seconds from given date, # BURP server must be be able to impersonate configured clients # @@ -97,7 +98,7 @@ esac # check for old-style configuration file (non-prefixed stanzas) _IS_OLD_STYLE=$(grep -c -E -e "^client:" ${_CONFIG_FILE} 2>/dev/null) -if (( _IS_OLD_STYLE > 0 )) +if (( _IS_OLD_STYLE == 0 )) then warn "no 'client:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?" return 1 @@ -119,15 +120,12 @@ fi # check for capable GNU date _GNU_DATE=$(date --date="1 day ago" '+%s' 2>/dev/null) -case "${_GNU_DATE}" in - +([0-9])*(.)*([0-9])) - # numeric, OK - ;; - *) - warn "no capable GNU date found here" - return 1 - ;; -esac +data_is_numeric "${_GNU_DATE}" +if (( $? > 0 )) +then + warn "no capable GNU date found here" + return 1 +fi # find burp _BURP_BIN="$(which burp 2>/dev/null)" @@ -246,12 +244,14 @@ do # first check client override _BURP_BACKUP_DIR=""; _BURP_CLIENTCONF_DIR="" _BURP_CLIENTCONF_DIR=$(_CONFIG_FILE="${_BURP_SERVER_CONFIG_FILE}" data_get_lvalue_from_config 'clientconfdir') + _BURP_CLIENTCONF_DIR=$(data_strip_outer_space "${_BURP_CLIENTCONF_DIR}") if [[ -n "${_BURP_CLIENTCONF_DIR}" ]] then _BURP_CLIENTCONF_FILE=${_BURP_CLIENTCONF_DIR}/${_BURP_CLIENT} if [[ -r ${_BURP_CLIENTCONF_FILE} ]] then _BURP_BACKUP_DIR=$(_CONFIG_FILE="${_BURP_CLIENTCONF_FILE}" data_get_lvalue_from_config 'directory') + _BURP_BACKUP_DIR=$(data_strip_outer_space "${_BURP_BACKUP_DIR}") else warn "no client configuration file for client ${_BURP_CLIENT}, trying server configuration next" fi @@ -260,6 +260,7 @@ do if [[ -z "${_BURP_BACKUP_DIR}" ]] then _BURP_BACKUP_DIR=$(_CONFIG_FILE="${_BURP_SERVER_CONFIG_FILE}" data_get_lvalue_from_config 'directory') + _BURP_BACKUP_DIR=$(data_strip_outer_space "${_BURP_BACKUP_DIR}") if [[ -z "${_BURP_BACKUP_DIR}" ]] then warn "could not determine backup directory from 'clientconfdir' or 'directory' directives' for client ${_BURP_CLIENT}" diff --git a/sources/lib/platform/linux/check_linux_file_age.sh b/sources/lib/platform/linux/check_linux_file_age.sh index 2c75c28..b411a6c 100644 --- a/sources/lib/platform/linux/check_linux_file_age.sh +++ b/sources/lib/platform/linux/check_linux_file_age.sh @@ -75,6 +75,7 @@ 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 @@ -87,7 +88,7 @@ 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 )) +if (( _IS_OLD_STYLE == 0 )) then warn "no 'file:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?" return 1 diff --git a/sources/lib/platform/linux/check_linux_file_change.sh b/sources/lib/platform/linux/check_linux_file_change.sh index 9d8e44b..cb23bbb 100644 --- a/sources/lib/platform/linux/check_linux_file_change.sh +++ b/sources/lib/platform/linux/check_linux_file_change.sh @@ -116,6 +116,7 @@ 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 diff --git a/sources/lib/platform/linux/check_linux_hpacucli.sh b/sources/lib/platform/linux/check_linux_hpacucli.sh index 06e1bbe..e9e9034 100644 --- a/sources/lib/platform/linux/check_linux_hpacucli.sh +++ b/sources/lib/platform/linux/check_linux_hpacucli.sh @@ -142,6 +142,7 @@ then log "switching setting 'do_acu_controller' to 1 to fetch slot info" _DO_ACU_CTRL=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 diff --git a/sources/lib/platform/linux/check_linux_hpasmcli.sh b/sources/lib/platform/linux/check_linux_hpasmcli.sh index c2b9272..cb620a4 100644 --- a/sources/lib/platform/linux/check_linux_hpasmcli.sh +++ b/sources/lib/platform/linux/check_linux_hpasmcli.sh @@ -149,6 +149,7 @@ case "${_DO_ASM_TEMP}" in _DO_ASM_TEMP=1 ;; esac +_CFG_HEALTHY=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'log_healthy') case "${_CFG_HEALTHY}" in yes|YES|Yes) _LOG_HEALTHY=1 diff --git a/sources/lib/platform/linux/check_linux_hplog.sh b/sources/lib/platform/linux/check_linux_hplog.sh index 7dfea05..54c04f0 100644 --- a/sources/lib/platform/linux/check_linux_hplog.sh +++ b/sources/lib/platform/linux/check_linux_hplog.sh @@ -105,6 +105,7 @@ else # delete last 'OR' _HPLOG_SEVERITIES=${_HPLOG_SEVERITIES%?} fi +_CFG_HEALTHY=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'log_healthy') case "${_CFG_HEALTHY}" in yes|YES|Yes) _LOG_HEALTHY=1 diff --git a/sources/lib/platform/linux/check_linux_hpssacli.sh b/sources/lib/platform/linux/check_linux_hpssacli.sh index 95425fc..c2391f6 100644 --- a/sources/lib/platform/linux/check_linux_hpssacli.sh +++ b/sources/lib/platform/linux/check_linux_hpssacli.sh @@ -142,6 +142,7 @@ then log "switching setting 'do_ssa_controller' to 1 to fetch slot info" _DO_SSA_CTRL=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 diff --git a/sources/lib/platform/linux/check_linux_root_crontab.sh b/sources/lib/platform/linux/check_linux_root_crontab.sh index 21740e3..e8f2313 100644 --- a/sources/lib/platform/linux/check_linux_root_crontab.sh +++ b/sources/lib/platform/linux/check_linux_root_crontab.sh @@ -71,6 +71,7 @@ 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 @@ -83,7 +84,7 @@ 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 )) +if (( _IS_OLD_STYLE == 0 )) then warn "no 'cron:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?" return 1 diff --git a/sources/lib/platform/linux/check_linux_sg_cluster_status.sh b/sources/lib/platform/linux/check_linux_sg_cluster_status.sh index 11d7d60..d3511fe 100644 --- a/sources/lib/platform/linux/check_linux_sg_cluster_status.sh +++ b/sources/lib/platform/linux/check_linux_sg_cluster_status.sh @@ -91,7 +91,7 @@ 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 )) +if (( _IS_OLD_STYLE == 0 )) then warn "no 'sg:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?" return 1 diff --git a/sources/lib/platform/linux/check_linux_sg_package_status.sh b/sources/lib/platform/linux/check_linux_sg_package_status.sh index c0b01d9..df9fa11 100644 --- a/sources/lib/platform/linux/check_linux_sg_package_status.sh +++ b/sources/lib/platform/linux/check_linux_sg_package_status.sh @@ -92,7 +92,7 @@ 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 )) +if (( _IS_OLD_STYLE == 0 )) then warn "no 'sg:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?" return 1