From 1017bbe9c98c342d8810214d09457678176acd35 Mon Sep 17 00:00:00 2001 From: Alexx Roche Date: Tue, 7 Dec 2010 10:17:25 +0100 Subject: [PATCH] Initial version --- plugins/other/ipmi_therm | 99 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 plugins/other/ipmi_therm diff --git a/plugins/other/ipmi_therm b/plugins/other/ipmi_therm new file mode 100755 index 00000000..5934ed2c --- /dev/null +++ b/plugins/other/ipmi_therm @@ -0,0 +1,99 @@ +#! /usr/bin/perl -w +# +# This plugin will graph the chassis temp sensors on a Dell PowerEdge Server +# via the ipmi-sensors tool. It has been tested on the following chassis: +# +# PE1850 +# +# To enable: +# +# ln -s /usr/share/munin/plugins/ipmi-therm /etc/munin/plugins/ipmi-therm +# +# Configuration parameters for /etc/munin/plugin-conf.d/munin-node +# +# [ipmi_therm] +# user - User that has permissions to run the omreport binary +# env.category sensors +# +# Parameters: +# +# config +# autoconf +# +# Author: Alexx Roche +# Built on the work of Justin Shepherd +# Revision: 1.0 2010/01/28 +# +#%# family=auto +#%# capabilities=autoconf + +use strict; + +my $IPMI; +if(-f "/usr/sbin/ipmi-sensors"){ $IPMI='/usr/sbin/ipmi-sensors'; } +unless($IPMI){ + $IPMI = `which ipmi-sensors 2>/dev/null|sed 's/.*no ipmi-sensors//'`; + #$IPMI = `echo -n \$(which ipmi-sensors)`; +} +chomp($IPMI); +unless($IPMI){ exit 1; } + +if ($ARGV[0] && $ARGV[0] eq "autoconf"){ + if (-f $IPMI){ + print "yes\n"; + }else{ + print "no ($IPMI does not exist)\n"; + exit(1); + } +}else{ + my $cmd = "$IPMI|grep Temp"; + my @result = `$cmd`; + my (%val, $index); + $index=0; + #Four of these seem to be unlabled, I'm going to guess that they are the CPU(s) and HDD(s) + my @unknown = ('HDD0','HDD1','CPU0','CPU1'); + foreach my $line (@result) { + $line =~ s/\s+/ /g; + $line =~ s/\s$//g; + next if ($line eq ""); + my ($list, $field, $value, $state) = split(/\: /, $line); + #print "L: $list F: $field V: $value S: $state\n"; + if($field=~m/^(Temp|Ambient|Planar|Riser)/) { + my $f=$1; + if($f eq 'Temp'){ + $f = $unknown[$index]; + } + my @data = split / /, $value; + $data[2]=~s/^\(//; + $data[2]=~s/\)$//; + if($f){ + my($warn,$crit) = split/\//, $data[2]; + $val{$index}{'Probe Name'} = "$f"; + $val{$index}{'Reading'} = "$data[0]"; + $val{$index}{'Warning Threshold'} = "$warn"; + $val{$index}{'Critical Threshold'} = "$crit"; + $index++; + } + } + } + + if ($ARGV[0] && $ARGV[0] eq "config") { + print "graph_title IPMI sensors - Temperature Probes\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Temperature in Celsius\n"; + print "graph_category Sensors\n"; + foreach my $j (sort keys %val) { + print "probe_$j.label $val{$j}{'Probe Name'}\n"; + print "probe_$j.warning $val{$j}{'Warning Threshold'}\n"; + print "probe_$j.critical $val{$j}{'Critical Threshold'}\n"; + } + }else{ + foreach my $j (sort keys %val) { + if($val{$j}{'Reading'}){ + print "probe_$j.value $val{$j}{'Reading'}\n"; + } + } + } +} +exit(0); +