diff --git a/.gitignore b/.gitignore index a3a695e50e1a7b8b3dd84831c7ddf61bdada3a4e..b3322408e4f59d645cceadfe07eac5887d7331c2 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 0000000000000000000000000000000000000000..073a1b52df32333edd489e1365c3da2167d8d26e --- /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 + +# ----------------------------------------------------------------------