#!/usr/bin/perl # -*- perl -*- # # snmp__sfsnmp_volt - Munin plugin for measuring volt on a windowssystem running SpeedFan and sfsnmp # Copyright (C) 2010 Nils Henrik Tvetene # # Author: Nils Henrik Tvetene # # 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_volt - Munin plugin for measuring volts 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.volt1 Vcore env.volt3.ignore true Plugin is linked using hostname of monitored system: ln -s /usr/share/munin/plugins/snmp__sfsnmp_volt /etc/munin/plugins/snmp__sfsnmp_volt =head1 MAGIC MARKERS #%# family=snmpauto #%# capabilities=snmpconf =head1 AUTHOR Nils Henrik Tvetene =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.3 number of voltages # 1.3.6.1.4.1.30503.1.4.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.3\n"; print "index 1.3.6.1.4.1.30503.1.4.\n"; exit 0; } my $session = Munin::Plugin::SNMP->session(); my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session(); my ($idx, $numVolts, @volt, @label); $numVolts = $session->get_single('1.3.6.1.4.1.30503.1.1.3'); if (defined $ARGV[0] and $ARGV[0] eq "config") { print "host_name $host\n" unless $host eq 'localhost'; print "graph_title $host volt\n"; print "graph_args --base 1000 --lower-limit 0 --upper-limit 13\n"; print "graph_scale no\n"; print "graph_vlabel Volt\n"; print "graph_category sensors\n"; print "graph_info This graph shows the volt on host $host\n"; foreach $idx ( 0..$numVolts-1 ) { $label[$idx] = exists $ENV{"volt".($idx+1)} ? $ENV{"volt".($idx+1)} : "volt".($idx+1); print "volt".($idx+1).".info ".$label[$idx]." volt in Celsius.\n"; print "volt".($idx+1).".graph no\n" if exists $ENV{"volt".($idx+1).".ignore"}; print "volt".($idx+1).".type GAUGE\n"; print "volt".($idx+1).".label $label[$idx]\n"; print "volt".($idx+1).".cdef volt".($idx+1).",100,/\n"; print "volt".($idx+1).".min 30\n"; } exit 0; } foreach $idx ( 0..$numVolts-1 ) { $volt[$idx] = $session->get_single('1.3.6.1.4.1.30503.1.4.'.($idx+1)); print "volt".($idx+1).".value $volt[$idx]\n"; } exit 0; __END__