From cdc191dd51f2fc6b478a19189b28def4e40c3459 Mon Sep 17 00:00:00 2001 From: shakemid Date: Sun, 17 Sep 2017 23:25:08 +0900 Subject: [PATCH] Fix munin-plugin --- munin-plugin/temper | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/munin-plugin/temper b/munin-plugin/temper index bdeedde..74e7aef 100755 --- a/munin-plugin/temper +++ b/munin-plugin/temper @@ -81,6 +81,7 @@ . "${MUNIN_LIBDIR}/plugins/plugin.sh" set -o nounset +set -o pipefail # path to pcsensor pcsensor=${pcsensor:-/usr/local/bin/pcsensor} @@ -124,22 +125,20 @@ EOF } fetch() { - local value i + local i i=0 while [ "$i" -le "$retry" ]; do - value=$( "$pcsensor" | awk '$2 == '"$device"' { print $4 }' ) + "$pcsensor" | awk '$2 == '"$device"' { print $3".value", $4 }' - if [ -n "$value" ];then + if [ "$?" -eq 0 ];then break fi i=$(( i + 1 )) sleep 5 done - - echo "temperature.value ${value}" } # Main