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

« back to all changes in this revision

Viewing changes to check_hpasm/check_hpasm-4.6.3/plugins-scripts/HP/Proliant/Component/AsrSubsystem/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::AsrSubsystem::SNMP;
2
 
our @ISA = qw(HP::Proliant::Component::AsrSubsystem
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
 
    blacklisted => 0,
15
 
    info => undef,
16
 
    extendedinfo => undef,
17
 
  };
18
 
  bless $self, $class;
19
 
  $self->overall_init(%params);
20
 
  return $self;
21
 
}
22
 
 
23
 
sub overall_init {
24
 
  my $self = shift;
25
 
  my %params = @_;
26
 
  my $snmpwalk = $params{rawdata};
27
 
  my $cpqHeAsrStatus = "1.3.6.1.4.1.232.6.2.5.1.0";
28
 
  my $cpqHeAsrStatusValue = {
29
 
    1 => "other",
30
 
    2 => "notAvailable",
31
 
    3 => "disabled",
32
 
    4 => "enabled",
33
 
  };
34
 
  my $cpqHeAsrCondition = "1.3.6.1.4.1.232.6.2.5.17.0";
35
 
  my $cpqHeAsrConditionValue = {
36
 
    1 => "other",
37
 
    2 => "ok",
38
 
    3 => "degraded",
39
 
    4 => "failed",
40
 
  };
41
 
  $self->{asrcondition} = SNMP::Utils::get_object_value(
42
 
      $snmpwalk, $cpqHeAsrCondition,
43
 
      $cpqHeAsrConditionValue);
44
 
  $self->{asrstatus} = SNMP::Utils::get_object_value(
45
 
      $snmpwalk, $cpqHeAsrStatus,
46
 
      $cpqHeAsrStatusValue);
47
 
  $self->{asrcondition} |= lc $self->{asrcondition};
48
 
  $self->{asrstatus} |= lc $self->{asrstatus};
49
 
}
50
 
 
51
 
sub overall_check {
52
 
  my $self = shift;
53
 
  my $result = 0;
54
 
  $self->blacklist('asr', '');
55
 
  if ($self->{asrstatus} and $self->{asrstatus} eq "enabled") {
56
 
    my $info = sprintf 'ASR overall condition is %s', $self->{asrcondition};
57
 
    if ($self->{asrcondition} eq "degraded") {
58
 
      $self->add_message(WARNING, $info);
59
 
    } elsif ($self->{asrcondition} eq "failed") {
60
 
      $self->add_message(CRITICAL, $info);
61
 
    }
62
 
    $self->add_info($info);
63
 
  } else {
64
 
    $self->add_info('This system does not have ASR.');
65
 
  }
66
 
}
67
 
 
68
 
1;