You were never here, you didn't see anything..

Video Card Temps


I have not had time to load the distro of choice onto the new system yet. That will simply take more free time in one lump than I have to spare presently. I did however toss together a short script to pull the temps from the video cards.

The cards have two temperature sensors each. One is for the GPU itself and the other is listed as measuring the ambient. I wanted a means to check them without having to fire up the Nvidia GUI application. Just a quick check from the cli was the goal. I did a decent amount of googling before I stumbled upon a post on the Nvidia forums. This pointed to using nvidia-settings to query for the data via cli which is perfect.

The thermal sensors on my cards did not return proper data for all the cards when I used the strings for the “GPUCoreTemp” and “GPUAmbientTemp”. It would return “0” values for both on card 1 and 2 (we start at 0 on this one). Instead I have to query seperate items listed simply as “thermalsensor”, of which I have 6. Matching the real time data with that in the GUI to each one in the output I was able to line things up nicely.

So, the final product:

#!/bin/bash
# Get and return GPU and ambient temp readings from the 3 Nvidia cards

nvidia-settings \
	-q kaon:0[thermalsensor:0]/ThermalSensorReading \
	-q kaon:0[thermalsensor:1]/ThermalSensorReading \
	-q kaon:0[thermalsensor:2]/ThermalSensorReading \
	-q kaon:0[thermalsensor:3]/ThermalSensorReading \
	-q kaon:0[thermalsensor:4]/ThermalSensorReading \
	-q kaon:0[thermalsensor:5]/ThermalSensorReading \
	2> /dev/null \
	| grep Attribute \
	| sed 's/\.//' \
	| sed 's/(kaon:0\[thermalsensor:0\]):/GPU_0/' \
	| sed 's/(kaon:0\[thermalsensor:1\]):/Card0/' \
	| sed 's/(kaon:0\[thermalsensor:2\]):/GPU_1/' \
	| sed 's/(kaon:0\[thermalsensor:3\]):/Card1/' \
	| sed 's/(kaon:0\[thermalsensor:4\]):/GPU_2/' \
	| sed 's/(kaon:0\[thermalsensor:5\]):/Card2/' \
	| awk '{ print $3" "$4 }'

And a sample output from this script is:

andarius@kaon : ./gpu-temp.sh
GPU_0 69
Card0 54
GPU_1 59
Card1 52
GPU_2 49
Card2 44

Hope this helps some one else or is at least interesting…

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!