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
|
@ -10,7 +10,7 @@
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
Install pcsensor command:
|
Install pcsensor command:
|
||||||
git clone https://github.com/shakemid/pcsensor-temper
|
git clone https://github.com/shakemid/pcsensor-temper
|
||||||
cd pcsensor-temper
|
cd pcsensor-temper
|
||||||
make
|
make
|
||||||
cp pcsensor /usr/local/bin/
|
cp pcsensor /usr/local/bin/
|
||||||
|
@ -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 \
|
||||||
|
@ -60,9 +60,21 @@
|
||||||
temper.temperature_2.cdef temperature_2,0.97,*,1.22,-
|
temper.temperature_2.cdef temperature_2,0.97,*,1.22,-
|
||||||
temper.temperature_3.cdef temperature_3,0.93,*,0.55,-
|
temper.temperature_3.cdef temperature_3,0.93,*,0.55,-
|
||||||
|
|
||||||
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}
|
||||||
|
|
||||||
|
@ -106,33 +118,35 @@ graph_title TEMPer
|
||||||
graph_category sensors
|
graph_category sensors
|
||||||
graph_scale no
|
graph_scale no
|
||||||
graph_vlabel Temp C
|
graph_vlabel Temp C
|
||||||
graph_args --base 1000
|
graph_args --base 1000
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
"$pcsensor" | awk '$2 == '"$device"' { print $3 }' |
|
"$pcsensor" | awk '$2 == '"$device"' { print $3 }' |
|
||||||
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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue