Practice
Summer is a great season, but it brings a lot of problems if you have servers sitting in a regular office building (of course, all our production is out there on VPS/VDS). Since it's an ordinary Soviet-era building, it has issues with air conditioning and ventilation. In the best case that means a temperature of 27-30 degrees, and in the worst case the temperature in the server room can climb to 40-43 degrees, which is harmful to any hardware.
Just the noise of the server fans at that temperature is 4 times louder (and that groan spreads across the whole office), and the odds of them failing go up considerably. That's why we decided to take a drastic step: install an air conditioner and set up a temperature monitoring system (with alerts, graphs, integration with our services, and other nice extras).
We picked TEMPer as our simple sensor — here's what it looks like in our server room in real life:

We plugged it into a Debian server and tried collecting data using Perl scripts (which use Device::USB::PCSensor::HidTEMPer) and storing it in RRD. This approach turned out to be not very convenient, since we wanted something simpler and more universal. So we found a small driver at https://github.com/peterfarsinsen/pcsensor for working with this sensor, and tweaked it a bit so that it would return just a number (in Celsius), without any extra characters (so we could then send that same number to a stats collection service).
For collecting statistics, displaying graphs, and sending alerts, we picked the stathat.com service.
By writing a simple little script and dropping it into Cron, we got a nice graph and continuous temperature monitoring.
The script:
|
1
2
3
|
#!/bin/bash
TEMP=`pcsensor -c`
curl -d "key=KEY_FROM_STATHAT&ukey=UKEY_FROM_STATHAT&value=$TEMP" http://api.stathat.com/v
|
Where KEY_FROM_STATHAT and UKEY_FROM_STATHAT can be found in your admin panel.
Comments