diff options
author | Lennart Weller <lhw@ring0.de> | 2017-01-24 15:21:09 +0000 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2017-01-24 15:21:09 +0000 |
commit | 3ed3b02ed96ddab1c084811f3579b3a2aec83e04 (patch) | |
tree | 7a61ab288ae47800c4f11be5677d6ad8288dcd98 /charts.d/exim.chart.sh | |
parent | New upstream version 1.4.0+dfsg (diff) | |
download | netdata-3ed3b02ed96ddab1c084811f3579b3a2aec83e04.tar.xz netdata-3ed3b02ed96ddab1c084811f3579b3a2aec83e04.zip |
New upstream version 1.5.0+dfsgupstream/1.5.0+dfsg
Diffstat (limited to 'charts.d/exim.chart.sh')
-rw-r--r-- | charts.d/exim.chart.sh | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/charts.d/exim.chart.sh b/charts.d/exim.chart.sh index c60ae9460..4c70f2c19 100644 --- a/charts.d/exim.chart.sh +++ b/charts.d/exim.chart.sh @@ -1,5 +1,13 @@ # no need for shebang - this file is loaded from charts.d.plugin +# netdata +# real-time performance and health monitoring, done right! +# (C) 2016 Costa Tsaousis <costa@tsaousis.gr> +# GPL v3+ +# +# Contributed by @jsveiga with PR #480 + +# the exim command to run exim_command= # how frequently to collect queue size @@ -8,28 +16,15 @@ exim_update_every=5 exim_priority=60000 exim_check() { - if [ -z "$exim_command" -o ! -x "$exim_command" ] - then - local d= - for d in /sbin /usr/sbin /usr/local/sbin - do - if [ -x "$d/exim" ] - then - exim_command="$d/exim" - break - fi - done - fi - - if [ -z "$exim_command" -o ! -x "$exim_command" ] - then - echo >&2 "$PROGRAM_NAME: exim: cannot find exim executable. Please set 'exim_command=/path/to/exim' in $confd/exim.conf" - return 1 - fi + if [ -z "${exim_command}" ] + then + require_cmd exim || return 1 + exim_command="${EXIM_CMD}" + fi - if [ `$exim_command -bpc 2>&1 | grep -c denied` -ne 0 ] + if [ $(${exim_command} -bpc 2>&1 | grep -c denied) -ne 0 ] then - echo >&2 "$PROGRAM_NAME: exim: permission denied. Please set 'queue_list_requires_admin = false' in your exim options file" + error "permission denied - please set 'queue_list_requires_admin = false' in your exim options file" return 1 fi @@ -37,16 +32,16 @@ exim_check() { } exim_create() { -cat <<EOF + cat <<EOF CHART exim_local.qemails '' "Exim Queue Emails" "emails" queue exim.queued.emails line $((exim_priority + 1)) $exim_update_every DIMENSION emails '' absolute 1 1 EOF -return 0 + return 0 } exim_update() { -echo "BEGIN exim_local.qemails $1" -echo "SET emails = " `$exim_command -bpc` -echo "END" -return 0 + echo "BEGIN exim_local.qemails $1" + echo "SET emails = " $(run ${exim_command} -bpc) + echo "END" + return 0 } |