mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
110 lines
3.7 KiB
Plaintext
110 lines
3.7 KiB
Plaintext
|
#! /usr/bin/perl -w
|
||
|
#
|
||
|
# Copyright (C) 2008 Rackspace US, Inc. <http://www.rackspace.com>
|
||
|
#
|
||
|
# 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 <galstrom21@gmail.com>
|
||
|
# 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);
|
||
|
|