#!/usr/bin/perl # # optimalTemp - Return temperatures for Optimal clones. # Copyright Clint Byrum, CareerCast, Inc. 2005 # Created: 12/11/2003 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # - Maintain compatibility with compaqTemp script, which prints things out in # the same order as /proc/cpqtemp on the compaqs. # # The order is: Processor Zone,CPU0,IO Zone,CPU1,PowerSupply Bay # # The optimals only record CPU temperature from what we can see, so # we will take the output of sensors and record things # # # w83627hf-isa-0290 # Adapter: ISA adapter # Algorithm: ISA algorithm # VCore 1: +1.42 V (min = +1.28 V, max = +1.40 V) # VCore 2: +1.76 V (min = +1.28 V, max = +1.40 V) # +3.3V: +3.23 V (min = +3.13 V, max = +3.45 V) # +5V: +5.02 V (min = +4.72 V, max = +5.24 V) # +12V: +12.39 V (min = +10.79 V, max = +13.19 V) # -12V: +1.33 V (min = -13.21 V, max = -10.90 V) # -5V: +0.01 V (min = -5.26 V, max = -4.76 V) # V5SB: +5.29 V (min = +4.72 V, max = +5.24 V) ALARM # VBat: +2.89 V (min = +2.40 V, max = +3.60 V) # fan1: 0 RPM (min = 3000 RPM, div = 2) # fan2: 0 RPM (min = 3000 RPM, div = 2) # fan3: 0 RPM (min = 750 RPM, div = 8) # temp1: +140F (limit = +140F) sensor = PII/Celeron diode ALARM # temp2: +129.2F (limit = +140F, hysteresis = +122F) sensor = PII/Celeron diode ALARM # temp3: +113.0F (limit = +140F, hysteresis = +122F) sensor = PII/Celeron diode # vid: +1.350 V # alarms: Chassis intrusion detection ALARM # beep_enable: # Sound alarm disabled # # TODO: Use IPMI and bcmsensors for fan speeds and stuff. # use strict; my $lmhome="/usr/local/lm_sensors-2.8.1"; # XXX Ugh, this has to change sometimes open (TEMP,"$lmhome/bin/sensors -f|"); my $chipfound=0; my @tvals=(); while(my $line=) { if($line=~/^w83627hf/) { $chipfound=1; next; } if($line=~/^temp2/) { $tvals[1]=&line2tval($line); } if($line=~/^temp3/) { $tvals[3]=&line2tval($line); } } #foreach my $tval (@tvals) { for(my $i=0;$i<5;$i++) { printf "%0.0f\n",$tvals[$i]; } sub line2tval { my $line=shift(); my (undef,$tval)=split(/\s\+/,$line); $tval=~s/[^0-9\.]//; return $tval; }