Fix munin-plugin to configure cdef

This commit is contained in:
shakemid 2017-08-31 09:41:26 +09:00
parent 380f242cc1
commit 0cb7b00c2b

View file

@ -3,13 +3,17 @@
# Munin plugin for TEMPer # Munin plugin for TEMPer
. $MUNIN_LIBDIR/plugins/plugin.sh . "${MUNIN_LIBDIR}/plugins/plugin.sh"
set -o nounset
pcsensor=${pcsensor:-/usr/local/bin/pcsensor} pcsensor=${pcsensor:-/usr/local/bin/pcsensor}
pcsensor_opts="-m -c" pcsensor_cmd="${pcsensor} -m -c"
# need calibration # need calibration
cdef='temperature,1.0287,*,0.85,-' # example:
# env.cdef temperature,1.0287,*,0.85,-
cdef=${cdef:-temperature}
autoconf() { autoconf() {
echo 'no' echo 'no'
@ -24,13 +28,13 @@ graph_scale no
graph_vlabel Temp C graph_vlabel Temp C
graph_args --base 1000 graph_args --base 1000
temperature.label temperature temperature.label temperature
temperature.cdef $cdef temperature.cdef ${cdef}
EOF EOF
exit 0 exit 0
} }
fetch() { fetch() {
value=$( $pcsensor $pcsensor_opts | sed -n '1p' ) value=$( $pcsensor_cmd | sed -n '1p' )
echo "temperature.value ${value}" echo "temperature.value ${value}"
} }