Graphing the metrics from HP ilo2

I have recently acquired several Gen6 HP machines (2 x DL160’s & 1 x DL180). These are pretty old pieces of kit, but are reasonably priced. Not too loud and not too power hungry, so they make pretty good homelab machines.

Just like any other admin, i love to graph stuff. Sadly, these machines dont put out any of the ilo data via SNMP, all they can do is forward SNMP data from the operating system. Luckily though, it is possible to get the data via ipmitool. So i wrote this script which uses ipmitool to pull the data out, dump it into a text file, grep through it and then push the relevant bits through to my graphite host to then display with grafana.

Here is the script itself. All you should need to change is the location for the ipmidump, ipmi username/password, the target host and the graphite host ip. Its not too pretty, but does the job.


# As this will be running as a cronjob we need to set the PATH's

# Set the location of the file we will be dumping the IPMITOOL output to.

# Pull the data we want from the HP machine, Via IPMITOOL
/usr/bin/ipmitool -I lanplus -H <TARGET-IP> -U <TARGET_IPMI_USERNAME> -P <TARGET_IPMI_PASSWORD> sensor > ${IPMIOUT}

# Select what we are sending to Graphite
POWER_METER="$(grep "Power Meter" ${IPMIOUT} | awk ' {print $4} ')"
PSU1="$(grep "Power Supply 1" ${IPMIOUT} | awk ' {print $5} ')"
PSU2="$(grep "Power Supply 2" ${IPMIOUT} | awk ' {print $5} ')"
FAN_BLOCK_1="$(grep "Fan Block 1" ${IPMIOUT} | awk ' {print $5} ')"
FAN_BLOCK_2="$(grep "Fan Block 2" ${IPMIOUT} | awk ' {print $5} ')"
FAN_BLOCK_3="$(grep "Fan Block 3" ${IPMIOUT} | awk ' {print $5} ')"
FAN_BLOCK_4="$(grep "Fan Block 4" ${IPMIOUT} | awk ' {print $5} ')"
AMBI_TEMP="$(grep -w "Temp 1" ${IPMIOUT} | awk ' {print $4} ')"
CPU1_TEMP="$(grep -w "Temp 2 (CPU 1)" ${IPMIOUT} | awk ' {print $6} ')"
CPU2_TEMP="$(grep -w "Temp 3 (CPU 2)" ${IPMIOUT} | awk ' {print $6} ')"
MEM_ZONE_1="$(grep -w "Temp 4" ${IPMIOUT} | awk ' {print $4} ')"
MEM_ZONE_2="$(grep -w "Temp 5" ${IPMIOUT} | awk ' {print $4} ')"

# Sent to Graphite
echo "dl180.POWER_METER ${POWER_METER} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.PSU1 ${PSU1} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.PSU2 ${PSU2} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.FAN_BLOCK_1 ${FAN_BLOCK_1} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.FAN_BLOCK_2 ${FAN_BLOCK_2} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.FAN_BLOCK_3 ${FAN_BLOCK_3} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.FAN_BLOCK_4 ${FAN_BLOCK_4} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.AMBI_TEMP ${AMBI_TEMP} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.CPU1_TEMP ${CPU1_TEMP} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.CPU2_TEMP ${CPU2_TEMP} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.MEM_ZONE_1 ${MEM_ZONE_1} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
echo "dl180.MEM_ZONE_2 ${MEM_ZONE_2} `date +%s`" | nc -q0 <GRAHPITE_HOST> 2003
rm -rf ${IPMIOUT}

To run this automatically i added into crontab. The full cron entry i used was */5 * * * * /home/jon/scripts/ipmi-logger-dl180/ >/dev/null 2>&1. So this will run every 5 minutes.

And here is a taster of the output:

On a final note, im trying to work out the location of the sensors within these machines. If anyone has a map of the location of each sensor, it would be great if they could send it onto me!?