From 21591d17a9fbaa2e2e5f275294489ae56e702c70 Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Wed, 2 Oct 2019 08:42:24 +0100 Subject: [PATCH] check_clamav_signatures: make warning thresholds configurable Signed-off-by: Adam D. Barratt --- dsa-nagios-checks/checks/check_clamav_signatures | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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. # -- 2.20.1