Monitor gpu temperature

From Finninday
Revision as of 01:15, 15 July 2011 by Rday (Talk | contribs)

Jump to: navigation, search
  • how do I get the current temperature of my nvidia GPU?
rday@merkli:~$ nvidia-settings -q [gpu:0]/GPUCoreTemp | grep Attribute | sed -e "s/.*.://g" -e "s/\.//g"
 47

The result is in Celsius.

Without all the filtering, it looks like this:

rday@merkli:~$ nvidia-settings -q [gpu:0]/GPUCoreTemp

  Attribute 'GPUCoreTemp' (merkli:0[gpu:0]): 47.
    'GPUCoreTemp' is an integer attribute.
    'GPUCoreTemp' is a read-only attribute.
    'GPUCoreTemp' can use the following target types: X Screen, GPU.


Now I want to put this into a hobbit monitor task. The easiest way is to stick it into an existing custom monitor.

/usr/lib/hobbit/client/ext/cputemp looks like this:

#!/bin/sh

#/usr/bin/sensors -f | grep "CPU Temp" | awk '{print $1 $2 $3}' |
#	awk {'sub("\+", ""); sub("°F", ""); print }' > /tmp/cputemp.txt
#/usr/bin/sensors -f | grep -i temp | grep -v k8temp| awk '{ sub("°F", ""); sub("\+", ""); sub("/", ""); sub(" +", ""); sub("\(.*$", ""); print}' > /tmp/cputemp.txt
/usr/bin/sensors -f | grep -i temp | grep -v k8temp | awk '{sub(".F.*$",
""); sub(" +",""); sub("+",""); print}' > /tmp/cputemp.txt

RESULT=`grep Core0Temp /tmp/cputemp.txt | awk '{ FS=":";  print int($2) }'`;
COLOR=green
if test "$RESULT" -gt 120
then
	COLOR=red
fi
if test "$RESULT" -lt 70
then
	COLOR=red
fi

$BB $BBDISP "status $MACHINE.cputemp $COLOR `date`

`cat /tmp/cputemp.txt`
"

exit 0

It probably should look something like this:

#!/bin/sh

#/usr/bin/sensors -f | grep "CPU Temp" | awk '{print $1 $2 $3}' |
#	awk {'sub("\+", ""); sub("°F", ""); print }' > /tmp/cputemp.txt
#/usr/bin/sensors -f | grep -i temp | grep -v k8temp| awk '{ sub("°F", ""); sub("\+", ""); sub("/", ""); sub(" +", ""); sub("\(.*$", ""); print}' > /tmp/cputemp.txt
CGPUTEMP=`nvidia-settings -q [gpu:0]/GPUCoreTemp | grep Attribute | sed -e "s/.*.://g" -e "s/\.//g"`;

FGPUTEMP=$CGPUTEMP*9/5+32
echo "temp1:$FGPUTEMP" > /tmp/cputemp.txt
/usr/bin/sensors -f | grep Temp | grep -v k8temp | awk '{sub(".F.*$",
""); sub(" +",""); sub("+",""); print}' >> /tmp/cputemp.txt

RESULT=`grep Core0Temp /tmp/cputemp.txt | awk '{ FS=":";  print int($2) }'`;
COLOR=green
if test "$RESULT" -gt 120
then
	COLOR=red
fi
if test "$RESULT" -lt 70
then
	COLOR=red
fi

$BB $BBDISP "status $MACHINE.cputemp $COLOR `date`

`cat /tmp/cputemp.txt`
"

exit 0