Temperature monitoring and alerting on a small budget – sounds good, right?
In our small office, we have four servers, switches, a telephone system, and several UPS units in a small wiring closet. I need to make sure that I know if the closet starts to overheat, but most environmental monitoring systems are targeting the bigger datacenter market.
My first ray of hope was discovering the USB Thermometer from PCsensor.com. I got it on eBay for $17, and you can now get it directly from PCsensor.com or on eBay for between $10 and $15 with shipping.
Read more after the jump…
What We Need…
What we need is a way to create a service that is continually checking the USB Thermometer, recording the temperature in some way, and that will page me if the temperature goes past a set limit. The instructions that follow worked for me on a Windows Server 2008 box. But nothing here is tied to Server 2008.
The software that comes with the device seemed a bit buggy — it would crash every once in a while. But it turns out that several people out on the interwebs have discovered this device and are coding for it. I’m using the UTAC executable from www.alsgh.com/utac/. You need to install the driver from the mini-CD that comes with the device, and then you can use UTAC to read the temp, graph it, and set up alerting. I think I plugged in the device, told it to find the drivers on the CD, and then successfully ran UTAC and got a temp reading.
To set up the alerting, I configured UTAC to email the SMS gateway of my cellular carrier, Sprint. If you didn’t know, every carrier has one of these gateways. Any email-enabled system can page a Sprint phone by emailing the phone number @messaging.sprintpcs.com.
You can look up the email address formats for other carriers here.
Of course, you’ll need to tell UTAC what SMTP server to send through. I’m using the SMTP service that’s built into any Windows server. If you need a quick tutorial on how to set that up, let me know.
I also told UTAC to log the temp to a file. This gives you a nice history, and I use it with MRTG to get historical graphs (more below). You’ll want to change the default checking frequency to something longer than the default of 30 seconds for two reasons: your log file is going to grow pretty fast, and you’ll get a page every 30 seconds if the temp goes over the limit. With the slight delay that the email and SMS gateways introduce, you could end up with a dozen pages coming at once. Believe me — that wasn’t fun!
Run as a Service
UTAC is a user-level program. You don’t want to have to keep a user logged onto your server. There are several free ways to run a program as a service, but I recommend shelling out $50 for FireDaemon Pro. You just install FireDaemon, tell it you want to define a new service, and point it at utac.exe. From then on, FireDaemon will make sure to keep UTAC running, and will start it up when the server starts up.
This is all you need to have continuous temperature monitoring and alerting for your data closet. However, if you want some cool historical graphs, keep reading…
UTAC has built-in graphing, but it doesn’t seem to work when you run UTAC as a service with FireDaemon. MRTG can fill in this gap. The Multi Router Traffic Grapher is a relatively simple way to get graphs of network interface usage. However, you can use it to graph anything, if you write a script that returns numerical values to MRTG. MRTG, once set up, outputs html pages that contain daily, weekly, monthly, and yearly graphs.
Here are the basic steps to getting MRTG going with the USB thermometer:
- Install perl (free download from ActiveState.com)
- Download and unzip mrtg
- Configure the mrtg.cfg file according to my example in this download
- Install the Server 2003 Resource Kit to get the tail command (you can install the resource kit on a client machine and just copy tail.exe to the server’s c:\windows folder)
- Configure FireDaemon to run MRTG (my FireDaemon config has Executable = C:\Perl\bin\perl.exe, Working Directory = C:\scripts\mrtg\bin, Parameters = mrtg mrtg.cfg)
- If you want to serve up the graphs via a web server, configure an IIS site that corresponds to the working directory that you specified in the MRTG config file
That’s it! It’s more steps than I realized, now that I’ve written them all out. But the only parts that cost anything are the $15 thermometer and $50 for FireDaemon.
Let me know if you have any questions about this.