mirror of
https://github.com/shakemid/pcsensor-temper.git
synced 2025-01-21 09:08:17 +01:00
Fix munin-plugin
This commit is contained in:
parent
04ebf0e6f4
commit
cdc191dd51
1 changed files with 4 additions and 5 deletions
|
@ -81,6 +81,7 @@
|
||||||
. "${MUNIN_LIBDIR}/plugins/plugin.sh"
|
. "${MUNIN_LIBDIR}/plugins/plugin.sh"
|
||||||
|
|
||||||
set -o nounset
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
# path to pcsensor
|
# path to pcsensor
|
||||||
pcsensor=${pcsensor:-/usr/local/bin/pcsensor}
|
pcsensor=${pcsensor:-/usr/local/bin/pcsensor}
|
||||||
|
@ -124,22 +125,20 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch() {
|
fetch() {
|
||||||
local value i
|
local i
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
while [ "$i" -le "$retry" ];
|
while [ "$i" -le "$retry" ];
|
||||||
do
|
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
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
i=$(( i + 1 ))
|
i=$(( i + 1 ))
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "temperature.value ${value}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main
|
# Main
|
||||||
|
|
Loading…
Add table
Reference in a new issue