~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/plugins-scripts/HP/Proliant/Component/TemperatureSubsystem/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::TemperatureSubsystem::SNMP;
2
 
our @ISA = qw(HP::Proliant::Component::TemperatureSubsystem
3
 
    HP::Proliant::Component::SNMP);
4
 
 
5
 
use strict;
6
 
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
7
 
 
8
 
sub new {
9
 
  my $class = shift;
10
 
  my %params = @_;
11
 
  my $self = {
12
 
    runtime => $params{runtime},
13
 
    rawdata => $params{rawdata},
14
 
    temperatures => [],
15
 
    blacklisted => 0,
16
 
    info => undef,
17
 
    extendedinfo => undef,
18
 
  };
19
 
  bless $self, $class;
20
 
  $self->overall_init(%params);
21
 
  $self->init(%params);
22
 
  return $self;
23
 
}
24
 
 
25
 
sub overall_init {
26
 
  my $self = shift;
27
 
  my %params = @_;
28
 
  my $snmpwalk = $params{rawdata};
29
 
  # overall
30
 
  my $cpqHeThermalTempStatus  = '1.3.6.1.4.1.232.6.2.6.3.0';
31
 
  my $cpqHeThermalTempStatusValue = {
32
 
    1 => 'other',
33
 
    2 => 'ok',
34
 
    3 => 'degraded',
35
 
    4 => 'failed',
36
 
  };
37
 
  $self->{tempstatus} = lc SNMP::Utils::get_object_value(
38
 
      $snmpwalk, $cpqHeThermalTempStatus,
39
 
      $cpqHeThermalTempStatusValue);
40
 
  $self->{tempstatus} |= lc $self->{tempstatus};
41
 
}
42
 
 
43
 
sub init {
44
 
  my $self = shift;
45
 
  my %params = @_;
46
 
  my $snmpwalk = $self->{rawdata};
47
 
  my $oids = {
48
 
      cpqHeTemperatureEntry => "1.3.6.1.4.1.232.6.2.6.8.1",
49
 
      cpqHeTemperatureChassis => "1.3.6.1.4.1.232.6.2.6.8.1.1",
50
 
      cpqHeTemperatureIndex => "1.3.6.1.4.1.232.6.2.6.8.1.2",
51
 
      cpqHeTemperatureLocale => "1.3.6.1.4.1.232.6.2.6.8.1.3",
52
 
      cpqHeTemperatureCelsius => "1.3.6.1.4.1.232.6.2.6.8.1.4",
53
 
      cpqHeTemperatureThresholdCelsius => "1.3.6.1.4.1.232.6.2.6.8.1.5",
54
 
      cpqHeTemperatureCondition => "1.3.6.1.4.1.232.6.2.6.8.1.6",
55
 
      cpqHeTemperatureThresholdType => "1.3.6.1.4.1.232.6.2.6.8.1.7",
56
 
      cpqHeTemperatureLocaleValue => {
57
 
          1 => "other",
58
 
          2 => "unknown",
59
 
          3 => "system",
60
 
          4 => "systemBoard",
61
 
          5 => "ioBoard",
62
 
          6 => "cpu",
63
 
          7 => "memory",
64
 
          8 => "storage",
65
 
          9 => "removableMedia",
66
 
          10 => "powerSupply",
67
 
          11 => "ambient",
68
 
          12 => "chassis",
69
 
          13 => "bridgeCard",
70
 
      },
71
 
      cpqHeTemperatureConditionValue => {
72
 
          1 => 'other',
73
 
          2 => 'ok',
74
 
          3 => 'degraded',
75
 
          4 => 'failed',
76
 
      },
77
 
      cpqHeTemperatureThresholdTypeValue => {
78
 
          1 => 'other',
79
 
          5 => 'blowout',
80
 
          9 => 'caution',
81
 
          15 => 'critical',
82
 
      },
83
 
  };
84
 
  # INDEX { cpqHeTemperatureChassis, cpqHeTemperatureIndex }
85
 
  foreach ($self->get_entries($oids, 'cpqHeTemperatureEntry')) {
86
 
    # sieht aus, als wurden die gar nicht existieren.
87
 
    # im ilo4 werden sie als n/a angezeigt
88
 
    next if $_->{cpqHeTemperatureThresholdType} eq "caution" && $_->{cpqHeTemperatureThresholdCelsius} == 0;
89
 
    push(@{$self->{temperatures}},
90
 
        HP::Proliant::Component::TemperatureSubsystem::Temperature->new(%{$_}));
91
 
  }
92
 
}
93
 
 
94
 
sub overall_check {
95
 
  my $self = shift;
96
 
  my $result = 0;
97
 
  $self->blacklist('ots', '');
98
 
  if ($self->{tempstatus}) {
99
 
    if ($self->{tempstatus} eq "ok") {
100
 
      $result = 0;
101
 
      $self->add_info('all temp sensors are within normal operating range');
102
 
    } elsif ($self->{tempstatus} eq "degraded") {
103
 
      $result = 1;
104
 
      $self->add_info('a temp sensor is outside of normal operating range');
105
 
    } elsif ($self->{tempstatus} eq "failed") {
106
 
      $result = 2;
107
 
      $self->add_info('a temp sensor detects a condition that could permanently
108
 
damage the system');
109
 
    } elsif ($self->{tempstatus} eq "other") {
110
 
      $result = 0;
111
 
      $self->add_info('temp sensing is not supported by this system or driver');
112
 
    }
113
 
  } else {
114
 
    $result = 0;
115
 
    $self->add_info('no global temp status found');
116
 
  }
117
 
}
118
 
 
119
 
1;