summaryrefslogtreecommitdiffstats
path: root/charts.d/postfix.chart.sh
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2017-01-24 15:21:09 +0000
committerLennart Weller <lhw@ring0.de>2017-01-24 15:21:09 +0000
commit3ed3b02ed96ddab1c084811f3579b3a2aec83e04 (patch)
tree7a61ab288ae47800c4f11be5677d6ad8288dcd98 /charts.d/postfix.chart.sh
parentNew upstream version 1.4.0+dfsg (diff)
downloadnetdata-3ed3b02ed96ddab1c084811f3579b3a2aec83e04.tar.xz
netdata-3ed3b02ed96ddab1c084811f3579b3a2aec83e04.zip
New upstream version 1.5.0+dfsgupstream/1.5.0+dfsg
Diffstat (limited to 'charts.d/postfix.chart.sh')
-rwxr-xr-xcharts.d/postfix.chart.sh26
1 files changed, 10 insertions, 16 deletions
diff --git a/charts.d/postfix.chart.sh b/charts.d/postfix.chart.sh
index 7f07a1868..85604fcbe 100755
--- a/charts.d/postfix.chart.sh
+++ b/charts.d/postfix.chart.sh
@@ -1,5 +1,11 @@
# 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+
+#
+
# the postqueue command
# if empty, it will use the one found in the system path
postfix_postqueue=
@@ -17,24 +23,12 @@ postfix_check() {
# try to find the postqueue executable
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
+ postfix_postqueue="$(which postqueue 2>/dev/null || command -v postqueue 2>/dev/null)"
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 +67,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