Monitor temperatures of GPU, CPU and HDD

Once I had an idea to write a Munin plug-in to monitor temperatures on my server

Since a long time I have Munin on my PC to monitor some data like ping time:




Login to your root account and execute these commands:

cd /etc/munin/plugins nano temp_stats

#!/bin/sh
case $1 in
   config)
        cat < <'EOM'
graph_peroid 20
graph_category sensors
graph_title Temperatures
graph_vlabel Celsius
cpu_temp.label i7
hdd_temp.label HDD
gpu_temp.label AMD_ATI
 
EOM
        exit 0;;
esac
 
echo -n "cpu_temp.value "; acpi -t | grep "[[:digit:]]{2}.[[:digit:]]" -o
echo -n "hdd_temp.value "; TEMP=`hddtemp -n /dev/sda`; echo $TEMP".0"
echo -n "gpu_temp.value "; DISPLAY=:0.0 sudo aticonfig --adapter=1 --od-gettemperature | grep "[[:digit:]]{2}.[[:digit:]]" -o

To allow munin execute `aticonfig` (collect data about GPU), we must edit /etc/sudoers file by adding this line:

nobody ALL=NOPASSWD: /usr/bin/aticonfig

Now let’s check if everything is ok

 munin-run temp_stats

Result on my machine:

root@Agilob-PC:/etc/munin/plugins# munin-run stat_temp
cpu_temp.value 87.0
hdd_temp.value 33.0
gpu_temp.value 85.5

Now execute the command below:

/etc/init.d/munin-node

Since now, munin will collect data and you will see a graph similar to this one:

Voilà!

[Total: 0    Average: 0/5]
  • regor

    There are some typo in this code, and the regex is also not good for the HDD temperature, working with some modifications. Thanks!