mirror of
https://github.com/shakemid/pcsensor-temper.git
synced 2025-01-21 09:08:17 +01:00
Add retry to munin plugin
This commit is contained in:
parent
255b016e94
commit
9291d90320
1 changed files with 17 additions and 1 deletions
|
@ -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}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue