2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/rpi/rpi_temp
2013-12-06 21:03:39 +01:00

33 lines
679 B
Bash
Executable file

#! /bin/sh
# (c) 2013 - LGPL - Steve Schnepp <steve.schnepp@pwkf.org>
pluginfull="$0" # full name of plugin
plugin="${0##*/}" # name of plugin
pidfile="$MUNIN_PLUGSTATE/munin.$plugin.pid"
cache="$MUNIN_PLUGSTATE/munin.$plugin.value"
if [ ! -r "/sys/class/thermal/thermal_zone0/temp" ]
then
echo "# Cannot read CPU Temp"
exit 1
fi
if [ "$1" = "config" ]
then
cat <<EOF
graph_title CPU Temp
graph_category system
graph_vlabel C
thermal_zone0.label Current CPU Temp
EOF
exit 0
fi
# values
TEMP_MILLI_C=$(cat /sys/class/thermal/thermal_zone0/temp)
echo thermal_zone0.value $( echo "scale=3; $TEMP_MILLI_C / 1000" | bc )
exit 0