~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/BladeSystem/Component/NetConnectorSubsystem.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::BladeSystem::Component::NetConnectorSubsystem;
2
 
our @ISA = qw(HP::BladeSystem::Component);
3
 
 
4
 
use strict;
5
 
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
6
 
 
7
 
sub new {
8
 
  my $class = shift;
9
 
  my %params = @_;
10
 
  my $self = {
11
 
    runtime => $params{runtime},
12
 
    rawdata => $params{rawdata},
13
 
    method => $params{method},
14
 
    net_connectors => [],
15
 
    blacklisted => 0,
16
 
    info => undef,
17
 
    extendedinfo => undef,
18
 
  };
19
 
  bless $self, $class;
20
 
  $self->init();
21
 
  return $self;
22
 
}
23
 
 
24
 
sub init {
25
 
  my $self = shift;
26
 
  my $oids = {
27
 
      cpqRackNetConnectorEntry => '1.3.6.1.4.1.232.22.2.6.1.1.1',
28
 
      cpqRackNetConnectorRack => '1.3.6.1.4.1.232.22.2.6.1.1.1.1',
29
 
      cpqRackNetConnectorChassis => '1.3.6.1.4.1.232.22.2.6.1.1.1.2',
30
 
      cpqRackNetConnectorIndex => '1.3.6.1.4.1.232.22.2.6.1.1.1.3',
31
 
      cpqRackNetConnectorEnclosureName => '1.3.6.1.4.1.232.22.2.6.1.1.1.4',
32
 
      cpqRackNetConnectorName => '1.3.6.1.4.1.232.22.2.6.1.1.1.5',
33
 
      cpqRackNetConnectorModel => '1.3.6.1.4.1.232.22.2.6.1.1.1.6',
34
 
      cpqRackNetConnectorSerialNum => '1.3.6.1.4.1.232.22.2.6.1.1.1.7',
35
 
      cpqRackNetConnectorPartNumber => '1.3.6.1.4.1.232.22.2.6.1.1.1.8',
36
 
      cpqRackNetConnectorSparePartNumber => '1.3.6.1.4.1.232.22.2.6.1.1.1.9',
37
 
      cpqRackNetConnectorFWRev => '1.3.6.1.4.1.232.22.2.6.1.1.1.10',
38
 
      cpqRackNetConnectorType => '1.3.6.1.4.1.232.22.2.6.1.1.1.11',
39
 
      cpqRackNetConnectorLocation => '1.3.6.1.4.1.232.22.2.6.1.1.1.12',
40
 
      cpqRackNetConnectorPresent => '1.3.6.1.4.1.232.22.2.6.1.1.1.13',
41
 
      cpqRackNetConnectorHasFuses => '1.3.6.1.4.1.232.22.2.6.1.1.1.14',
42
 
      cpqRackNetConnectorEnclosureSerialNum => '1.3.6.1.4.1.232.22.2.6.1.1.1.15',
43
 
      cpqRackNetConnectorTypeValue => {
44
 
          0 => 'other', # undefined
45
 
          1 => 'other',
46
 
          2 => 'active',
47
 
          3 => 'passive',
48
 
      },
49
 
      cpqRackNetConnectorPresentValue => {
50
 
          1 => 'other',
51
 
          2 => 'absent',
52
 
          3 => 'present',
53
 
      },
54
 
      cpqRackNetConnectorHasFusesValue => {
55
 
          -1 => 'false', # wird geliefert, also vermute ich false
56
 
          1 => 'false',
57
 
          2 => 'true',
58
 
      },
59
 
  };
60
 
 
61
 
 
62
 
  # INDEX { cpqRackNetConnectorRack, cpqRackNetConnectorChassis, cpqRackNetConnectorIndex }
63
 
  # dreckada dreck, dreckada
64
 
  foreach ($self->get_entries($oids, 'cpqRackNetConnectorEntry')) {
65
 
    push(@{$self->{net_connectors}},
66
 
        HP::BladeSystem::Component::NetConnectorSubsystem::NetConnector->new(%{$_}));
67
 
  }
68
 
}
69
 
 
70
 
sub check {
71
 
  my $self = shift;
72
 
  foreach (@{$self->{net_connectors}}) {
73
 
    $_->check() if $_->{cpqRackNetConnectorPresent} eq 'present' ||
74
 
        $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv
75
 
  }
76
 
}
77
 
 
78
 
sub dump {
79
 
  my $self = shift;
80
 
  foreach (@{$self->{net_connectors}}) {
81
 
    $_->dump() if $_->{cpqRackNetConnectorPresent} eq 'present' ||
82
 
        $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv
83
 
  }
84
 
}
85
 
 
86
 
 
87
 
package HP::BladeSystem::Component::NetConnectorSubsystem::NetConnector;
88
 
our @ISA = qw(HP::BladeSystem::Component::NetConnectorSubsystem);
89
 
 
90
 
use strict;
91
 
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
92
 
 
93
 
sub new {
94
 
  my $class = shift;
95
 
  my %params = @_;
96
 
  my $self = {
97
 
    runtime => $params{runtime},
98
 
    rawdata => $params{rawdata},
99
 
    method => $params{method},
100
 
    blacklisted => 0,
101
 
    info => undef,
102
 
    extendedinfo => undef,
103
 
  };
104
 
  map { $self->{$_} = $params{$_} } grep /cpqRackNetConnector/, keys %params;
105
 
  $self->{name} = $params{cpqRackNetConnectorRack}.
106
 
      ':'.$params{cpqRackNetConnectorChassis}.
107
 
      ':'.$params{cpqRackNetConnectorIndex};
108
 
  $self->{serfw} = sprintf "Ser: %s, FW: %s", $self->{cpqRackNetConnectorSerialNum}, $self->{cpqRackNetConnectorFWRev};
109
 
  bless $self, $class;
110
 
  return $self;
111
 
}
112
 
 
113
 
sub check {
114
 
  my $self = shift;
115
 
  $self->blacklist('nc', $self->{name});
116
 
  my $info = sprintf 'net connector %s is %s, model is %s (%s)', 
117
 
      $self->{name}.($self->{cpqRackNetConnectorName} ? ' \''.$self->{cpqRackNetConnectorName}.'\'' : ''),
118
 
      $self->{cpqRackNetConnectorPresent}, $self->{cpqRackNetConnectorModel}, $self->{serfw};
119
 
  $self->add_info($info);
120
 
  # hat weder status noch condition, vielleicht spaeter mal
121
 
  $info .= sprintf " (SparePartNum %s)", $self->{cpqRackNetConnectorSparePartNumber};
122
 
123
 
  
124
 
sub dump {
125
 
  my $self = shift;
126
 
    printf "[NET_CONNECTOR_%s]\n", $self->{cpqRackNetConnectorName};
127
 
  foreach (qw(cpqRackNetConnectorRack cpqRackNetConnectorChassis cpqRackNetConnectorIndex cpqRackNetConnectorEnclosureName cpqRackNetConnectorName cpqRackNetConnectorModel cpqRackNetConnectorSerialNum cpqRackNetConnectorPartNumber cpqRackNetConnectorSparePartNumber cpqRackNetConnectorFWRev cpqRackNetConnectorType cpqRackNetConnectorLocation cpqRackNetConnectorPresent cpqRackNetConnectorHasFuses cpqRackNetConnectorEnclosureSerialNum)) {
128
 
    printf "%s: %s\n", $_, $self->{$_};
129
 
  }
130
 
  printf "\n";
131
 
}
132
 
 
133
 
 
134
 
1;