Assume you want to monitor the FAN rotation of your CPU and CPU and MB temperature:
Step 1: Set up lm-sensors
rtfmlm-sensors
Step 2: Create check script (e.g. /var/www/mrtg/sensors)
#!/bin/bash
case $1 in
fan)
/usr/bin/sensors | grep fan1| awk '{print $2}'
;;
temp)
/usr/bin/sensors | grep temp1| awk '{print $2}'| sed "s/[+|°C]//g" | sed "s/\..*$//g"
/usr/bin/sensors | grep temp3| awk '{print $2}'| sed "s/[+|°C]//g" | sed "s/\..*$//g"
;;
esac
Step 3: Extend snmpd.conf
extend .1.3.6.1.4.1.2021.50 fan /var/www/mrtg/sensors fan
extend .1.3.6.1.4.1.2021.51 cpu_temp /var/www/mrtg/sensors temp
Step 4: Snmpwalk required OID
rtfm snmpwalk
Step 5: Extend mrtg.conf
Target[atom.fan]: .1.3.6.1.4.1.2021.50.4.1.2.3.102.97.110.1&.1.3.6.1.4.1.2021.50.4.1.2.3.102.97.110.1:public@localhost
Title[atom.fan]: CPU Fan speed
PageTop[atom.fan]: <H1>CPU Fan Speed</H1>
MaxBytes[atom.fan]: 5000
ShortLegend[atom.fan]: rpm
YLegend[atom.fan]: RPM
LegendI[atom.fan]: CPU fan speed
Options[atom.fan]: growright,nopercent,unknaszero,gauge,noo
Unscaled[atom.fan]: ymwd
Target[atom.temp]: .1.3.6.1.4.1.2021.51.4.1.2.8.99.112.117.95.116.101.109.112.1&.1.3.6.1.4.1.2021.51.4.1.2.8.99.112.117.95.116.101.109.112.2:public@localhost
Title[atom.temp]: Temperature
PageTop[atom.temp]: <H1>Temperature</H1>
MaxBytes[atom.temp]: 100
ShortLegend[atom.temp]: °C
YLegend[atom.temp]: Temperature
LegendI[atom.temp]: CPU Temperature
LegendO[atom.temp]: MB Temperature
Options[atom.temp]: growright,nopercent,unknaszero,gauge
Unscaled[atom.temp]: ymwd
That's it!
Step 1: Set up lm-sensors
rtfmlm-sensors
Step 2: Create check script (e.g. /var/www/mrtg/sensors)
case $1 in
fan)
/usr/bin/sensors | grep fan1| awk '{print $2}'
;;
temp)
/usr/bin/sensors | grep temp1| awk '{print $2}'| sed "s/[+|°C]//g" | sed "s/\..*$//g"
/usr/bin/sensors | grep temp3| awk '{print $2}'| sed "s/[+|°C]//g" | sed "s/\..*$//g"
;;
esac
Step 3: Extend snmpd.conf
extend .1.3.6.1.4.1.2021.50 fan /var/www/mrtg/sensors fan
extend .1.3.6.1.4.1.2021.51 cpu_temp /var/www/mrtg/sensors temp
Step 4: Snmpwalk required OID
rtfm snmpwalk
Step 5: Extend mrtg.conf
Target[atom.fan]: .1.3.6.1.4.1.2021.50.4.1.2.3.102.97.110.1&.1.3.6.1.4.1.2021.50.4.1.2.3.102.97.110.1:public@localhost
Title[atom.fan]: CPU Fan speed
PageTop[atom.fan]: <H1>CPU Fan Speed</H1>
MaxBytes[atom.fan]: 5000
ShortLegend[atom.fan]: rpm
YLegend[atom.fan]: RPM
LegendI[atom.fan]: CPU fan speed
Options[atom.fan]: growright,nopercent,unknaszero,gauge,noo
Unscaled[atom.fan]: ymwd
Target[atom.temp]: .1.3.6.1.4.1.2021.51.4.1.2.8.99.112.117.95.116.101.109.112.1&.1.3.6.1.4.1.2021.51.4.1.2.8.99.112.117.95.116.101.109.112.2:public@localhost
Title[atom.temp]: Temperature
PageTop[atom.temp]: <H1>Temperature</H1>
MaxBytes[atom.temp]: 100
ShortLegend[atom.temp]: °C
YLegend[atom.temp]: Temperature
LegendI[atom.temp]: CPU Temperature
LegendO[atom.temp]: MB Temperature
Options[atom.temp]: growright,nopercent,unknaszero,gauge
Unscaled[atom.temp]: ymwd
That's it!