Fix munin-plugin

This commit is contained in:
shakemid 2017-09-22 09:44:57 +09:00
parent cdc191dd51
commit 5beecd0fc0

View file

@ -45,10 +45,10 @@
update no update no
temper.update no temper.update no
temper.graph_title TEMPer
temper.graph_category sensor temper.graph_category sensor
temper.graph_args --base 1000 temper.graph_args --base 1000
temper.graph_scale no temper.graph_scale no
temper.graph_title TEMPer
temper.graph_vlabel Temp C temper.graph_vlabel Temp C
temper.graph_order \ temper.graph_order \
@ -63,6 +63,18 @@
For more information about graph aggregation, For more information about graph aggregation,
see http://guide.munin-monitoring.org/en/latest/example/graph/aggregate.html see http://guide.munin-monitoring.org/en/latest/example/graph/aggregate.html
=head1 MEMO
Device types:
0c45:7401 with 1 sensor
temperature
0c45:7401 with 2 sensors
internal, external
0c45:7402
temperature, humidity
=head1 AUTHOR =head1 AUTHOR
K.Cima https://github.com/shakemid K.Cima https://github.com/shakemid
@ -92,7 +104,7 @@ device=${device:-0}
# need calibration # need calibration
# example: # example:
# env.cdef temperature,1.0287,*,0.85,- # env.cdef temperature,1.0287,*,0.85,-
cdef=${cdef:-temperature} cdef=${cdef:-}
retry=${retry:-1} retry=${retry:-1}
@ -113,26 +125,28 @@ EOF
while read -r label while read -r label
do do
echo "${label}.label ${label}" echo "${label}.label ${label}"
echo "${label}.cdef ${cdef}"
if [ "$label" = 'humidity' ]; then if [ "$label" = 'humidity' ]; then
echo "${label}.draw AREA" echo "${label}.draw AREA"
echo "graph_order humidity temperature" echo "graph_order humidity temperature"
else else
echo "${label}.draw LINE" echo "${label}.draw LINE"
if [ -n "$cdef" ]; then
echo "${label}.cdef ${cdef}"
fi
fi fi
done done
} }
fetch() { fetch() {
local i local i ret
i=0 i=0
while [ "$i" -le "$retry" ]; while [ "$i" -le "$retry" ];
do do
"$pcsensor" | awk '$2 == '"$device"' { print $3".value", $4 }' "$pcsensor" | awk '$2 == '"$device"' { print $3".value", $4 }'
ret=$?
if [ "$?" -eq 0 ];then if [ "$ret" -eq 0 ];then
break break
fi fi