]> arthur.barton.de Git - netdata.git/blob - charts.d/exim.chart.sh
Merge pull request #2021 from ktsaou/master
[netdata.git] / charts.d / exim.chart.sh
1 # no need for shebang - this file is loaded from charts.d.plugin
2
3 # netdata
4 # real-time performance and health monitoring, done right!
5 # (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6 # GPL v3+
7 #
8 # Contributed by @jsveiga with PR #480
9
10 # the exim command to run
11 exim_command=
12
13 # how frequently to collect queue size
14 exim_update_every=5
15
16 exim_priority=60000
17
18 exim_check() {
19     if [ -z "${exim_command}" ]
20     then
21         require_cmd exim || return 1
22         exim_command="${EXIM_CMD}"
23     fi
24
25         if [ $(${exim_command} -bpc 2>&1 | grep -c denied) -ne 0 ]
26         then
27                 error "permission denied - please set 'queue_list_requires_admin = false' in your exim options file"
28                 return 1
29         fi
30
31         return 0
32 }
33
34 exim_create() {
35     cat <<EOF
36 CHART exim_local.qemails '' "Exim Queue Emails" "emails" queue exim.queued.emails line $((exim_priority + 1)) $exim_update_every
37 DIMENSION emails '' absolute 1 1
38 EOF
39     return 0
40 }
41
42 exim_update() {
43     echo "BEGIN exim_local.qemails $1"
44     echo "SET emails = " $(run ${exim_command} -bpc)
45     echo "END"
46     return 0
47 }