Archive

Posts Tagged ‘thermometer’

Various Nagios plugins

October 15th, 2009 No comments

I’ve now written several Nagios plugins and submitted them all to MonitoringExchange.

Here’s a quick summary:

  • check_temper for monitoring the temperature with a TEMPer USB thermometer
  • check_kernel for checking that the currently running kernel on an RPM-based system is the most recent installed kernel (not necessarily the latest available kernel in the repository)
  • check_aql_balance for monitoring the number of SMS text message credits on your AQL account[1]
  • check_k8temp for monitoring the temperature of an AMD K8 (e.g. Athlon or Sempron) CPU

[1] See my blog post if you are interested in setting up SMS alerts with Nagios

Nagios plugin for TEMPer USB thermometer

October 12th, 2009 11 comments

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!

Update

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.

TEMPer USB thermometer on Linux

October 12th, 2009 3 comments

Some time ago I bought a cheap USB thermometer called TEMPer. I was disappointed to find that it didn’t work on Fedora. It would only work on Windows using a poor piece of proprietary software.

I eventually found the blog of Tollef Fog Heen, who had managed to get his TEMPer to work. Unfortunately his solution involved patching and compiling a kernel.

However since then, it seems his patch has been integrated into the stock Fedora kernel and it is now possible to read the temperature from it.

The TEMPer device appears to be a USB-serial adapter, with a serial I2C device at the end of it. It’s not straightforward to extract the temperature from it, but Tollef Fog Heen has written a simple C program to return the temperature.

His program polls the TEMPer every second and prints the temperature to the command line. It doesn’t stop until you kill the program. I made a couple of tweaks to the code so it prints the temperature once, formatted as a raw number with no extra text, and then quits. You can find my modified source here.

Disclaimer: I don’t know C. I haven’t changed any of the logic of the code, only the way it prints the output. If the code is buggy, it wasn’t me! ;)

Now I have an executable that returns the temperature from the TEMPer, I can think about building some application that could use this. How about a Nagios plugin?