Saturday, September 25, 2010

How to combine Munin and TEMPer (USB Temperature Sensor) ?

Long long ago I always wrote about technical stuff in my computer experience.
It's about time to write something on that topic again and the story is about Munin (example) and TEMPer (USB Temperature Sensor).



I decided that I want to keep an eye on the room's temperature and I searched for the cheapest possible external (USB) Termal Sensor. That's how I get hands on one of these TEMPer termal sensors.
It turns out that the sensor is great for the job except it's installation under linux (Ubuntu) in my case.

So here are the steps for installing it under Ubuntu and adding a patched "sensors_" plugin for Munin.

First you need to install "temper_mon.pl"

1) sudo apt-get install libusb-dev
2) sudo cpan -fi ExtUtils::MakeMaker
3) sudo cpan -fi Inline::MakeMaker
4) sudo cpan -fi Device::USB
5) sudo cpan -fi Device::USB::PCSensor::HidTEMPer
6) wget -O temper_mon.pl http://www.svilen.com/temper_mon.pl.txt
(alternative: wget -O temper_mon.pl http://www.cs.unc.edu/~hays/dev/bash/temper/temper_mon.pl)

7) chmod a+x temper_mon.pl
8) run: sudo ./temper_mon.pl
(you should see temperature readings now)

9) sudo cp ./temper_mon.pl /usr/bin/
(this is needed for the Munin plugin)

10) sudo wget -O /etc/udev/rules.d/99-tempsensor.rules http://www.svilen.com/99-tempsensor.rules

or create file: /etc/udev/rules.d/99-tempsensor.rules
with this line inside:
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1130", ATTRS{idProduct}=="660c", MODE="666"

11) sudo /etc/init.d/udev restart

Now you should have fully running "temper_mon.pl" script which will give you readings from the USB Temper device.

Next step is to backup and replace Munin's "sensors_" plugin in /usr/share/munin/plugins

1) sudo mv /usr/share/munin/plugins/sensors_ /usr/share/munin/plugins/sensors_old
2) sudo wget -O /usr/share/munin/plugins/sensors_ http://www.svilen.com/sensors_.txt
3) service munin-node stop
4) service munin-node start

Now wait 5-10min and you should have reading in your Munin graphics.



Enjoy!

4 comments:

  1. Anonymous12:40 AM

    Thanks for this post, exactly what I was looking for. Ben

    ReplyDelete
  2. Thanks a lot - works perfectly. Ambiant temperature is a significant factor regarding in-case temperatures.

    ReplyDelete
  3. Great! I am glad my post was helpful to you.

    You can check my next one on this topic: http://blog.svilen.com/2011/11/how-to-combine-munin-and-temper-usb.html

    ReplyDelete