[COLUG] using rrdtool to look at you CPU and mother board
temperatures.
Vincent Herried
vince at planetvince.info
Wed Jan 2 17:18:21 EST 2008
My several year old desk top got wonky.
It was weird, we were gone for several days over Xmas,
and I had set the thermometer to 55 degres F.
The 2nd morning after we got back my machine was make an alarm
sound from the pc speaker and was shut down.
I found out what the sound was from by setting the bios warning temp
low enough so it was exceeded.
After cleaning the dust out of the fans, I decided to monitor the
temperature... see the comments in the following shell script....
enjoy.....
#!/bin/bash
# 2008-01-02 vince
# A tool to graph the rrddata from sensorsd
#
# what it does is read in the sensord data
# and create a .png (graphical) file containing
# the results of some of the data that is recorded.
#
# prereqs - lm_sensors sensorsd and rrdtool.
# ln_sensors:
# use sensors-detect to "detect" and configure
# the /etc/sensors.conf file
# follow the directions and start him up.
# eg: $ service lm_sensors start
# sensord:
# first setup the sensord config file
# to request rrd data and give it the path location.
# if you are going to use this tool, then you
# may decide to not record the sensor data in
# syslogd
# it will automagically create the rrd data after you
# setup the config and start it up.
#
#
# I got help from
# http://www.krogloth.de/alex/linux/grading.html
#
# The rrd data is created by the sensord
# daemon. To find out what is in the dataset,
# after collecting some data, print out some current
# data eg $ sensors
#
# then examine the contents of the rrd data
# eg. $ rrdtool dump <rrdfile> |less
#
# by inspection, I found the following two entries
# that matched up with my mother board temperaturs
# and cpu temperatures (from sensors above)...
# <ds>
# <name> in0_9 </name>
# <type> GAUGE </type>
# <minimal_heartbeat> 1500 </minimal_heartbeat>
# <min> 0.0000000000e+00 </min>
# <max> 2.5000000000e+02 </max>
#
# <!-- PDP Status -->
# <last_ds> 29.0 </last_ds>
# <value> 4.9958300000e-01 </value>
# <unknown_sec> 0 </unknown_sec>
# </ds>
#
# <ds>
# <name> in0_A </name>
# <type> GAUGE </type>
# <minimal_heartbeat> 1500 </minimal_heartbeat>
# <min> 0.0000000000e+00 </min>
# <max> 2.5000000000e+02 </max>
#
# <!-- PDP Status -->
# <last_ds> 45.0 </last_ds>
# <value> 7.7521500000e-01 </value>
# <unknown_sec> 0 </unknown_sec>
# </ds>
# .
# .
# .
# ------------------------------------------------
# from inspection in0_9 and in0_A matched the
# mother board and cpu temp respectively.
#
#
#
# location of rrdtool
RRDTOOL=/usr/bin/rrdtool
# location of output
OUTPUT=/tmp/rrd.png
# location of input file
FILE=/var/log/sensors.rrd
$RRDTOOL graph $OUTPUT \
-t "CPU Temperature" -v "In Degrees C." \
--start="now-4d" \
--end="now" \
--height="120" \
--width="440" \
-c "BACK#000000" \
-c "SHADEA#000000" \
-c "SHADEB#000000" \
-c "FONT#DDDDDD" \
-c "CANVAS#202020" \
-c "GRID#666666" \
-c "MGRID#AAAAAA" \
-c "FRAME#202020" \
-c "ARROW#FFFFFF" \
"DEF:cp_temp=$FILE:in0_A:AVERAGE" \
"DEF:mb_temp=$FILE:in0_9:AVERAGE" \
"LINE1:cp_temp#F90000:CPU Temp" \
"GPRINT:cp_temp:LAST:Last\: %5.2lf C" \
"GPRINT:cp_temp:MIN:Min\: %5.2lf C" \
"GPRINT:cp_temp:MAX:Max\: %5.2lf C" \
"GPRINT:cp_temp:AVERAGE:Avg\: %5.2lf C" \
"LINE2:mb_temp#ea8f00:M/B Temp" \
"GPRINT:mb_temp:LAST:Last\: %5.2lf C" \
"GPRINT:mb_temp:MIN:Min\: %5.2lf C"\
"GPRINT:mb_temp:MAX:Max\: %5.2lf C"\
"GPRINT:mb_temp:AVERAGE:Avg\: %5.2lf C"\
>/dev/null
#
##############the end#############
--
my website is http://planetvince.info
v
More information about the colug432
mailing list