[ltp] ibm-acpi temperatures (was: KDE3.3 and running fan)

Uwe Walter linux-thinkpad@linux-thinkpad.org
Tue, 18 Jan 2005 17:09:44 +0100


--=-RjaoBBzsf3I9tjgXCkaU
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

On Mo, 2005-01-17 at 20:38 +0100, Alexander Gran wrote:
> How did you make this graph? Seeems to be a nice way to figure the temps =
out..

I am "misusing" the battery-stats package:
http://packages.debian.org/testing/admin/battery-stats

But just to save some time for the generation of the gnuplots.

I use the first attached script to collect the data (hddtemp is needed)
in a very simple form in /var/log:
date_(in_seconds_from_epoch) cputemp hddtemp temp2 temp3 temp4 fan

With a modified version of battery-stats' battery-graph script (see
attached temp-graph), I can quickly generate the gnuplot diags. As
battery-graph, temp-graph includes the file graph-setup to set some
initial values for the gnuplots (also attached).

Credits for the underlying battery graph scripts go to Karl E.
J=F8rgensen.

I mainly wanted to use the "infrastructure" battery-graph already
provides to select an amount of time that shall be painted. However, I
scrubbed support for multiple log files from my temp-graph hack.

Probably, a new script should be created, that can setup gnuplot without
the "graph-setup" inclusion and all that around, but I'm fine at the
moment and didn't want to create something elegant at all... ;)


Greetings, UW(e)


--=-RjaoBBzsf3I9tjgXCkaU
Content-Disposition: attachment; filename=temp-stats-collector.sh
Content-Type: application/x-shellscript; name=temp-stats-collector.sh
Content-Transfer-Encoding: 7bit

#!/bin/bash
FILE=/var/log/temp-stats
while true; do
 time=`date +"%s"`
 alltemps=`cat /proc/acpi/ibm/thermal`
 cputemp=`echo $alltemps | awk '{ print $2; }'`
 temp2=`echo $alltemps | awk '{ print $3; }'`
 temp3=`echo $alltemps | awk '{ print $4; }'`
 temp4=`echo $alltemps | awk '{ print $5; }'`
 fan=`echo $alltemps | awk '{ print $11; }'`
 hddtemp=`hddtemp -n /dev/hda`
 echo $time $cputemp $hddtemp $temp2 $temp3 $temp4 $fan >>$FILE
 sleep 60;
done;

--=-RjaoBBzsf3I9tjgXCkaU
Content-Disposition: attachment;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CiAgICBlY2hvIC1uICJcIi92
YXIvbG9nL3RlbXAtc3RhdHNcIiB1c2luZyAoXCQxIC0gJGFkanVzdG1lbnQpOjQgc21vb3RoIHVu
aXF1ZSBheGlzIHgxeTEgdGl0bGUgXCJUZW1wMlwiIHdpdGggbGluZXMgbGluZXdpZHRoIDEsICIK
ICAgIGVjaG8gLW4gIlwiL3Zhci9sb2cvdGVtcC1zdGF0c1wiIHVzaW5nIChcJDEgLSAkYWRqdXN0
bWVudCk6NSBzbW9vdGggdW5pcXVlIGF4aXMgeDF5MSB0aXRsZSBcIlRlbXAzXCIgd2l0aCBsaW5l
cyBsaW5ld2lkdGggMSwgIgogICAgZWNobyAtbiAiXCIvdmFyL2xvZy90ZW1wLXN0YXRzXCIgdXNp
bmcgKFwkMSAtICRhZGp1c3RtZW50KTo2IHNtb290aCB1bmlxdWUgYXhpcyB4MXkxIHRpdGxlIFwi
VGVtcDRcIiB3aXRoIGxpbmVzIGxpbmV3aWR0aCAxLCAiCiAgICBlY2hvICJcIi92YXIvbG9nL3Rl
bXAtc3RhdHNcIiB1c2luZyAoXCQxIC0gJGFkanVzdG1lbnQpOjcgc21vb3RoIHVuaXF1ZSBheGlz
IHgxeTIgdGl0bGUgXCJGYW5cIiB3aXRoIGxpbmVzIGxpbmV3aWR0aCAyIgojICAgIHRlbXAtbG9n
ICIkQCIKIyAgICBjYXQgL3Zhci9sb2cvdGVtcC1zdGF0cwopICB8IGdudXBsb3QgLXBlcnNpc3Qg
JHtnZW9tZXRyeTorLWdlb21ldHJ5fSAkZ2VvbWV0cnkgJHt0aXRsZTorLXRpdGxlfSAiJHt0aXRs
ZX0iCg==


--=-RjaoBBzsf3I9tjgXCkaU
Content-Disposition: attachment; filename=graph-setup
Content-Type: text/plain; name=graph-setup; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable


# This file is part of the battery-stats package.
# Copyright (C) 2002 Karl E. J=F8rgensen <karl@jorgensen.com>=20
#
# 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
#
set noclip points
set clip one
set noclip two
set bar 1.000000
set border 31 lt -1 lw 1.000


set xdata time
set format x "%H:%M\n%d %b"
#set xlabel "Date/Time"=20
set xzeroaxis lt -2 lw 1.000
set xtics border mirror norotate autofreq
set mxtics default
set grid xtics nomxtics

set ydata
set format y "% g"
set ylabel "%Full" 0.000000,0.000000  ""
set yrange [ 0 : 100 ]
set yzeroaxis lt -2 lw 1.000
set ytics border mirror norotate autofreq # 0, 10
set mytics 2
set grid ytics nomytics



#set y2data
#set format y2 "% g"
#set y2zeroaxis lt -2 lw 1.000
#set my2tics default
#set noy2tics
#set y2tics border nomirror norotate autofreq
#set y2label "minutes" 0.000000,0.000000  ""
#set y2range [ 0 : * ] noreverse nowriteback  # (currently [-10.0000:10.000=
0] )
#set grid noy2tics nomy2tics

set dummy x,y
set key title ""
set key left bottom left noreverse box linetype -2 linewidth 1.000 samplen =
4 spacing 1 width 0
#set nokey

set nolabel
set noarrow
set nolinestyle
set nologscale
set offsets 0, 0, 0, 0
set pointsize 1
set encoding default
set nopolar
set noparametric
set view 60, 30, 1, 1
set samples 100, 100
set isosamples 10, 10
set surface
set nocontour
set clabel '%8.3g'
set mapping cartesian
set nohidden3d
set cntrparam order 4
set cntrparam linear
set cntrparam levels auto 5
set cntrparam points 5
set size ratio 0 1,1
set origin 0,0
set data style points
set function style lines
set tics in
set ticslevel 0.5
set ticscale 1 0.5
#set title "" 0.000000,0.000000  ""
#set timestamp "" bottom norotate 0.000000,0.000000  ""
#set timefmt "%Y/%m/%d %H:%M:%S"

#set yrange [ * : * ] noreverse nowriteback  # (currently [-10.0000:10.0000=
] )
set zero 1e-08
set lmargin -1
set bmargin -1
set rmargin -1
set tmargin -1
#set locale "C"


--=-RjaoBBzsf3I9tjgXCkaU--