]> arthur.barton.de Git - netdata.git/blob - charts.d/exim.chart.sh
charts.d.plugin and tc-qos-helper.sh optimization to avoid frequent forks due to...
[netdata.git] / charts.d / exim.chart.sh
1 # no need for shebang - this file is loaded from charts.d.plugin
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_local.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_local.qemails $1"
49 echo "SET emails = " `$exim_command -bpc`
50 echo "END"
51 return 0
52 }