Nagios plugin for TEMPer USB thermometer

As I said in a previous post, I finally got my TEMPer USB thermometer to work on Fedora, thanks to a patch by Tollef Fog Heen that has now been incorporated into the Fedora kernel.

I’m not familiar with C so I only made minor tweaks to Tollef Fog Heen’s code, which returns a temperature as a number. I wrote a wrapper in Perl that crudely interfaces this program to Nagios. In reality, I should wise up on my C a little and write the whole thing in C. When I do this, I’ll submit it to Monitoring Exchange.

For the time being, I’ll publish my Nagios plugin on this blog, in the hope that it might be useful to someone, despite being incredibly hacky.

First you’ll need the code for the program that reads the temperature from the TEMPer. Compile it like this:

g++ -o get_temper TEMPer2.c

Note that the path to the TEMPer device is hard-coded in the C If yours isn’t at /dev/ttyUSB0 then you’ll need to change the source before compiling.

Then download my Nagios plugin (check_temper), and put both the plugin and the program get_temper in your Nagios plugin directory. This is likely to be /usr/local/nagios/libexec if you built from source, and /usr/lib/nagios/plugins if you installed from RPM in the Fedora repository.

Now all you have to do is the usual Nagios magic for adding any other plugin. Simple!


Forget all that you’ve read above! I’ve now rewritten the entire plugin in C, so there is no need for the perl wrapper. You can download it from MonitoringExchange.

14 thoughts on “Nagios plugin for TEMPer USB thermometer

  1. @Mary Starr
    Hi Mary,
    Good to see this has had some interest already. I plan to rewrite the whole lot in C and parametrise to make it a much simpler integration with Nagios. (Currently you have to tweak some values, recompile, and add the perl module).

    As soon as I’ve done this I’ll definitely add it to Nagios Exchange, as well as Monitoring Exchange where I’ve already submitted a couple of plugins.



  2. Thank you for your post on this, Since first reading it I ordered two of the TEMPer usb units, I would like to have one going inside and if possible one outside. I am having a problem figuring the location of the usb sensor to pass to the check_temper plugin. as you mentioned your device was at /dev/ttyUSB0

    When I run lsusb here is some of the output

    [root@9850×4 ~]# lsusb

    Bus 001 Device 010: ID 1130:660c Tenx Technology, Inc.
    Bus 001 Device 009: ID 046d:0a13 Logitech, Inc.
    Bus 001 Device 002: ID 0424:2513 Standard Microsystems Corp.
    Bus 001 Device 003: ID 0424:2513 Standard Microsystems Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 004: ID 1532:0007 Razer USA, Ltd DeathAdder Mouse
    [root@9850×4 ~]#

    I know that “Bus 001 Device 010: ID 1130:660c Tenx Technology, Inc.” is the proper device.

    The nearest place that i can find where this USB TEMPer is being mountd is /dev/bus/usb/001/010 . How did you get it to appear on /dev/ttyUSB0. Am i missing a step to mount the device? I am running on Fedora 12, have tried on ubuntu 9.10 as well.

    passing /dev/bus/usb/001 as the device defintly doesnt work as this is the output i get.
    [root@9850×4 Downloads]# ./check_temper /dev/bus/usb/001/010 40 55
    ioctl: Inappropriate ioctl for device


  3. Hi Joseph,

    It looks like you’ve got a newer version of TEMPer device. This page is about the older kind which simply appears as a USB serial device. The newer ones work in a different way. I have one of each. I’ve sort of managed to get the newer one to work but it’s not as easy as the older ones.

    I’ll post my code on this blog in the next day or two. Hopefully you’ll be able to get yours working.



  4. I’ve just picked up a new model TEMPer device too and getting similar ioctl errors too. Will wait with baited breath as to your thoughts on this. 🙂


  5. Oh, I’d totally forgotten I was going to post some code. Thanks for reminding me. This isn’t my code, but I’ve forgotten where it came from 😦

    Download here.


    1. You have to run the code as root, otherwise it returns an error. For this reason it’s not great for Nagios integration.

      I also found that my thermometer reported wildly inaccurate figures. I’ve been a bit busy and sort of given up on the project for a while, but I mean to place the old first-generation TEMPer alongside the new TEMPer and compare their readings. It’s easy to work what the offset and error factor is, and then that can be incorporated into the code. (Assuming it’s a linear error).

      Perhaps you could let me know if you find your TEMPer to be inaccurate too?


      1. This code is from and the problem with being root can be solved with udev-Rules (give 666 Permissions, if device is plugged in). The file is in the tar.gz.

        I have the problem, that my lsusb shows ID 0c45:7401 Microdia and I often get a “broken pipe” error, even if I edit the C code to the given USB ID.
        One time I got it working, Nagios+PNP4Nagios catched the temp (so I got a really nice graph in the monitoring incl. notification, etc.). But it was not reliable.

        There is a way to sniff the USB communication, perhaps they changed something.


    1. Hi Martin. I’m afraid I haven’t spent any time on TEMPer since I wrote this post. I hope I’ll be able to get round to it soon…


  6. @Martin
    Hello guys,
    recently i purchased new version TEMPer. I have to use that new code btu temperature is little bit inaccurate (about 3-4 °C) and also i cat redirect output of the program to some file (i’d like to grep only temperature and transfer it to graph on website ideally.


  7. Hello guys,

    there ist just a simple trick to get the nagios plugin working!
    I implement the script as follows:
    -do the steps as Jonathan wrote above in the first lines
    -create a cronjob as root, whos do the following command:
    * * * * * /opt/scripts/temper/temper > /tmp/temper.txt
    please edit the path to the temper binary
    so the script runs every minute and write the temperature to the txt-file
    -now edit the check_temper in the nagios plugins dir and change the following line:
    my $temper = ‘/usr/lib/nagios/plugins/get_temper’;
    my $temper = ‘cat /tmp/temper.txt’;
    -test the nagios plugin as writen in the get_temper head, if it works, implement it in the
    host.cfg’s 🙂

    ‘ve fun!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: