Posted by & filed under Programming & Sysadmin.

Dell DRACs (lights out management cards) provide additional sensor data, available via snmp. This can be used easily with a simple script and MRTG to provide graphs of Inlet and Outlet temperature over time.

temperature graph

You’ll just need mrtg and snmpwalk. net-snmp-utils provides snmpwalk.
The snmp required to get the data is below:

$ snmpwalk -v 1 -c public 127.0.0.1 .1.3.6.1.4.1.674.10892.5.4.700.20.1.8
SNMPv2-SMI::enterprises.674.10892.5.4.700.20.1.8.1.1 = STRING: "System Board Inlet Temp"
SNMPv2-SMI::enterprises.674.10892.5.4.700.20.1.8.1.2 = STRING: "System Board Exhaust Temp"
SNMPv2-SMI::enterprises.674.10892.5.4.700.20.1.8.1.3 = STRING: "CPU1 Temp"
SNMPv2-SMI::enterprises.674.10892.5.4.700.20.1.8.1.4 = STRING: "CPU2 Temp"

$ snmpwalk -v 1 -c public 127.0.0.1 .1.3.6.1.4.1.674.10892.5.4.700.20.1.6
 SNMPv2-SMI::enterprises.674.10892.5.4.700.20.1.6.1.1 = INTEGER: 220
 SNMPv2-SMI::enterprises.674.10892.5.4.700.20.1.6.1.2 = INTEGER: 370
 SNMPv2-SMI::enterprises.674.10892.5.4.700.20.1.6.1.3 = INTEGER: 540
 SNMPv2-SMI::enterprises.674.10892.5.4.700.20.1.6.1.4 = INTEGER: 540

And, you can format that into Degrees Farenheit, like this:


$ snmpwalk -v 1 -c public 127.0.0.1 .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.1|awk -F: '{print (($4/10)*(9/5)+32)}'

To use MRTG to graph these temperatures, you’ll need a simple script that MRTG can call every 5 minutes. Something like this will work:


#!/bin/bash
# dctemp.sh
#
# 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. "
###########################################################################
HOST=$1
NAME=$2
TEMP1=$( /bin/snmpwalk -v 1 -c public $HOST .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.1|awk -F: '{print (($4/10)*(9/5)+32)}' )
TEMP2=$( /bin/snmpwalk -v 1 -c public $HOST .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.2|awk -F: '{print (($4/10)*(9/5)+32)}' )
UPTIME=`uptime`
TEXT="Inlet and Outlet Temp - at $NAME"
echo ${TEMP1}
echo ${TEMP2}
echo ${UPTIME}
echo ${TEXT}

In /etc/mrtg.conf, you’ll need something like this:


Options[_]: growright,nopercent, nobanner, noinfo, gauge, nolegend, pngdate
MaxBytes[_]: 110
AbsMax[_]: 140
ShortLegend[_]: F
YLegend[_]: Inlet / Outlet Temperature
XSize[_]: 500
YSize[_]: 300
YTics[_]: 22
Unscaled[_]: ymwd

Target[dc0.temp]: `/home/username/dctemp.sh 127.0.0.1 Server1`
Title[dc0.temp]: Server 1
PNGTitle[dc0.temp]: Temperature at Server 1
PageTop[dc0.temp]: Temp at Server 1

After you have mrtg.cfg configured, run the mrtg indexer script to generate the html.

indexmaker -output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg
And add an mrtg cron job:

*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg &> /dev/null

If you installed mrtg using your system’s package manager, it should be aliased to /mrtg in your apache server, so you should see the graphs at http://server:port/mrtg/