@cryptotaxi247 / netdata-1 / commits / 5464b4894

script for collecting exim mail queue size

jsveiga committed Jun 2, 2016 at 14:38 UTC 5464b48948abdf1a68aff7c7be5e474a4b9c64cc
1 file changed +52
charts.d/exim.chart.sh new
+52
@@ -0,0 +1,52 @@
1 +#!/bin/sh
2 +
3 +exim_command=
4 +
5 +# how frequently to collect queue size
6 +exim_update_every=5
7 +
8 +exim_priority=60000
9 +
10 +exim_check() {
11 + if [ -z "$exim_command" -o ! -x "$exim_command" ]
12 + then
13 + local d=
14 + for d in /sbin /usr/sbin /usr/local/sbin
15 + do
16 + if [ -x "$d/exim" ]
17 + then
18 + exim_command="$d/exim"
19 + break
20 + fi
21 + done
22 + fi
23 +
24 + if [ -z "$exim_command" -o ! -x "$exim_command" ]
25 + then
26 + echo >&2 "$PROGRAM_NAME: exim: cannot find exim executable. Please set 'exim_command=/path/to/exim' in $confd/exim.conf"
27 + return 1
28 + fi
29 +
30 + if [ `$exim_command -bpc 2>&1 | grep -c denied` -ne 0 ]
31 + then
32 + echo >&2 "$PROGRAM_NAME: exim: permission denied. Please set 'queue_list_requires_admin = false' in your exim options file"
33 + return 1
34 + fi
35 +
36 + return 0
37 +}
38 +
39 +exim_create() {
40 +cat <<EOF
41 +CHART exim.qemails '' "Exim Queue Emails" "emails" queue exim.queued.emails line $((exim_priority + 1)) $exim_update_every
42 +DIMENSION emails '' absolute 1 1
43 +EOF
44 +return 0
45 +}
46 +
47 +exim_update() {
48 +echo "BEGIN exim.qemails $1"
49 +echo "SET emails = " `$exim_command -bpc`
50 +echo "END"
51 +return 0
52 +}