summaryrefslogtreecommitdiffstats
path: root/charts.d/postfix.chart.sh
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-10-20 22:04:28 +0300
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-10-20 22:04:28 +0300
commitaddb52bb18ba356fc1cb5888b1fe5b809137346d (patch)
tree61f3294473d70f9f96e2e302837ff844a70e3207 /charts.d/postfix.chart.sh
parentc6d3138cc7ddb21bac33df2fc9f16c6e76ff1426 (diff)
better log management for charts.d.plugin - fixes #1144
Diffstat (limited to 'charts.d/postfix.chart.sh')
-rwxr-xr-xcharts.d/postfix.chart.sh18
1 files changed, 3 insertions, 15 deletions
diff --git a/charts.d/postfix.chart.sh b/charts.d/postfix.chart.sh
index 7f07a18682..3a93357947 100755
--- a/charts.d/postfix.chart.sh
+++ b/charts.d/postfix.chart.sh
@@ -18,23 +18,11 @@ postfix_check() {
if [ -z "$postfix_postqueue" -o ! -x "$postfix_postqueue" ]
then
postfix_postqueue="`which postqueue 2>/dev/null`"
- if [ -z "$postfix_postqueue" -o ! -x "$postfix_postqueue" ]
- then
- local d=
- for d in /sbin /usr/sbin /usr/local/sbin
- do
- if [ -x "$d/postqueue" ]
- then
- postfix_postqueue="$d/postqueue"
- break
- fi
- done
- fi
fi
if [ -z "$postfix_postqueue" -o ! -x "$postfix_postqueue" ]
then
- echo >&2 "$PROGRAM_NAME: postfix: cannot find postqueue. Please set 'postfix_postqueue=/path/to/postqueue' in $confd/postfix.conf"
+ error "cannot find postqueue. Please set 'postfix_postqueue=/path/to/postqueue' in $confd/postfix.conf"
return 1
fi
@@ -73,10 +61,10 @@ postfix_update() {
postfix_q_emails=0
postfix_q_size=0
- eval "`$postfix_postqueue -p |\
+ eval "$(run $postfix_postqueue -p |\
grep "^--" |\
sed -e "s/-- \([0-9]\+\) Kbytes in \([0-9]\+\) Requests.$/local postfix_q_size=\1\nlocal postfix_q_emails=\2/g" |\
- egrep "^local postfix_q_(emails|size)=[0-9]+$"`"
+ egrep "^local postfix_q_(emails|size)=[0-9]+$")"
# write the result of the work.
cat <<VALUESEOF