check_clamav_signatures: make warning thresholds configurable
authorAdam D. Barratt <adam@adam-barratt.org.uk>
Wed, 2 Oct 2019 07:42:24 +0000 (08:42 +0100)
committerAdam D. Barratt <adam@adam-barratt.org.uk>
Mon, 7 Oct 2019 18:04:38 +0000 (19:04 +0100)
Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
dsa-nagios-checks/checks/check_clamav_signatures

index 26525d8..56c39d2 100755 (executable)
@@ -47,6 +47,8 @@ help() {
 
   Options:
     -p, --path <path>           path to ClamAV lib directory, if not $CLAM_LIB_DIR
+    -w, --warning <number>      number of revisions sigs can be out of date (warning)
+    -c, --critical <number>     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.
 #