Repository
Munin (contrib)
Last change
2018-08-02
Graph Categories
Family
snmpauto
Capabilities
Keywords
Language
Perl
License
GPL-2.0-only
Authors

snmp__sfsnmp_fan

Name

snmp__sfsnmp_fan - Munin plugin for measuring fanspeed on a windowssystem running SpeedFan and sfsnmp

Applicable Systems

Windows-system running SpeedFan and the sfsnmp extension

Configuration

Example config: [snmp_twinspark_sfsnmp_*] env.fan1 CPU env.fan7.ignore true

Plugin is linked using hostname of monitored system:

ln -s /usr/share/munin/plugins/snmp__sfsnmp_fan /etc/munin/plugins/snmp_<hostname>_sfsnmp_fan

Magic Markers

#%# family=snmpauto #%# capabilities=snmpconf

Author

Nils Henrik Tvetene nils@tvetene.net

License

GPLv2

#!/usr/bin/perl
# -*- perl -*-
#
# snmp__sfsnmp_fan - Munin plugin for measuring fan on a windowssystem running SpeedFan and sfsnmp
# Copyright (C) 2010 Nils Henrik Tvetene
#
# Author: Nils Henrik Tvetene <nils@tvetene.net>
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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 NAME

snmp__sfsnmp_fan - Munin plugin for measuring fanspeed on a windowssystem running SpeedFan and sfsnmp

=head1 APPLICABLE SYSTEMS

Windows-system running SpeedFan and the sfsnmp extension

=head1 CONFIGURATION

Example config:
   [snmp_twinspark_sfsnmp_*]
      env.fan1 CPU
      env.fan7.ignore true

Plugin is linked using hostname of monitored system:

ln -s /usr/share/munin/plugins/snmp__sfsnmp_fan /etc/munin/plugins/snmp_<hostname>_sfsnmp_fan

=head1 MAGIC MARKERS

#%# family=snmpauto
#%# capabilities=snmpconf


=head1 AUTHOR

Nils Henrik Tvetene <nils@tvetene.net>

=head1 LICENSE

GPLv2

=cut

use strict;
use warnings;
use Munin::Plugin::SNMP;
use vars qw($DEBUG);

$DEBUG = $ENV{'MUNIN_DEBUG'};

# OIDs used
# 1.3.6.1.4.1.30503.1.1.2 number of fans
# 1.3.6.1.4.1.30503.1.3.x where x is 1 => above number

if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
    print "number 1.3.6.1.4.1.30503.1.1.2\n";
    print "index 1.3.6.1.4.1.30503.1.3.\n";
    exit 0;
}

my $session = Munin::Plugin::SNMP->session();
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
my ($idx, $numFans, @fan, @label);

$numFans = $session->get_single('1.3.6.1.4.1.30503.1.1.2');

if (defined $ARGV[0] and $ARGV[0] eq "config") {
    print "host_name $host\n" unless $host eq 'localhost';
    print "graph_title $host fan\n";
    print "graph_args --base 1000 --lower-limit 1000\n";
    print "graph_scale no\n";
    print "graph_printf %3.0lf\n";
    print "graph_vlabel fan RPM\n";
    print "graph_category sensors\n";
    print "graph_info This graph shows the fans on host $host\n";
    foreach $idx ( 0..$numFans-1 ) {
        $label[$idx] = exists $ENV{"fan".($idx+1)} ? $ENV{"fan".($idx+1)} : "fan".($idx+1);
        print "fan".($idx+1).".info ".$label[$idx]." fan in RPM's.\n";

        print "fan".($idx+1).".graph no\n" if exists $ENV{"fan".($idx+1).".ignore"};

        print "fan".($idx+1).".type GAUGE\n";
        print "fan".($idx+1).".label $label[$idx]\n";
        print "fan".($idx+1).".min 1000\n";
    }

    exit 0;
}

foreach $idx ( 0..$numFans-1 ) {
    $fan[$idx] = $session->get_single('1.3.6.1.4.1.30503.1.3.'.($idx+1));
    print "fan".($idx+1).".value $fan[$idx]\n";
}

exit 0;

__END__