From: Adam D. Barratt Date: Wed, 2 Oct 2019 07:42:24 +0000 (+0100) Subject: check_clamav_signatures: make warning thresholds configurable X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=21591d17a9fbaa2e2e5f275294489ae56e702c70;hp=a71cc8fefde6347960f7e959395087f2840031a8;p=mirror%2Fdsa-nagios.git check_clamav_signatures: make warning thresholds configurable Signed-off-by: Adam D. Barratt --- diff --git a/dsa-nagios-checks/checks/check_clamav_signatures b/dsa-nagios-checks/checks/check_clamav_signatures index 26525d8..56c39d2 100755 --- a/dsa-nagios-checks/checks/check_clamav_signatures +++ b/dsa-nagios-checks/checks/check_clamav_signatures @@ -47,6 +47,8 @@ help() { Options: -p, --path path to ClamAV lib directory, if not $CLAM_LIB_DIR + -w, --warning number of revisions sigs can be out of date (warning) + -c, --critical number of revisions sigs can be out of date (critical) -V, --version output version -h, --help output help information @@ -65,6 +67,8 @@ while test $# -ne 0; do -p|--path) CLAM_LIB_DIR=$1; shift ;; -V|--version) version; exit ;; -h|--help) help; exit ;; + -w|--warning) WARN_THRESHOLD=$1; shift ;; + -c|--critical) CRIT_THRESHOLD=$1; shift ;; *) echo "UNKNOWN: Unrecognised argument: $ARG" usage >&2 @@ -73,6 +77,15 @@ while test $# -ne 0; do esac done +if ! [[ $WARN_THRESHOLD =~ $NUMERICAL_REGEX ]]; then + echo "UNKNOWN: Warning threshold must be numeric!" + exit $UNKNOWN +fi +if ! [[ $CRIT_THRESHOLD =~ $NUMERICAL_REGEX ]]; then + echo "UNKNOWN: Critical threshold must be numeric!" + exit $UNKNOWN +fi + # # Showtime. #