pcsensor-temper/munin-plugin/temper

54 lines
772 B
Text
Raw Normal View History

2017-08-30 19:11:58 +09:00
#!/bin/bash
# -*- sh -*-
# Munin plugin for TEMPer
2017-08-31 09:41:26 +09:00
. "${MUNIN_LIBDIR}/plugins/plugin.sh"
set -o nounset
2017-08-30 19:11:58 +09:00
pcsensor=${pcsensor:-/usr/local/bin/pcsensor}
2017-08-31 09:41:26 +09:00
pcsensor_cmd="${pcsensor} -m -c"
2017-08-30 19:11:58 +09:00
# need calibration
2017-08-31 09:41:26 +09:00
# example:
# env.cdef temperature,1.0287,*,0.85,-
cdef=${cdef:-temperature}
2017-08-30 19:11:58 +09:00
autoconf() {
echo 'no'
}
config() {
cat <<EOF
graph_title Temperature
graph_category sensors
graph_scale no
graph_vlabel Temp C
graph_args --base 1000
temperature.label temperature
2017-08-31 09:41:26 +09:00
temperature.cdef ${cdef}
2017-08-30 19:11:58 +09:00
EOF
}
fetch() {
2017-08-31 09:41:26 +09:00
value=$( $pcsensor_cmd | sed -n '1p' )
2017-08-30 19:11:58 +09:00
echo "temperature.value ${value}"
}
# Main
case ${1:-} in
autoconf)
autoconf
;;
config)
config
[ "${MUNIN_CAP_DIRTYCONFIG:-}" = "1" ] && fetch
;;
*)
fetch
;;
esac
exit 0