Add retry to munin plugin

This commit is contained in:
shakemid 2017-09-01 17:21:35 +09:00
parent 255b016e94
commit 9291d90320

View file

@ -15,6 +15,8 @@ pcsensor_cmd="${pcsensor} -m -c"
# env.cdef temperature,1.0287,*,0.85,-
cdef=${cdef:-temperature}
retry=${retry:-1}
autoconf() {
echo 'no'
}
@ -32,7 +34,21 @@ EOF
}
fetch() {
local value i
i=0
while [ "$i" -le "$retry" ];
do
value=$( $pcsensor_cmd | sed -n '1p' )
if [ -n "$value" ];then
break
fi
i=$(( i + 1 ))
sleep 5
done
echo "temperature.value ${value}"
}