/usr/share/munin/plugins/snmp__sensors_fsc_bx_fan is in munin-plugins-core 2.0.19-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | #!/usr/bin/perl -w
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__sensors_fsc_bx_fan - Plugin to fetch fan data from the SNMP
agent on the management blade on Fujitsu Simens BX series blade
servers
=head1 LICENSE
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
=head1 AUTHOR
Copyright (C) 2004 Dagfinn Ilmari Mannsaaker
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=cut
use strict;
use Net::SNMP qw(oid_lex_sort);
use Munin::Plugin::SNMP;
# The OIDs we're after
my $fanBase = '1.3.6.1.4.1.7244.1.1.1.3.3.1.1';
# Subtables
my $fanNumber = 1;
my $fanStatus = 2;
my $fanDesignation = 3;
my $fanCurrentSpeed = 4;
my $fanMaximumSpeed = 5;
# Magic values
my $fanUnknown = 1;
my $fanDisabled = 2;
my $fanUnavailable = 99;
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
print "require $fanBase.\n";
# Require known, enabled and available fans
print "require $fanBase.$fanStatus. ^[3-9]|[1-8][0-9]|9[0-8]\$\n";
exit 0;
}
my ($session, $error) = Munin::Plugin::SNMP->session();
if ($error) {
die "# Error: $error\n";
}
my $fans = $session->get_hash(-baseoid => $fanBase,
-cols => { $fanNumber => 'number',
$fanStatus => 'status',
$fanCurrentSpeed => 'value',
$fanMaximumSpeed => 'warning',
$fanDesignation => 'label',
},
) or die $session->error();
for my $key (keys %$fans) {
my $fan = $fans->{$key};
# Delete sensors with unknown, disabled or unavailable status
delete $fans->{$key}
if $fan->{status} == $fanUnknown ||
$fan->{status} == $fanDisabled ||
$fan->{status} == $fanUnavailable;
}
if (defined $ARGV[0] and $ARGV[0] eq 'config') {
print <<EOM;
graph_title Fans
graph_args -l 0
graph_vlabel RPM
graph_category sensors
EOM
print 'graph_order ', join(' ', map { get_id($_) } oid_lex_sort keys %$fans), "\n";
print 'host_name ', $session->hostname(), "\n"
unless $session->hostname eq 'localhost';
for my $fan (keys %$fans) {
my $id = get_id($fan);
for my $key (qw(label warning)) {
print "$id.$key $fans->{$fan}{$key}\n";
}
print "$id.type GAUGE\n";
}
} else {
print get_id($_), '.value ', $fans->{$_}{value}, "\n"
for keys %$fans;
}
sub get_id {
(my $id = shift) =~ tr/\./_/;
return 'fan'.$id;
}
|