For When You Can't Have The Real Thing
[ start | index | login ]
start > munin > ipmi-sensors ugly hack

ipmi-sensors ugly hack

Created by dave. Last edited by dave, 12 years and 199 days ago. Viewed 5,792 times. #2
[diff] [history] [edit] [rdf]
labels
attachments

Highly-specific ipmi-sensors plugin for munin

This reads the temperature returns from ipmi-sensors on a two-processor Dell SC1425 and graphs the results.

In general: You can get temperature information from the ipmi setup as so:

# ipmi-sensors | grep Temp
1: Temp (Temperature): 36.00 C (5.00/125.00): [OK]
2: Temp (Temperature): 37.00 C (5.00/125.00): [OK]
3: Planar Temp (Temperature): 32.00 C (5.00/75.00): [OK]
4: VRD 0 Temp (Temperature): 26.00 C (5.00/70.00): [OK]
5: VRD 1 Temp (Temperature): 26.00 C (5.00/70.00): [OK]
...which you can then string into just temperatures as so:
# ipmi-sensors | grep Temp | sed -e 's/^.*e.: //' | awk '{print $1}'
36.00
37.00
32.00
26.00
26.00

This bash script creates a stack from the values returned from the ipmi-sensors invocation above, then prints them out in a format munin expects, which works because we know what order the ipmi-sensors invocation returns the values in:

#!/bin/bash
if [ "$1" == "config" ] ; then
        cat <<"EoF"
graph_args -l 15 -r
graph_title Temperatures
graph_order cpu0 cpu1 planar vrd0 vrd1
graph_vlabel C
graph_category Environmental
cpu0.label CPU0
cpu0.warning 120
cpu0.critical 125
cpu1.label CPU1
cpu1.warning 120
cpu1.critical 125
planar.label Planar
planar.warning 70
planar.critical 75
vrd0.label VRD0
vrd0.warning 70
vrd0.critical 75
vrd1.label VRD1
vrd1.warning 70
vrd1.critical 75

EoF exit 0 fi

BP=100 # Base Pointer of stack array. # Begin at element 100.

SP=$BP # Stack Pointer. # Initialize it to "base" (bottom) of stack.

Data= # Contents of stack location. # Must use global variable, #+ because of limitation on function return range.

# 100 Base pointer <-- Base Pointer # 99 First data item # 98 Second data item # … More data # Last data item <-- Stack pointer

declare -a stack

push() # Push item on stack. { if [ -z "$1" ] # Nothing to push? then return fi let "SP -= 1" # Bump stack pointer. stack[$SP]=$1 return }

pop() # Pop item off stack. { Data= # Empty out data item. if [ "$SP" -eq "$BP" ] # Stack empty? then return fi # This also keeps SP from getting past 100, #+ i.e., prevents a runaway stack. Data=${stack[$SP]} let "SP += 1" # Bump stack pointer. return }

for i in `ipmi-sensors | grep Temp | sed -e 's/^.*e.: //' | awk '{print $1}'` ; do push $i done for i in vrd1 vrd0 planar cpu1 cpu0 ; do pop echo "$i.value $Data" done

Relevant versions:
  • munin 1.4.6-3.el6 (from EPEL) running on CentOS 6
  • freeipmi 0.7.16-3.el6
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt