Skip to content

Instantly share code, notes, and snippets.

@alantian
Forked from frantic1048/nvidia-gpu-sensor.pl
Created October 2, 2016 21:55
Show Gist options
  • Select an option

  • Save alantian/c3b172dfd009dfcf736b8df22495fcd3 to your computer and use it in GitHub Desktop.

Select an option

Save alantian/c3b172dfd009dfcf736b8df22495fcd3 to your computer and use it in GitHub Desktop.
KDE KSysGuard NVIDIA GPU temperature sensor
#!/usr/bin/perl -w
# act as a KSysGuard sensor
# provides NVIDIA GPU temperature via `nvidia-settings`
# Usage
# 1. save this file, make sure it has a exec permission
# 2. in KSysGuard's menu, open `File` -> `Monitor Remote Machine`
# 3.1 in new dialog, type `Host` whatever you want
# 3.2 set `Connection Type` to `Custom command`
# 3.3 set `Command` like `path/to/this-sensor.pl`
# 4. click `OK`, now you can find new sensor named `gpu_temp`
# which is provides GPU temperature
# See Also
# https://techbase.kde.org/Development/Tutorials/Sensors
$|=1;
print "ksysguardd 1.2.0\n";
print "ksysguardd> ";
while(<>){
if(/monitors/){
print "gpu_temp\tinteger\n";
}
if(/gpu_temp/){
if(/\?/){
print "GPU Temp\t0\t0\n";
}else{
print `nvidia-settings -q gpucoretemp | grep -m1 'GPUCoreTemp' | awk -F" " '{gsub("\\\\.","");print \$4}'`;
}
}
print "ksysguardd> ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment