[ale] [OT] how do I monitor the "weather" in my computer room

Alex Carver agcarver+ale at acarver.net
Thu Jun 6 15:44:29 EDT 2013


If air balancing is your big issues you should probably invest in a 
thermostatic duct booster fan.  You keep the vent closed down a bit for 
normal comfort.  If the room starts to get warm, the booster turns on 
and forces more air into the room.  Once the room cools, the booster 
turns off.

http://www.homedepot.com/p/Cyclone-Booster-Fan-Plus-with-Built-in-Thermostat-in-White-CM300W/203582700


As for parsing, that's what 
gawk/grep/Perl/PHP/YourFavoriteScriptingLanguage is for.  Put your 
commands into a script, pipe each command output through one of the 
parsers and save to file.

Here's a very brute force freebie for your first one which will format 
the result as a single HTML table cell on its own row containing just 
the line of data for "temp1" and the date (the table itself being 
created elsewhere first).  No other processing is done, just a capture 
and dump.

#!/bin/bash
echo '<TABLE>' > /tmp/htmloutputcpu
printf "<TR><TD>%s" `date` >> /tmp/htmloutputcpu
printf "%s</TD><TR>\n" `sensors | grep 'temp1'` >> /tmp/htmloutputcpu
echo '</TABLE>' >> /tmp/htmloutputcpu


Adding extra sensors is left as an exercise to the reader.
Of course you can get more complex with the scripting (or change 
languages) by parsing the lines internally to provide more pleasing 
outputs but that's the absolute barebones basic.


Sending an email with all the data in the subject line means you must 
make a bigger script to parse all the data, condense it into a very 
compact representation and then call upon your MTA to send out an email. 
  The subject line is very limited in space so you can't put a lot of 
text in it.  Better to just send the data in the body and look at the 
email unless you want cryptic subjects like "C 42.5 V 75 H 26" to fit 
into subject line space limitations.

You can set up sudo to not ask for a password on specific commands.  You 
could allow hddtemp to be that way and then be able to script it with no 
issues.

There are many lightweight HTTP servers, pick your poison:
http://en.wikipedia.org/wiki/Comparison_of_lightweight_web_servers


