Debian Codegraph @

check_hpasm/src/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide/SNMP.pm

raw
1 package HP::Proliant::Component::DiskSubsystem::Ide::SNMP;
2 our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Ide
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 controllers => [],
13 accelerators => [],
14 enclosures => [],
15 physical_drives => [],
16 logical_drives => [],
17 spare_drives => [],
18 blacklisted => 0,
19 };
20 bless $self, $class;
21 return $self;
22 }
23
24 sub init {
25 my $self = shift;
26 my $snmpwalk = $self->{rawdata};
27
28 # CPQIDE-MIB
29 my $oids = {
30 cpqIdeControllerEntry => '1.3.6.1.4.1.232.14.2.3.1.1',
31 cpqIdeControllerIndex => '1.3.6.1.4.1.232.14.2.3.1.1.1',
32 cpqIdeControllerOverallCondition => '1.3.6.1.4.1.232.14.2.3.1.1.2',
33 cpqIdeControllerModel => '1.3.6.1.4.1.232.14.2.3.1.1.3',
34 cpqIdeControllerSlot => '1.3.6.1.4.1.232.14.2.3.1.1.5',
35 cpqIdeControllerOverallConditionValue => {
36 1 => "other",
37 2 => "ok",
38 3 => "degraded",
39 4 => "failed",
40 },
41 };
42
43 # INDEX { cpqIdeControllerIndex }
44 foreach ($self->get_entries($oids, 'cpqIdeControllerEntry')) {
45 push(@{$self->{controllers}},
46 HP::Proliant::Component::DiskSubsystem::Ide::Controller->new(%{$_}));
47 }
48
49 $oids = {
50 cpqIdeLogicalDriveEntry => '1.3.6.1.4.1.232.14.2.6.1.1',
51 cpqIdeLogicalDriveControllerIndex => '1.3.6.1.4.1.232.14.2.6.1.1.1',
52 cpqIdeLogicalDriveIndex => '1.3.6.1.4.1.232.14.2.6.1.1.2',
53 cpqIdeLogicalDriveRaidLevel => '1.3.6.1.4.1.232.14.2.6.1.1.3',
54 cpqIdeLogicalDriveCapacity => '1.3.6.1.4.1.232.14.2.6.1.1.4',
55 cpqIdeLogicalDriveStatus => '1.3.6.1.4.1.232.14.2.6.1.1.5',
56 cpqIdeLogicalDriveCondition => '1.3.6.1.4.1.232.14.2.6.1.1.6',
57 cpqIdeLogicalDriveDiskIds => '1.3.6.1.4.1.232.14.2.6.1.1.7',
58 cpqIdeLogicalDriveSpareIds => '1.3.6.1.4.1.232.14.2.6.1.1.9',
59 cpqIdeLogicalDriveRebuildingDisk => '1.3.6.1.4.1.232.14.2.6.1.1.10',
60 cpqIdeLogicalDriveRaidLevelValue => {
61 1 => "other",
62 2 => "raid0",
63 3 => "raid1",
64 4 => "raid0plus1",
65 },
66 cpqIdeLogicalDriveStatusValue => {
67 1 => "other",
68 2 => "ok",
69 3 => "degraded",
70 4 => "rebuilding",
71 5 => "failed",
72 },
73 cpqIdeLogicalDriveConditionValue => {
74 1 => "other",
75 2 => "ok",
76 3 => "degraded",
77 4 => "failed",
78 },
79 };
80 # INDEX { cpqIdeLogicalDriveControllerIndex, cpqIdeLogicalDriveIndex }
81 foreach ($self->get_entries($oids, 'cpqIdeLogicalDriveEntry')) {
82 push(@{$self->{logical_drives}},
83 HP::Proliant::Component::DiskSubsystem::Ide::LogicalDrive->new(%{$_}));
84 }
85
86 $oids = {
87 cpqIdeAtaDiskEntry => '1.3.6.1.4.1.232.14.2.4.1.1',
88 cpqIdeAtaDiskControllerIndex => '1.3.6.1.4.1.232.14.2.4.1.1.1',
89 cpqIdeAtaDiskIndex => '1.3.6.1.4.1.232.14.2.4.1.1.2',
90 cpqIdeAtaDiskModel => '1.3.6.1.4.1.232.14.2.4.1.1.3',
91 cpqIdeAtaDiskStatus => '1.3.6.1.4.1.232.14.2.4.1.1.6',
92 cpqIdeAtaDiskCondition => '1.3.6.1.4.1.232.14.2.4.1.1.7',
93 cpqIdeAtaDiskCapacity => '1.3.6.1.4.1.232.14.2.4.1.1.8',
94 cpqIdeAtaDiskLogicalDriveMember => '1.3.6.1.4.1.232.14.2.4.1.1.13',
95 cpqIdeAtaDiskIsSpare => '1.3.6.1.4.1.232.14.2.4.1.1.14',
96 cpqIdeAtaDiskStatusValue => {
97 1 => "other",
98 2 => "ok",
99 3 => "smartError",
100 4 => "failed",
101 },
102 cpqIdeAtaDiskConditionValue => {
103 1 => "other",
104 2 => "ok",
105 3 => "degraded",
106 4 => "failed",
107 },
108 };
109 # INDEX { cpqIdeAtaDiskControllerIndex, cpqIdeAtaDiskIndex }
110 foreach ($self->get_entries($oids, 'cpqIdeAtaDiskEntry')) {
111 push(@{$self->{physical_drives}},
112 HP::Proliant::Component::DiskSubsystem::Ide::PhysicalDrive->new(%{$_}));
113 }
114
115 }