From 64b37f63972435b8707960c5370653667658c6f1 Mon Sep 17 00:00:00 2001 From: Andrea Gottsponer <ago@attr.ch> Date: Fri, 21 Oct 2022 12:27:23 +0200 Subject: [PATCH] - add mailq check --- .gitignore | 1 + check_mailq | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 check_mailq diff --git a/.gitignore b/.gitignore index a3a695e..b332240 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea check_smart.pl paramtest check_snmp_syno.sh diff --git a/check_mailq b/check_mailq new file mode 100755 index 0000000..073a1b5 --- /dev/null +++ b/check_mailq @@ -0,0 +1,53 @@ +#!/bin/bash +# ====================================================================== +# +# Check mailq size +# +# requirements: +# - mailq +# +# ---------------------------------------------------------------------- +# 2022-10-21 v1.0 <andrea.gottsponer@unibe.ch> +# ====================================================================== + + +. `dirname $0`/inc_pluginfunctions + +# ---------------------------------------------------------------------- +# MAIN +# ---------------------------------------------------------------------- + +# --- check required tools +ph.require mailq + +# --- check param -h +if [ "$1" = "-h" ]; then + echo " + usage: $0 [ -w value -c value -h ] + + -w Warning level + -c Critical level + -h this help + " + exit 0 +fi + +# set default / override from command line params +typeset -i iWarnLimit=` ph.getValueWithParam 5 w "$@"` +typeset -i iCriticalLimit=` ph.getValueWithParam 20 c "$@"` + +# get mailq count +iMailqCount=`mailq | grep -c "^[A-F0-9]"` + +ph.setStatusByLimit ${iMailqCount} ${iWarnLimit} ${iCriticalLimit} + +# --- status output +ph.status "${iMailqCount} Queue Count" + +# --- performance data usage +ph.perfadd "mailq" "${iMailqCount}" $iWarnLimit $iCriticalLimit 0 + +# --- Bye +ph.exit + +# ---------------------------------------------------------------------- -- GitLab