root / plugins / sensors / omreport_fan_speed @ 97cf6d32
Historique | Voir | Annoter | Télécharger (3,88 ko)
| 1 | 56a35d72 | Justin Shepherd | #! /usr/bin/perl -w |
|---|---|---|---|
| 2 | # |
||
| 3 | # Copyright (C) 2008 Rackspace US, Inc. <http://www.rackspace.com> |
||
| 4 | # |
||
| 5 | # This program is free software; you can redistribute it and/or |
||
| 6 | # modify it under the terms of the GNU General Public License |
||
| 7 | # as published by the Free Software Foundation; version 2 dated June, |
||
| 8 | # 1991. |
||
| 9 | # |
||
| 10 | # This program is distributed in the hope that it will be useful, |
||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 13 | # GNU General Public License for more details. |
||
| 14 | # |
||
| 15 | # You should have received a copy of the GNU General Public License |
||
| 16 | # along with this program; if not, see http://www.gnu.org/licenses/gpl.txt |
||
| 17 | # |
||
| 18 | # |
||
| 19 | # This plugin will graph the chassis fan sensors on a Dell PowerEdge Server |
||
| 20 | # via the omreport tool. It has been tested on the following chassis: |
||
| 21 | # |
||
| 22 | # PE2650/6650 |
||
| 23 | # PE2850/6850 |
||
| 24 | # PE2950 |
||
| 25 | # |
||
| 26 | # To enable, link omreport_fan_speed to this file. E.g. |
||
| 27 | # |
||
| 28 | # ln -s /usr/share/node/node/plugins/omreport_fan_speed /etc/munin/plugins/omreport_fan_speed |
||
| 29 | # |
||
| 30 | # Configuration parameters for /etc/munin/plugin-conf.d/munin-node |
||
| 31 | # |
||
| 32 | # [omreport_*] |
||
| 33 | # user - User that has permissions to run the omreport binary |
||
| 34 | # env.omreport - Path to the omreport binary |
||
| 35 | # |
||
| 36 | # Parameters: |
||
| 37 | # |
||
| 38 | # config |
||
| 39 | # autoconf |
||
| 40 | # |
||
| 41 | # Author: Justin Shepherd <galstrom21@gmail.com> |
||
| 42 | # Revision: 1.5 2008/10/22 |
||
| 43 | # |
||
| 44 | #%# family=auto |
||
| 45 | #%# capabilities=autoconf |
||
| 46 | |||
| 47 | use strict; |
||
| 48 | |||
| 49 | my $omreport = $ENV{"omreport"} || "/usr/bin/omreport";
|
||
| 50 | |||
| 51 | if ($ARGV[0] && $ARGV[0] eq "autoconf") {
|
||
| 52 | if (-f $omreport) {
|
||
| 53 | print "yes\n"; |
||
| 54 | } |
||
| 55 | else {
|
||
| 56 | print "no ($omreport does not exist)\n"; |
||
| 57 | exit(1); |
||
| 58 | } |
||
| 59 | } # end if |
||
| 60 | else {
|
||
| 61 | my $cmd = "$omreport chassis fans"; |
||
| 62 | my @result = `$cmd`; |
||
| 63 | my (%val, $index); |
||
| 64 | foreach my $line (@result) {
|
||
| 65 | $line =~ s/\s+/ /g; |
||
| 66 | $line =~ s/\s$//g; |
||
| 67 | next if ($line eq ""); |
||
| 68 | my ($field, $value) = split(/ \: /, $line); |
||
| 69 | if ($field eq "Index") {
|
||
| 70 | $val{$value} = {};
|
||
| 71 | $index = $value; |
||
| 72 | } |
||
| 73 | elsif ($field eq "Probe Name") {
|
||
| 74 | $value =~ s/ RPM//g; |
||
| 75 | $val{$index}{$field} = "$value";
|
||
| 76 | } |
||
| 77 | elsif ($field eq "Reading") {
|
||
| 78 | $value =~ s/ RPM//g; |
||
| 79 | $val{$index}{"$field"} = "$value";
|
||
| 80 | } |
||
| 81 | elsif ($field eq "Maximum Warning Threshold") {
|
||
| 82 | $value =~ s/ RPM//g; |
||
| 83 | $val{$index}{"Warning Threshold"} = "$value";
|
||
| 84 | } |
||
| 85 | elsif ($field eq "Maximum Failure Threshold") {
|
||
| 86 | $value =~ s/ RPM//g; |
||
| 87 | $val{$index}{"Critical Threshold"} = "$value";
|
||
| 88 | } |
||
| 89 | } |
||
| 90 | |||
| 91 | if ($ARGV[0] && $ARGV[0] eq "config") {
|
||
| 92 | print "graph_title OpenManage - Fan Probes\n"; |
||
| 93 | print "graph_args --base 1000 -l 0\n"; |
||
| 94 | print "graph_vlabel Speed in RPMs\n"; |
||
| 95 | print "graph_category Sensors\n"; |
||
| 96 | foreach my $j (sort keys %val) {
|
||
| 97 | print "fan_$j.label $val{$j}{\"Probe Name\"}\n";
|
||
| 98 | if ($val{$j}{"Warning Threshold"} !~ m/\[N\/A\]/i) {
|
||
| 99 | print "fan_$j.warning " . |
||
| 100 | "$val{$j}{\"Warning Threshold\"}\n";
|
||
| 101 | } |
||
| 102 | if ($val{$j}{"Critical Threshold"} !~ m/\[N\/A\]/i) {
|
||
| 103 | print "fan_$j.critical " . |
||
| 104 | "$val{$j}{\"Critical Threshold\"}\n";
|
||
| 105 | } |
||
| 106 | } |
||
| 107 | } |
||
| 108 | else {
|
||
| 109 | foreach my $j (sort keys %val) {
|
||
| 110 | print "fan_$j.value $val{$j}{\"Reading\"}\n";
|
||
| 111 | } |
||
| 112 | } |
||
| 113 | } |
||
| 114 | exit(0); |
