From WBITT's Cooker!
Create the following script:
[root@www mrtg]# cat /usr/local/bin/sensors-mrtg.sh
#!/bin/bash
SENSORS=/usr/bin/sensors
UPTIME=$(uptime | awk -F, '{print $1}' )
TEXT="CPU Temperature"
CPU1TEMP=$( ${SENSORS} | grep "CPU1 Temp" | awk '{print int($3)}' )
# http://people.ee.ethz.ch/~oetiker/webtools/mrtg/reference.html
# "The external command must return 4 lines of output:
# Line 1
# current state of the first variable, normally 'incoming bytes count'
# Line 2
# current state of the second variable, normally 'outgoing bytes count'
# Line 3
# string (in any human readable format), telling the uptime of the target.
# Line 4
# string, telling the name of the target. "
echo ${CPU1TEMP}
echo ${CPU1TEMP}
echo ${UPTIME}
echo ${TEXT}
[root@www mrtg]#
Add the following code to your MRTG config file:
Target[CPUTemperature]: `/usr/local/bin/sensors-mrtg.sh`
Options[CPUTemperature]: nopercent,growright,unknaszero,gauge
MaxBytes[CPUTemperature]: 75
AbsMax[CPUTemperature]: 100
Unscaled[CPUTemperature]: dwmy
Title[CPUTemperature]: CPU Temperature
PageTop[CPUTemperature]: <H1>CPU Temperature</H1>
ShortLegend[CPUTemperature]: Celcius
YLegend[CPUTemperature]: Celcius