mirror of
https://github.com/shakemid/pcsensor-temper.git
synced 2025-01-21 09:08:17 +01:00
Fix munin-plugin to support TEMPerHUM
This commit is contained in:
parent
503dd1132e
commit
c9357827d5
1 changed files with 20 additions and 4 deletions
|
@ -7,8 +7,12 @@
|
||||||
|
|
||||||
set -o nounset
|
set -o nounset
|
||||||
|
|
||||||
|
# path to pcsensor
|
||||||
pcsensor=${pcsensor:-/usr/local/bin/pcsensor}
|
pcsensor=${pcsensor:-/usr/local/bin/pcsensor}
|
||||||
|
|
||||||
|
# device number
|
||||||
|
device=${device:-0}
|
||||||
|
|
||||||
# need calibration
|
# need calibration
|
||||||
# example:
|
# example:
|
||||||
# env.cdef temperature,1.0287,*,0.85,-
|
# env.cdef temperature,1.0287,*,0.85,-
|
||||||
|
@ -22,14 +26,26 @@ autoconf() {
|
||||||
|
|
||||||
config() {
|
config() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
graph_title Temperature
|
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
|
||||||
temperature.label temperature
|
|
||||||
temperature.cdef ${cdef}
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
"$pcsensor" | awk '$2 == '"$device"' { print $3 }' |
|
||||||
|
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"
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch() {
|
fetch() {
|
||||||
|
@ -38,7 +54,7 @@ fetch() {
|
||||||
i=0
|
i=0
|
||||||
while [ "$i" -le "$retry" ];
|
while [ "$i" -le "$retry" ];
|
||||||
do
|
do
|
||||||
value=$( $pcsensor | sed -n '1p' | awk '{ print $4 }' )
|
value=$( "$pcsensor" | awk '$2 == '"$device"' { print $4 }' )
|
||||||
|
|
||||||
if [ -n "$value" ];then
|
if [ -n "$value" ];then
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Reference in a new issue