Changeset 499
- Timestamp:
- 11/23/04 17:59:38 (7 years ago)
- Files:
-
- trunk/node/node.d/snmp__sensors_fsc_bx_fan.in (modified) (2 diffs, 1 prop)
- trunk/node/node.d/snmp__sensors_fsc_bx_temp.in (modified) (2 diffs, 1 prop)
- trunk/node/node.d/snmp__sensors_fsc_fan.in (modified) (2 diffs, 1 prop)
- trunk/node/node.d/snmp__sensors_fsc_temp.in (modified) (2 diffs, 1 prop)
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 22 22 # 23 23 # $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 # 24 27 # Revision 1.4 2004/11/16 20:08:26 jimmyo 25 28 # License cleanups. … … 38 41 #%# capabilities=snmpconf 39 42 43 package Munin::Plugin::SNMP; 44 45 use Net::SNMP; 46 @ISA = qw(Net::SNMP); 47 48 sub 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 72 sub 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 93 package main; 94 40 95 use strict; 41 use Munin::Plugin::SNMP;42 96 use Net::SNMP qw(oid_lex_sort); 43 97 trunk/node/node.d/snmp__sensors_fsc_bx_temp.in
- Property cvs2svn:cvs-rev changed from 1.4 to 1.5
r431 r499 22 22 # 23 23 # $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 # 24 27 # Revision 1.4 2004/11/16 20:08:26 jimmyo 25 28 # License cleanups. … … 38 41 #%# capabilities=snmpconf 39 42 43 package Munin::Plugin::SNMP; 44 45 use Net::SNMP; 46 @ISA = qw(Net::SNMP); 47 48 sub 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 72 sub 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 93 package main; 94 40 95 use strict; 41 use Munin::Plugin::SNMP;42 96 use Net::SNMP qw(oid_lex_sort); 97 43 98 44 99 # 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 22 22 # 23 23 # $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 # 24 27 # Revision 1.4 2004/11/16 20:08:26 jimmyo 25 28 # License cleanups. … … 38 41 #%# capabilities=snmpconf 39 42 43 package Munin::Plugin::SNMP; 44 45 use Net::SNMP; 46 @ISA = qw(Net::SNMP); 47 48 sub 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 72 sub 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 93 package main; 94 40 95 use strict; 41 use Munin::Plugin::SNMP;42 96 use Net::SNMP qw(oid_lex_sort); 43 97 trunk/node/node.d/snmp__sensors_fsc_temp.in
- Property cvs2svn:cvs-rev changed from 1.4 to 1.5
r431 r499 22 22 # 23 23 # $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 # 24 27 # Revision 1.4 2004/11/16 20:08:26 jimmyo 25 28 # License cleanups. … … 38 41 #%# capabilities=snmpconf 39 42 43 package Munin::Plugin::SNMP; 44 45 use Net::SNMP; 46 @ISA = qw(Net::SNMP); 47 48 sub 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 72 sub 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 93 package main; 94 40 95 use strict; 41 use Munin::Plugin::SNMP;42 96 use Net::SNMP qw(oid_lex_sort); 97 98 43 99 44 100 # The OIDs we're after
