equal
deleted
inserted
replaced
1 #! /bin/bash |
|
2 PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin |
|
3 EXIM=$(command -v exim4 || command -v exim) |
|
4 |
|
5 smtp_accept_max=$(set -- $($EXIM -bP smtp_accept_max); echo $3) |
|
6 warn=$((smtp_accept_max * 7 / 10)) |
|
7 crit=$smtp_accept_max |
|
8 |
|
9 tmp=$(getopt -n $0 -o w:c: -- "$@") |
|
10 eval set -- $tmp |
|
11 |
|
12 while : |
|
13 do |
|
14 opt="$1"; shift |
|
15 case "$opt" in |
|
16 -w) warn="$1"; shift;; |
|
17 -c) crit="$1"; shift;; |
|
18 --) break;; |
|
19 esac |
|
20 done |
|
21 |
|
22 r=$(($(exiwhat | wc -l) -1 )) |
|
23 p="connections=$r;$warn;$crit" |
|
24 |
|
25 |
|
26 test $r -gt $crit && { echo "CRIT ($r connections)|$p"; exit 2; } |
|
27 test $r -gt $warn && { echo "WARN ($r connections)|$p"; exit 1; } |
|
28 echo "OK ($r connections)|$p" |
|
29 exit 0 |
|