diff options
author | Britney Fransen <brfransen@gmail.com> | 2014-10-27 20:28:27 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2014-10-27 20:28:27 (GMT) |
commit | f7b823f55a80b1498c30e9f3a47692a2329c4f09 (patch) | |
tree | 6de557714e6336282fbc0ab16c6578386dfc6654 /abs/core/xymon/gpu-temp.sh | |
parent | 4c2a2e3504f472628285a989c7c9a76be6855f54 (diff) | |
parent | 01c1a60f3b7f93b3ed7404196c2cf798c4d8c674 (diff) | |
download | linhes_pkgbuild-f7b823f55a80b1498c30e9f3a47692a2329c4f09.zip linhes_pkgbuild-f7b823f55a80b1498c30e9f3a47692a2329c4f09.tar.gz linhes_pkgbuild-f7b823f55a80b1498c30e9f3a47692a2329c4f09.tar.bz2 |
Merge branch 'testing'
Diffstat (limited to 'abs/core/xymon/gpu-temp.sh')
-rw-r--r-- | abs/core/xymon/gpu-temp.sh | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/abs/core/xymon/gpu-temp.sh b/abs/core/xymon/gpu-temp.sh new file mode 100644 index 0000000..09f79ca --- /dev/null +++ b/abs/core/xymon/gpu-temp.sh @@ -0,0 +1,76 @@ +#!/bin/bash + + + +gpu_temp=0 +gpu_color="clear" + +if ! test -x /usr/bin/nvidia-smi ; then + + $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date` + GPUTEMP:$gpu_temp + Couldn't find nvidia-smi + " + exit 0 +fi + +# Use NVidia SMI to determine the model +gpu_model=`nvidia-smi -L` +if test -z "$gpu_model" ; then + $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date` + GPUTEMP:$gpu_temp + Couldn't find nvidia card + " + exit 0 +fi + +# Determine GPU maximum temperature based on GPU model +if test $(echo $gpu_model | grep -c -i 'GeForce 210') -eq 0 ; then + # GT 210 maximum GPU temperature is 105 C + max_temp=105 +elif test $(echo $gpu_model | grep -c -i 'GeForce 220') -eq 0 ; then + # GT 220 maximum GPU temperature is 105 C + max_temp=105 +elif test $(echo $gpu_model | grep -c -i 'GeForce 240') -eq 0 ; then + # GT 240 maximum GPU temperature is 105 C + max_temp=105 +elif test $(echo $gpu_model | grep -c -i 'GeForce 430') -eq 0 ; then + # GT 430 maximum GPU temperature is 98 C + max_temp=98 +elif test $(echo $gpu_model | grep -c -i 'GeForce GTS 450') -eq 0 ; then + # GTS 450 maximum GPU temperature is 100 C + max_temp=100 +elif test $(echo $gpu_model | grep -c -i 'GeForce GT 520') -eq 0 ; then + # GT 520 maximum GPU temperature is 102 C + max_temp=102 +else + # Assume 100 is the maximum + max_temp=100 +fi +crit_temp=`expr $max_temp - 5` +warn_temp=`expr $crit_temp - 10` + +if test -x /usr/bin/nvidia-smi ; then + temp=`nvidia-smi -q -g 0 -d TEMPERATURE | grep -Ei 'Gpu[[:space:]]+:[[:space:]]+[[:digit:]]+ C'` + gpu_temp=`echo $temp | sed -e 's/[^0-9]*//g'` + #echo "GPUTEMP:$gpu_temp" > /tmp/gputemp.txt + if test -n "$gpu_temp" ; then + # Have some type of number + if test $gpu_temp -lt $warn_temp ; then + gpu_color=green + elif test $gpu_temp -lt $crit_temp ; then + gpu_color=yellow + else + gpu_color=red + fi + #echo gputemp $gpu_temp $gpu_color + #echo $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date` + #`cat /tmp/gputemp.txt` + #" + $XYMON $XYMSRV "status $MACHINE.gputemp $gpu_color `date` + GPUTEMP:$gpu_temp + " + fi +fi + +exit 0
\ No newline at end of file |