The Artima Developer Community
Sponsored Link

Python Buzz Forum
Graphing Raspberry Pi internal temperature with collectd

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Aaron Brady

Posts: 576
Nickname: insommeuk
Registered: Aug, 2003

Aaron Brady is lead developer for Crestsource
Graphing Raspberry Pi internal temperature with collectd Posted: Jul 2, 2013 7:19 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Aaron Brady.
Original Post: Graphing Raspberry Pi internal temperature with collectd
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
Latest Python Buzz Posts
Latest Python Buzz Posts by Aaron Brady
Latest Posts From insom.me.uk

Advertisement

I’m a big fan of collectd, the pluggable metrics collection daemon, and I came across this post about checking the temperature, so I decided to get collectd up and running on my Pi and pull some graphs out to see if there are any trends.

Previous related posts:

Installation

Because collectd defaults to a 10 second quantum, it will either keep my USB disk drive awake the whole time or wear out my SD card. One option would be to use the ‘network‘ plugin for collectd and ship the readings off to a bigger machine, but in the interests of being self contained, I’ll use a tmpfs filesystem (which is basically a RAM disk).

sudo apt-get install collectd-core
sudo mount -t tmpfs tmpfs /var/lib/collectd/

It won’t start because it’s missing a configuration, so lets put a basic one together, in /etc/collectd/collectd.conf:

LoadPlugin "logfile"
LoadPlugin "rrdtool"

LoadPlugin "interface"
<Plugin "interface">
  Interface "/(veth.*|lo|br)/"
  IgnoreSelected true
</Plugin>

#LoadPlugin "thermal"
#<Plugin "thermal">
#  Device "thermal_zone0"
#  IgnoreSelected false
#</Plugin>

LoadPlugin "table"
<Plugin table>
  <Table "/sys/class/thermal/thermal_zone0/temp">
    Instance thermal
    Separator " "
    <Result>
      Type gauge
      InstancePrefix "pi"
      ValuesFrom 0
    </Result>
  </Table>
</Plugin>

You can see a commented out section referencing the thermal plugin- unfortunately this was broken in the version of collectd that is currently in Raspian Wheezy. The fix is in this commit, but I didn’t really want to build collect from source, for instead I’m using the table plugin, and cheating by omitting the PrefixFrom parameter.

Start collectd with sudo /etc/init.d/collectd start and within a few seconds you should see files start to appear in /var/lib/collectd/<your hostname>/table-thermal/. If you don’t have a collectd graphing utility, you can generate one using rrdtool. (I use my own dashboard that I wrote at work usually, but it’s not been updated for collectd 5.1, as Ubuntu still ships 4.10 in their LTS releases).

An example rrdtool incantation, and the graph to go with it:

rrdtool graph ~/temperature.png -s -4hour -w 500 -h 100 \
--lower-limit 0 --alt-autoscale-max --slope-mode \
'DEF:o=/var/lib/collectd/pi/table-thermal/gauge-pi.rrd:value:MAX' \
'CDEF:oo=o,1000,/' 'AREA:oo#ffcc00'

A temperature graph from my Raspberry Pi

Read: Graphing Raspberry Pi internal temperature with collectd

Topic: Expressing Oneself, Fluently Previous Topic   Next Topic Topic: Memento Mori

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use