On 6/6/2013 11:24, Ron Frazier (ALE) wrote:
> Hi David and all,
>
> I appreciate all the replies to my "weather" monitoring question.  You
> guys have brought up some interesting points and pointed out some
> interesting hardware.  I've read all the posts but haven't had a chance
> to reply to all.  I chose this one to reply to since this represents one
> of the most interesting inexpensive alternatives.
>
> As to why I want to measure the temperature of the room, it's just a
> quick and simple technique which is a proxy for the pc temperature.  I
> check the machine every day or two anyway, so I know if the fans are
> running or if they're whining, etc.  I also know that if the ambient is
> within a certain range, then the temperatures of the pc's components are
> likely to be within their normal range too.  The other reason to do that
> is that there is no thermostat in that room.  I have to juggle the
> opening of the hvac intake and supply vents to sort of balance the
> temperature in that room with the rest of the house.  Thus, if the
> ambient gets too high, I have to open the vents a bit wider.  If it gets
> too cold (wasting energy), I have to close them a bit.
>
> The sensor device described in the article mentioned article measures
> temperature.  I also found this one, which appears to be from the same
> manufacturer, which also measures humidity.
>
> http://www.chinavasion.com/china/wholesale/Electronic_Gadgets/Cool_Gadgets/USB_Hygrometer_Thermometer-Server_Room_Temperature_Monitor
>
>
> Some other very good sensors have been mentioned.  I really had to stick
> to a limited budget for this purpose.  The quickest and relatively cheap
> option for me was to add an additional sensor to my Oregon Scientific
> weather station which I already had.  This unit already has multi
> channel capability, so the radio signals don't conflict.  I only have to
> push a button on its display panel to get the basement room temperature
> and humidity.  This solution cost me $ 33.  This sensor is relatively
> good quality and can link to many Oregon Scientific products.
>
> http://www.amazon.com/dp/B000WOG90E/ref=pe_309540_26725410_item
>
> I started thinking about your comment about measuring the temperatures
> in the pc.  That obviously would have value since I could potentially do
> all sorts of neat things with the data including remotely monitoring it,
> putting it in a database, graphing it, etc. if I wanted to go to the
> trouble.
>
> Then the thought hit me, WELL DUH!, the pc already has sensors in it! In
> fact, I have a widget on my Gnome panel showing the cpu temp and the hdd
> temps.  So, I started thinking about how to extract this data.  This
> machine is running mint.  As it turns out, I can capture temps on the
> cpu, hdd's, and gpu's all from command line utilities as follows.
> Lm-sensors is running, which gives some of these capabilities.
>
> ron at Bugs01 ~ $ sensors
> k10temp-pci-00c3
> Adapter: PCI adapter
> temp1:        +42.5°C  (high = +70.0°C)
>
> As far as I know, this is the cpu temperature.
>
> ron at Bugs01 ~ $ hddtemp /dev/sda
> /dev/sda: open: Permission denied
>
> Woops.  Gotta use sudo with this one.  That may make it hard to run an
> automated script.
>
> ron at Bugs01 ~ $ sudo hddtemp /dev/sda
> [sudo] password for ron:
> /dev/sda: ST9320320AS: 26°C
>
> This is the temperature for that hard drive.  I'm not sure if lm-sensors
> is driving this or something else.
>
> ron at Bugs01 ~ $ aticonfig --adapter=1 --odgt
>
> Adapter 1 - AMD Radeon HD 6700 Series
>              Sensor 0: Temperature - 75.00 C
>
> The ATI video driver provides this utility as far as I know.
>
> So, I can run command line utilities for each critical temperature and
> get a sort of free form text output.  This brings up more questions.
> CAVEAT: I may not have the time to go to the trouble to implement this.
> But, it's still neat to learn what options are available.
>
> 1) How can I parse the relevant data for each, title and temp in a
> structured format, and email it to myself with the data in the subject
> line?
>
> 2) How can I parse the relevant data and put in into a simple web page
> as follows?  I haven't written raw html in years, so forgive me if there
> are errors.  I'm changing the begin and end tags for this example so
> this doesn't screw up email readers.  The data could be put into a
> table, but I don't remember how to write that code by hand.  One problem
> is that each command line utility outputs the answer in a different
> format.  This page would be updated every few minutes.
>
> *-html*
>
> *-head*
> *-title*
> Bugs01 PC - Temperature readings - 2013-06-06 - 02:03 PM
> *title-*
> *head-*
>
> *-body*
> Bugs01 PC - Temperature readings - 2013-06-06 - 02:03 PM*p*
> *p*
> CPU: 42.5°C*p*
> HDD1: /dev/sda: ST9320320AS - 26°C*p*
> GPU1: AMD Radeon HD 6700 Series - 75.00°C*p*
> *p*
> *body-*
>
> *html-*
>
> 3) Once I have this tiny web page with my temperature data in it, how do
> I set up a micro tiny pico web server, just to serve up less than a
> dozen web pages, just on the LAN, not WAN?  Apache would be WAY WAY
> overkill for this.  I don't need any security as long as the server
> responds only if requests are coming from the LAN.  The data goes
> through the same wifi adapter whether going to the LAN or WAN, but the
> source address subnet of the request would be the same as the subnet of
> the server.
>
> 4) How do I take the data, and stick it into a text file, spreadsheet,
> or database so I can keep historical records?
>
> There are many possibilities.  Again, I may not have time to implement
> them, but I'd like to know your thoughts.
>
> Sincerely,
>
> Ron
>
>
> On 5/29/2013 8:11 PM, David Tomaschik wrote:
>> Why bother measuring the temperature of the room?  Measure
>> temperatures of the machine if you're concerned about it overheating.
>>  If you want to measure air temperature coming into the machine,
>> there's an article here on using a $15 USB thermometer to measure air
>> temperature:
>> https://grepular.com/Using_Linux_to_Monitor_Room_Temperature_Remotely_and_Cheaply
>>
>>
>> BTW, your thermometers actually seem to be quite good.  +/- 1 deg F is
>> very reasonable for measuring room temperature -- in fact, I would be
>> shocked if there was less than 1 degree of variance in the temperature
>> throughout the room.  In the room where my always-on computer is, the
>> variance is about 8 degrees from one area to another, so unless the
>> thermometer is placed very carefully, 1 degree is insignificant.  What
>> would be more interesting is if a given thermometer is stable, or
>> tends to have readings that float around.
>>
>>
>> On Wed, May 29, 2013 at 2:47 PM, Ron Frazier (ALE)
>> <atllinuxenthinfo at techstarship.com
>> <mailto:atllinuxenthinfo at techstarship.com>> wrote:
>>
>>     Hi all,
>>
>>     I have a computer in a downstairs room that runs all the time.
>>      The processes I have it doing generate lots of heat; and there is
>>     no hvac thermostat there.  There is a heating / air vent and
>>     return though, so it gets some air circulation.  I need to monitor
>>     the temperature in the room from upstairs.
>>
>>     I bought an Acurite backyard weather thermometer from home depot
>>     with remote sensor.  I put batteries in the sensor and display and
>>     verified that the sensor is transmitting.  I sat both units a foot
>>     apart in the living room maybe 12 feed from the honeywell
>>     thermostat on the wall.  I trust the temperature reading of the
>>     honeywell more than any other sensor I have.
>>
>>     The honeywell says it's 73 in this room.  It doesn't show decimals.
>>     My fairly nice Oregon Scientific weather station shows 73.6 in
>>     this room.
>>     A cheap Lacross Technology weather monitor that I use to monitor
>>     humidity in the basement says 73.9 in this room.
>>     And a cheap Lacross Technology (I think) wall clock shows 73.0 in
>>     this room.
>>
>>     It's actually annoying that all these sensors within 12 feet of
>>     each other are so different.  I guess I'll assume that the actual
>>     temperature is between 73 and 74; and I think it's more toward 73.
>>
>>     My NEW weather monitor is showing 74 or 75 on both indoor and
>>     outdoor temp with both sensors in the same place, which probably
>>     about 1-2 degrees high.  This one doesn't display decimals.
>>
>>     In any case, while that's not ultra critical, I'm considering
>>     returning it.
>>
>>     So, I'm looking into other alternatives.
>>
>>     1) Buy another more expensive weather station, like another Oregon
>>     Scientific.  That would cost $ 50 - $ 75.
>>
>>     2) Buy a wifi or lan attached temperature sensor.  That way, I
>>     could just display the weather sensor's web page from a local
>>     192.168.x.x address and see the temperature in the basement room.
>>
>>     3) Use a rpi plus a sensor to do the same thing as number 2.
>>      Would probably cost more.
>>
>>     4) Attach a USB temp sensor to the pc downstairs and run a web
>>     server on it to display the temperature.
>>
>>     Other than having a more accurate stand alone unit like the one I
>>     bought, I like option 2 best.  That way, I could set a web page up
>>     in a small window on my monitor upstairs to show the downstairs
>>     temperature and set it to auto reload every few minutes.  Also, I
>>     could run a script on the downstairs computer to poll the sensor
>>     periodically and send me an email if the temperature exceeds a
>>     preset limit.
>>
>>     Anyone know what I might use to get this done?
>>
>>     By the way, when I was researching how to monitor my basement
>>     humidity, I found out that any humidity sensor less than about $
>>     300 is probably rubbish for precision.  The tolerance is usually +
>>     / - 5%.  I think that's ridiculous, but I guess it's hard to do
>>     much better for cheap.
>>
>>     Thanks in advance.
>>
>>     Sincerely,
>>
>>     Ron
>>



More information about the Ale mailing list