X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=charts.d%2Fexim.chart.sh;h=4c70f2c196328295a99c86bb7c0e0d4b995ef3f1;hb=32e8eda4c4d6370e96233a69cab861b2ebb5cc9a;hp=e436ce8f207d10fc3e3a09599c74e4023656b8a5;hpb=c3443ec92d76557b4d1413f1af0407ebb4e318ee;p=netdata.git diff --git a/charts.d/exim.chart.sh b/charts.d/exim.chart.sh index e436ce8f..4c70f2c1 100644 --- a/charts.d/exim.chart.sh +++ b/charts.d/exim.chart.sh @@ -1,5 +1,13 @@ -#!/bin/sh +# 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 +# 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 <