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
cdc191dd51
commit
5beecd0fc0
1 changed files with 24 additions and 10 deletions
|
@ -45,10 +45,10 @@
|
|||
update no
|
||||
|
||||
temper.update no
|
||||
temper.graph_title TEMPer
|
||||
temper.graph_category sensor
|
||||
temper.graph_args --base 1000
|
||||
temper.graph_scale no
|
||||
temper.graph_title TEMPer
|
||||
temper.graph_vlabel Temp C
|
||||
|
||||
temper.graph_order \
|
||||
|
@ -63,6 +63,18 @@
|
|||
For more information about graph aggregation,
|
||||
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
|
||||
|
||||
K.Cima https://github.com/shakemid
|
||||
|
@ -92,7 +104,7 @@ device=${device:-0}
|
|||
# need calibration
|
||||
# example:
|
||||
# env.cdef temperature,1.0287,*,0.85,-
|
||||
cdef=${cdef:-temperature}
|
||||
cdef=${cdef:-}
|
||||
|
||||
retry=${retry:-1}
|
||||
|
||||
|
@ -113,26 +125,28 @@ EOF
|
|||
while read -r label
|
||||
do
|
||||
echo "${label}.label ${label}"
|
||||
echo "${label}.cdef ${cdef}"
|
||||
|
||||
if [ "$label" = 'humidity' ]; then
|
||||
echo "${label}.draw AREA"
|
||||
echo "graph_order humidity temperature"
|
||||
else
|
||||
echo "${label}.draw LINE"
|
||||
if [ -n "$cdef" ]; then
|
||||
echo "${label}.cdef ${cdef}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
fetch() {
|
||||
local i
|
||||
local i ret
|
||||
|
||||
i=0
|
||||
while [ "$i" -le "$retry" ];
|
||||
do
|
||||
"$pcsensor" | awk '$2 == '"$device"' { print $3".value", $4 }'
|
||||
|
||||
if [ "$?" -eq 0 ];then
|
||||
ret=$?
|
||||
if [ "$ret" -eq 0 ];then
|
||||
break
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue