2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/thecus/snmp__thecus_fans

105 lines
2.5 KiB
Perl
Executable File

#!/usr/bin/perl -w
# -*- cperl -*-
=head1 NAME
snmp__thecus_fans - Munin plugin to retrive fanspeed readings from a Thecus
NAS device running SNMP.
=head1 APPLICABLE SYSTEMS
All Thecus NAS devices which have the third party NETSNMPD module installed.
This is available at http://www.fajo.de/main/thecus/modules/netsnmpd
=head1 CONFIGURATION
As a rule SNMP plugins need site specific configuration. The default
configuration (shown here) will only work on insecure sites/devices.
[snmp_*]
env.version 2
env.community public
In general SNMP is not very secure at all unless you use SNMP version
3 which supports authentication and privacy (encryption). But in any
case the community string for your devices should not be "public".
Please see 'perldoc Munin::Plugin::SNMP' for further configuration
information.
=head1 INTERPRETATION
The plugin reports the current fan speed readings as reported by the thecusIO
module.
=head1 MIB INFORMATION
Private MIB
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 VERSION
0.0.20120307
=head1 BUGS
None known.
=head1 AUTHOR
Copyright (C) 2011 - 2012 Andreas Thienemann <andreas@bawue.net>
Based on the snmp__uptime plugin as a template.
=head1 LICENSE
GPLv2 or (at your option) any later version.
=cut
use strict;
use Munin::Plugin::SNMP;
use vars qw($DEBUG);
$DEBUG = $ENV{'MUNIN_DEBUG'};
my $response;
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
print "index 1.3.6.1.4.1.14822.101.21.\n";
print "require 1.3.6.1.4.1.14822.101.21.5200.1.1.0 [0-9]\n";
print "require 1.3.6.1.4.1.14822.101.21.5200.1.2.0 [0-9]\n";
exit 0;
}
if (defined $ARGV[0] and $ARGV[0] eq "config") {
my ($host) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title Thecus Fans
graph_args --base 1000 -l 0
graph_vlabel RPM
graph_info This graph shows the RPMs of the fans as reported by the ThecusIO module.
graph_category sensors
fan1.label Fan 1
fan1.info Thecus CPU Fan
fan2.label Fan 2
fan2.info Thecus System Fan
";
exit 0;
}
my $session = Munin::Plugin::SNMP->session(-translate =>
[ -timeticks => 0x0 ]);
my $fan1 = $session->get_single ("1.3.6.1.4.1.14822.101.21.5200.1.1.0") || 'U';
my $fan2 = $session->get_single ("1.3.6.1.4.1.14822.101.21.5200.1.2.0") || 'U';
#print "Retrived uptime is '$uptime'\n" if $DEBUG;
print "fan1.value ", $fan1, "\n";
print "fan2.value ", $fan2, "\n";