From 92c1c803bbe14beb27a401d33988c4acb6819a0b Mon Sep 17 00:00:00 2001 From: Justin Shepherd Date: Wed, 24 Oct 2007 20:26:11 +0200 Subject: [PATCH] Initial version --- plugins/other/omreport_temp | 109 ++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100755 plugins/other/omreport_temp diff --git a/plugins/other/omreport_temp b/plugins/other/omreport_temp new file mode 100755 index 00000000..ddf2c346 --- /dev/null +++ b/plugins/other/omreport_temp @@ -0,0 +1,109 @@ +#! /usr/bin/perl -w +# +# Copyright (C) 2008 Rackspace US, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2 dated June, +# 1991. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see http://www.gnu.org/licenses/gpl.txt +# +# +# This plugin will graph the chassis temp sensors on a Dell PowerEdge Server +# via the omreport tool. It has been tested on the following chassis: +# +# PE2650/6650 +# PE2850/6850 +# PE2950 +# +# To enable, link omreport_temps to this file. E.g. +# +# ln -s /usr/share/node/node/plugins/omreport_temps /etc/munin/plugins/omreport_temps +# +# Configuration parameters for /etc/munin/plugin-conf.d/munin-node +# +# [omreport_*] +# user - User that has permissions to run the omreport binary +# env.omreport - Path to the omreport binary +# +# Parameters: +# +# config +# autoconf +# +# Author: Justin Shepherd +# Revision: 1.5 2008/10/22 +# +#%# family=auto +#%# capabilities=autoconf + +use strict; + +my $omreport = $ENV{"omreport"} || "/usr/bin/omreport"; + +if ($ARGV[0] && $ARGV[0] eq "autoconf") { + if (-f $omreport) { + print "yes\n"; + } # end if + else { + print "no ($omreport does not exist)\n"; + exit(1); + } # end else +} # end if +else { + my $cmd = "$omreport chassis temps"; + my @result = `$cmd`; + my (%val, $index); + foreach my $line (@result) { + $line =~ s/\s+/ /g; + $line =~ s/\s$//g; + next if ($line eq ""); + my ($field, $value) = split(/ \: /, $line); + if ($field eq "Index") { + $val{$value} = {}; + $index = $value; + } # end if + elsif ($field eq "Probe Name") { + $value =~ s/ Temp//g; + $val{$index}{$field} = "$value"; + } # end elsif + elsif ($field eq "Reading") { + $value =~ s/ C//g; + $val{$index}{"$field"} = "$value"; + } # end elsif + elsif ($field eq "Maximum Warning Threshold") { + $value =~ s/ C//g; + $val{$index}{"Warning Threshold"} = "$value"; + } # end elsif + elsif ($field eq "Maximum Failure Threshold") { + $value =~ s/ C//g; + $val{$index}{"Critical Threshold"} = "$value"; + } # end elsif + } # end foreach + + if ($ARGV[0] && $ARGV[0] eq "config") { + print "graph_title OpenManage - 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"; + } # end foreach + } # end if + else { + foreach my $j (sort keys %val) { + print "probe_$j.value $val{$j}{\"Reading\"}\n"; + } # end foreach + } # end else +} # end else +exit(0); +