Hardware Linux Software

Munin + Raspberry Pi + temperature

Quick hack to get Munin to graph the cpu temperature.


First of all, install Munin and make sure it’s working.

Then follow these steps:

1) We’ll use cron to write the current temp to a log file. We do this because I wasn’t able to get Munin to directly execute the command (error: temp.value VCHI initialization failed)

Execute crontab -e and add this line (this has to be on one line):

*/5 * * * * /opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1 > /tmp/.temp

2) Go to /etc/munin/plugins/, and create a file temp, and add this content:

case $1 in
cat <<'EOM'
graph_category system
graph_title Temperature
graph_vlabel temp
temp.label Celsius
exit 0;;
echo -n "temp.value "
cat /tmp/.temp

Save and exit the editor.

I’m not sure this is needed, but better do it: chmod +x temp

3) restart munin-node (/etc/init.d/munin-node restart)

4) test if it’s working:

# telnet localhost 4949
Connected to localhost.
Escape character is '^]'.
# munin node at
fetch temp
temp.value 57.3

That’s it. Your munin daemon/host should now correctly graph the temperature.

Edit (8/2/2014): updated script can be found here.

3 replies on “Munin + Raspberry Pi + temperature”

Leave a Reply...

%d bloggers like this: