~ubuntu-branches/ubuntu/trusty/nagios-plugins-contrib/trusty-proposed

« back to all changes in this revision

Viewing changes to check_hpasm/check_hpasm-4.6.3.2/plugins-scripts/HP/Proliant/Component/SNMP.pm

  • Committer: Package Import Robot
  • Author(s): Bernd Zeimetz, Bernd Zeimetz, Jan Wagner, Evgeni Golov
  • Date: 2013-06-14 20:53:49 UTC
  • Revision ID: package-import@ubuntu.com-20130614205349-34xiy38pm1hzpjoi
Tags: 7.20130614
[ Bernd Zeimetz ]
* [036816ff] Merge pull request #15 from evgeni/master
  check_packages should find security updates on the official security mirror too
* [658a2e93] Add check_checksums nagios plugin.
* [9d5d2056] Updating check_raid.
* [e3ec1293] Updating check_ssl_cert to 1.14.6
* [779543ef] Updating check_hpasm to 4.6.3.2
* [0c838ee9] Updating check_multipath to 0.1.9
* [bec11251] Updating check_whois to 1.13
* [8e0a65d0] Refreshing patches.
* [c0b88cdb] Auto update of debian/copyright
* [59648a17] Fix src link for check_hpasm
* [8c242d0f] Support pre-Wheezy versions of coretutils in check_checksums.
* [7d3d2a06] Update release date in changelog (gah!).
* [768e463b] Merge pull request #16 from evgeni/master
  check_libs: ignore /var/lib/postgresql/ and /var/log/
* [2b9aace5] Bumping standards-Verison, no changes needed.

[ Jan Wagner ]
* [3bb873e4] disable epn for check_rbl

[ Evgeni Golov ]
* [2a7ab4b8] check_libs: ignore /var/spool/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package HP::Proliant::Component::SNMP;
 
2
 
 
3
sub get_entries {
 
4
  my $self = shift;
 
5
  my $oids = shift;
 
6
  my $entry = shift;
 
7
  my $snmpwalk = $self->{rawdata};
 
8
  my @params = ();
 
9
  my @indices = SNMP::Utils::get_indices($snmpwalk, $oids->{$entry});
 
10
  foreach (@indices) {
 
11
    my @idx = @{$_};
 
12
    my %params = ( 
 
13
      runtime => $self->{runtime},
 
14
    );
 
15
    my $maxdimension = scalar(@idx) - 1;
 
16
    foreach my $idxnr (1..scalar(@idx)) {
 
17
      $params{'index'.$idxnr} = $_->[$idxnr - 1];
 
18
    }
 
19
    foreach my $oid (keys %{$oids}) {
 
20
      next if $oid =~ /Entry$/;
 
21
      next if $oid =~ /Value$/;
 
22
      if (exists $oids->{$oid.'Value'}) {
 
23
        $params{$oid} = SNMP::Utils::get_object_value(
 
24
            $snmpwalk, $oids->{$oid}, $oids->{$oid.'Value'}, @idx);
 
25
        if (! defined  $params{$oid}) {
 
26
          my $numerical_value = SNMP::Utils::get_object(
 
27
              $snmpwalk, $oids->{$oid}, @idx);
 
28
          if (! defined $numerical_value) {
 
29
            # maschine liefert schrott
 
30
            $params{$oid} = 'value_unknown';
 
31
          } else {
 
32
            $params{$oid} = 'value_'.SNMP::Utils::get_object(
 
33
                $snmpwalk, $oids->{$oid}, @idx);
 
34
          }
 
35
        }
 
36
      } else {  
 
37
        $params{$oid} = SNMP::Utils::get_object(
 
38
            $snmpwalk, $oids->{$oid}, @idx);
 
39
      }         
 
40
    }     
 
41
    push(@params, \%params);
 
42
  }
 
43
  return @params;
 
44
}
 
45
 
 
46
sub mib {
 
47
  my $self = shift;
 
48
  my $mib = shift;
 
49
  my $condition = {
 
50
      0 => 'other',
 
51
      1 => 'ok',
 
52
      2 => 'degraded',
 
53
      3 => 'failed',
 
54
  };
 
55
  my $MibRevMajor = $mib.'.1.0';
 
56
  my $MibRevMinor = $mib.'.2.0';
 
57
  my $MibRevCondition = $mib.'.3.0';
 
58
  return (
 
59
      $self->SNMP::Utils::get_object($self->{rawdata},
 
60
          $MibRevMajor),
 
61
      $self->SNMP::Utils::get_object($self->{rawdata},
 
62
          $MibRevMinor),
 
63
      $self->SNMP::Utils::get_object_value($self->{rawdata},
 
64
          $MibRevCondition, $condition));
 
65
};
 
66
 
 
67
1;