Changeset 499

Show
Ignore:
Timestamp:
11/23/04 17:59:38 (7 years ago)
Author:
jimmyo
Message:

Include SNMP.pm in the files. We don't want any perl modules in the node for the 1.2 series.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/node/node.d/snmp__sensors_fsc_bx_fan.in

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r431 r499  
    2222# 
    2323# $Log$ 
     24# Revision 1.5  2004/11/23 16:59:38  jimmyo 
     25# Include SNMP.pm in the files. We don't want any perl modules in the node for the 1.2 series. 
     26# 
    2427# Revision 1.4  2004/11/16 20:08:26  jimmyo 
    2528# License cleanups. 
     
    3841#%# capabilities=snmpconf 
    3942 
     43package Munin::Plugin::SNMP; 
     44 
     45use Net::SNMP; 
     46@ISA = qw(Net::SNMP); 
     47 
     48sub session { 
     49    my $class = shift; 
     50    my $host      = $ENV{host}      || undef; 
     51    my $port      = $ENV{port}      || 161; 
     52    my $community = $ENV{community} || 'public'; 
     53    my $version   = $ENV{version}   || undef; 
     54 
     55    if ($0 =~ /^(?:.*\/)?snmp_([^_]+)_/) { 
     56        $host = $1; 
     57        if ($host =~ /^([^:]+):(\d+)$/) { 
     58            $host = $1; 
     59            $port = $2; 
     60        } 
     61    } elsif (!defined($host)) { 
     62        return unless wantarray; # Scalar or void context 
     63        return (undef, 'Couldn not find monitoring target.'); # Array context 
     64    } 
     65 
     66    return $class->SUPER::session(-hostname  => $host, 
     67                                  -community => $community, 
     68                                  -port      => $port, 
     69                                  ($version ? (-version => $version) : ())); 
     70} 
     71 
     72sub get_hash { 
     73    my $self = shift; 
     74    my %args = @_; 
     75    my %ret; 
     76     
     77    my $base = $args{'-baseoid'}; 
     78    my $cols = delete $args{'-cols'} or return; 
     79 
     80    my $table = $self->get_table(%args) 
     81      or return; 
     82 
     83    my $subtabs = join '|', keys %$cols; 
     84    my $re = qr/^\Q$base.\E($subtabs)\.(.*)/; 
     85    for my $key (keys %$table) { 
     86        $key =~ $re; 
     87        next unless defined($1 && $2); 
     88        $ret{$2}{$cols->{$1}} = $table->{$key}; 
     89    } 
     90    return \%ret; 
     91} 
     92 
     93package main; 
     94 
    4095use strict; 
    41 use Munin::Plugin::SNMP; 
    4296use Net::SNMP qw(oid_lex_sort); 
    4397 
  • trunk/node/node.d/snmp__sensors_fsc_bx_temp.in

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r431 r499  
    2222# 
    2323# $Log$ 
     24# Revision 1.5  2004/11/23 16:59:38  jimmyo 
     25# Include SNMP.pm in the files. We don't want any perl modules in the node for the 1.2 series. 
     26# 
    2427# Revision 1.4  2004/11/16 20:08:26  jimmyo 
    2528# License cleanups. 
     
    3841#%# capabilities=snmpconf 
    3942 
     43package Munin::Plugin::SNMP; 
     44 
     45use Net::SNMP; 
     46@ISA = qw(Net::SNMP); 
     47 
     48sub session { 
     49    my $class = shift; 
     50    my $host      = $ENV{host}      || undef; 
     51    my $port      = $ENV{port}      || 161; 
     52    my $community = $ENV{community} || 'public'; 
     53    my $version   = $ENV{version}   || undef; 
     54 
     55    if ($0 =~ /^(?:.*\/)?snmp_([^_]+)_/) { 
     56        $host = $1; 
     57        if ($host =~ /^([^:]+):(\d+)$/) { 
     58            $host = $1; 
     59            $port = $2; 
     60        } 
     61    } elsif (!defined($host)) { 
     62        return unless wantarray; # Scalar or void context 
     63        return (undef, 'Couldn not find monitoring target.'); # Array context 
     64    } 
     65 
     66    return $class->SUPER::session(-hostname  => $host, 
     67                                  -community => $community, 
     68                                  -port      => $port, 
     69                                  ($version ? (-version => $version) : ())); 
     70} 
     71 
     72sub get_hash { 
     73    my $self = shift; 
     74    my %args = @_; 
     75    my %ret; 
     76     
     77    my $base = $args{'-baseoid'}; 
     78    my $cols = delete $args{'-cols'} or return; 
     79 
     80    my $table = $self->get_table(%args) 
     81      or return; 
     82 
     83    my $subtabs = join '|', keys %$cols; 
     84    my $re = qr/^\Q$base.\E($subtabs)\.(.*)/; 
     85    for my $key (keys %$table) { 
     86        $key =~ $re; 
     87        next unless defined($1 && $2); 
     88        $ret{$2}{$cols->{$1}} = $table->{$key}; 
     89    } 
     90    return \%ret; 
     91} 
     92 
     93package main; 
     94 
    4095use strict; 
    41 use Munin::Plugin::SNMP; 
    4296use Net::SNMP qw(oid_lex_sort); 
     97 
    4398 
    4499# The OIDs we're after 
  • trunk/node/node.d/snmp__sensors_fsc_fan.in

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r431 r499  
    2222# 
    2323# $Log$ 
     24# Revision 1.5  2004/11/23 16:59:38  jimmyo 
     25# Include SNMP.pm in the files. We don't want any perl modules in the node for the 1.2 series. 
     26# 
    2427# Revision 1.4  2004/11/16 20:08:26  jimmyo 
    2528# License cleanups. 
     
    3841#%# capabilities=snmpconf 
    3942 
     43package Munin::Plugin::SNMP; 
     44 
     45use Net::SNMP; 
     46@ISA = qw(Net::SNMP); 
     47 
     48sub session { 
     49    my $class = shift; 
     50    my $host      = $ENV{host}      || undef; 
     51    my $port      = $ENV{port}      || 161; 
     52    my $community = $ENV{community} || 'public'; 
     53    my $version   = $ENV{version}   || undef; 
     54 
     55    if ($0 =~ /^(?:.*\/)?snmp_([^_]+)_/) { 
     56        $host = $1; 
     57        if ($host =~ /^([^:]+):(\d+)$/) { 
     58            $host = $1; 
     59            $port = $2; 
     60        } 
     61    } elsif (!defined($host)) { 
     62        return unless wantarray; # Scalar or void context 
     63        return (undef, 'Couldn not find monitoring target.'); # Array context 
     64    } 
     65 
     66    return $class->SUPER::session(-hostname  => $host, 
     67                                  -community => $community, 
     68                                  -port      => $port, 
     69                                  ($version ? (-version => $version) : ())); 
     70} 
     71 
     72sub get_hash { 
     73    my $self = shift; 
     74    my %args = @_; 
     75    my %ret; 
     76     
     77    my $base = $args{'-baseoid'}; 
     78    my $cols = delete $args{'-cols'} or return; 
     79 
     80    my $table = $self->get_table(%args) 
     81      or return; 
     82 
     83    my $subtabs = join '|', keys %$cols; 
     84    my $re = qr/^\Q$base.\E($subtabs)\.(.*)/; 
     85    for my $key (keys %$table) { 
     86        $key =~ $re; 
     87        next unless defined($1 && $2); 
     88        $ret{$2}{$cols->{$1}} = $table->{$key}; 
     89    } 
     90    return \%ret; 
     91} 
     92 
     93package main; 
     94 
    4095use strict; 
    41 use Munin::Plugin::SNMP; 
    4296use Net::SNMP qw(oid_lex_sort); 
    4397 
  • trunk/node/node.d/snmp__sensors_fsc_temp.in

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r431 r499  
    2222# 
    2323# $Log$ 
     24# Revision 1.5  2004/11/23 16:59:38  jimmyo 
     25# Include SNMP.pm in the files. We don't want any perl modules in the node for the 1.2 series. 
     26# 
    2427# Revision 1.4  2004/11/16 20:08:26  jimmyo 
    2528# License cleanups. 
     
    3841#%# capabilities=snmpconf 
    3942 
     43package Munin::Plugin::SNMP; 
     44 
     45use Net::SNMP; 
     46@ISA = qw(Net::SNMP); 
     47 
     48sub session { 
     49    my $class = shift; 
     50    my $host      = $ENV{host}      || undef; 
     51    my $port      = $ENV{port}      || 161; 
     52    my $community = $ENV{community} || 'public'; 
     53    my $version   = $ENV{version}   || undef; 
     54 
     55    if ($0 =~ /^(?:.*\/)?snmp_([^_]+)_/) { 
     56        $host = $1; 
     57        if ($host =~ /^([^:]+):(\d+)$/) { 
     58            $host = $1; 
     59            $port = $2; 
     60        } 
     61    } elsif (!defined($host)) { 
     62        return unless wantarray; # Scalar or void context 
     63        return (undef, 'Couldn not find monitoring target.'); # Array context 
     64    } 
     65 
     66    return $class->SUPER::session(-hostname  => $host, 
     67                                  -community => $community, 
     68                                  -port      => $port, 
     69                                  ($version ? (-version => $version) : ())); 
     70} 
     71 
     72sub get_hash { 
     73    my $self = shift; 
     74    my %args = @_; 
     75    my %ret; 
     76     
     77    my $base = $args{'-baseoid'}; 
     78    my $cols = delete $args{'-cols'} or return; 
     79 
     80    my $table = $self->get_table(%args) 
     81      or return; 
     82 
     83    my $subtabs = join '|', keys %$cols; 
     84    my $re = qr/^\Q$base.\E($subtabs)\.(.*)/; 
     85    for my $key (keys %$table) { 
     86        $key =~ $re; 
     87        next unless defined($1 && $2); 
     88        $ret{$2}{$cols->{$1}} = $table->{$key}; 
     89    } 
     90    return \%ret; 
     91} 
     92 
     93package main; 
     94 
    4095use strict; 
    41 use Munin::Plugin::SNMP; 
    4296use Net::SNMP qw(oid_lex_sort); 
     97 
     98 
    4399 
    44100# The OIDs we're after