1
package HP::Proliant::Component::DiskSubsystem::Da::CLI;
2
our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da);
5
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
13
physical_drives => [],
24
my $hpacucli = $self->{rawdata};
37
foreach (split(/\n/, $hpacucli)) {
38
next unless /^status/;
39
next if /^status\s*$/;
41
if (/([\s\w]+) in Slot\s+(\d+)/) {
45
$tmpcntl->{$slot}->{cpqDaCntlrIndex} = $cntlindex;
46
$tmpcntl->{$slot}->{cpqDaCntlrModel} = $1;
47
$tmpcntl->{$slot}->{cpqDaCntlrSlot} = $slot;
48
} elsif (/(MSA[\s\w]+)\s+in\s+(\w+)/) {
52
$tmpcntl->{$slot}->{cpqDaCntlrIndex} = $cntlindex;
53
$tmpcntl->{$slot}->{cpqDaCntlrModel} = $1;
54
$tmpcntl->{$slot}->{cpqDaCntlrSlot} = $slot;
55
} elsif (/Controller Status: (\w+)/) {
56
$tmpcntl->{$slot}->{cpqDaCntlrBoardCondition} = lc $1;
57
$tmpcntl->{$slot}->{cpqDaCntlrCondition} = lc $1;
58
} elsif (/Cache Status: ([\w\s]+\s*$)/) {
60
# Cache Status: Not Configured
61
# Cache Status: Temporarily Disabled
62
$tmpaccel->{$slot}->{cpqDaAccelCntlrIndex} = $cntlindex;
63
$tmpaccel->{$slot}->{cpqDaAccelSlot} = $slot;
64
#condition: other,ok,degraded,failed
65
#status: other,invalid,enabled,tmpDisabled,permDisabled
66
$tmpaccel->{$slot}->{cpqDaAccelCondition} = lc $1;
67
if ($tmpaccel->{$slot}->{cpqDaAccelCondition} eq 'ok') {
68
$tmpaccel->{$slot}->{cpqDaAccelStatus} = 'enabled';
69
} elsif ($tmpaccel->{$slot}->{cpqDaAccelCondition} eq 'not configured') {
70
$tmpaccel->{$slot}->{cpqDaAccelCondition} = 'ok';
71
$tmpaccel->{$slot}->{cpqDaAccelStatus} = 'enabled';
72
} elsif ($tmpaccel->{$slot}->{cpqDaAccelCondition} eq 'temporarily disabled') {
73
$tmpaccel->{$slot}->{cpqDaAccelCondition} = 'ok';
74
$tmpaccel->{$slot}->{cpqDaAccelStatus} = 'tmpDisabled';
75
} elsif ($tmpaccel->{$slot}->{cpqDaAccelCondition} eq 'permanently disabled') {
76
$tmpaccel->{$slot}->{cpqDaAccelCondition} = 'ok';
77
$tmpaccel->{$slot}->{cpqDaAccelStatus} = 'permDisabled';
79
$tmpaccel->{$slot}->{cpqDaAccelStatus} = 'enabled';
81
} elsif (/Battery.* Status: (\w+)/) {
82
# sowas gibts auch Battery/Capacitor Status: OK
83
$tmpaccel->{$slot}->{cpqDaAccelBattery} = lc $1;
90
foreach (split(/\n/, $hpacucli)) {
91
next unless /^config/;
92
next if /^config\s*$/;
94
if (/([\s\w]+) in Slot\s+(\d+)/) {
98
} elsif (/(MSA[\s\w]+)\s+in\s+(\w+)/) {
102
} elsif (/logicaldrive\s+(.+?)\s+\((.*)\)/) {
103
# logicaldrive 1 (683.5 GB, RAID 5, OK)
104
# logicaldrive 1 (683.5 GB, RAID 5, OK)
105
# logicaldrive 2 (442 MB, RAID 1+0, OK)
107
$tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvCntlrIndex} = $cntlindex;
108
$tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvIndex} = $ldriveindex;
109
($tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvSize},
110
$tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvFaultTol},
111
$tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvCondition}) =
112
map { lc $_ } split(/,\s*/, $2);
113
$tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvStatus} =
114
$tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvCondition};
115
$tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvPhyDrvIDs} = 'unknown';
116
} elsif (/physicaldrive\s+(.+?)\s+\((.*)\)/) {
117
# physicaldrive 2:0 (port 2:id 0 , Parallel SCSI, 36.4 GB, OK)
118
# physicaldrive 2I:1:6 (port 2I:box 1:bay 6, SAS, 146 GB, OK)
119
# physicaldrive 1:1 (box 1:bay 1, Parallel SCSI, 146 GB, OK)
121
my($location, $type, $size, $status) = split(/,/, $2);
122
$status =~ s/^\s+//g;
123
$status =~ s/\s+$//g;
124
$status = lc $status;
126
foreach (split(/:/, $location)) {
127
$location{$1} = $2 if /(\w+)\s+(\w+)/;
129
$location{box} ||= 0;
130
$location{id} ||= $pdriveindex;
131
$location{bay} ||= $location{id};
132
$location{port} ||= $location{bay};
133
$tmppd->{$slot}->{$name}->{name} = lc $name;
134
$tmppd->{$slot}->{$name}->{cpqDaPhyDrvCntlrIndex} = $cntlindex;
135
$tmppd->{$slot}->{$name}->{cpqDaPhyDrvIndex} = $location{id};
136
$tmppd->{$slot}->{$name}->{cpqDaPhyDrvBay} = $location{bay};
137
$tmppd->{$slot}->{$name}->{cpqDaPhyDrvBusNumber} = $location{port};
138
$tmppd->{$slot}->{$name}->{cpqDaPhyDrvSize} = $size;
139
$tmppd->{$slot}->{$name}->{cpqDaPhyDrvStatus} = $status;
140
$tmppd->{$slot}->{$name}->{cpqDaPhyDrvCondition} = $status;
141
$tmppd->{$slot}->{$name}->{ldriveindex} = $ldriveindex || -1;
142
foreach (keys %{$tmppd->{$slot}->{$name}}) {
143
$tmppd->{$slot}->{$name}->{$_} =~ s/^\s+//g;
144
$tmppd->{$slot}->{$name}->{$_} =~ s/\s+$//g;
145
$tmppd->{$slot}->{$name}->{$_} = lc $tmppd->{$slot}->{$name}->{$_};
151
foreach my $slot (keys %{$tmpcntl}) {
152
if (exists $tmpcntl->{$slot}->{cpqDaCntlrModel} &&
153
! $self->identified($tmpcntl->{$slot}->{cpqDaCntlrModel})) {
154
delete $tmpcntl->{$slot};
155
delete $tmpaccel->{$slot};
156
delete $tmpld->{$slot};
157
delete $tmppd->{$slot};
161
#printf "%s\n", Data::Dumper::Dumper($tmpcntl);
162
#printf "%s\n", Data::Dumper::Dumper($tmpaccel);
163
#printf "%s\n", Data::Dumper::Dumper($tmpld);
164
#printf "%s\n", Data::Dumper::Dumper($tmppd);
165
foreach my $slot (sort {
166
$tmpcntl->{$a}->{cpqDaCntlrIndex} <=> $tmpcntl->{$b}->{cpqDaCntlrIndex}
168
$tmpcntl->{$slot}->{runtime} = $self->{runtime};
169
push(@{$self->{controllers}},
170
HP::Proliant::Component::DiskSubsystem::Da::Controller->new(
171
%{$tmpcntl->{$slot}}));
173
foreach my $slot (sort {
174
$tmpaccel->{$a}->{cpqDaAccelCntlrIndex} <=> $tmpaccel->{$b}->{cpqDaAccelCntlrIndex}
175
} keys %{$tmpaccel}) {
176
$tmpaccel->{$slot}->{runtime} = $self->{runtime};
177
push(@{$self->{accelerators}},
178
HP::Proliant::Component::DiskSubsystem::Da::Accelerator->new(
179
%{$tmpaccel->{$slot}}));
181
foreach my $slot (keys %{$tmpld}) {
182
foreach my $ldriveindex (keys %{$tmpld->{$slot}}) {
183
$tmpld->{$slot}->{$ldriveindex}->{runtime} = $self->{runtime};
184
push(@{$self->{logical_drives}},
185
HP::Proliant::Component::DiskSubsystem::Da::LogicalDrive->new(
186
%{$tmpld->{$slot}->{$ldriveindex}}));
188
foreach my $pdriveindex (sort {
189
(split ':', $a, 2)[0] cmp (split ':', $b, 2)[0] ||
190
(split ':', $a, 2)[1] cmp (split ':', $b, 2)[1] ||
191
(split ':', $a, 2)[2] <=> (split ':', $b, 2)[2]
192
} keys %{$tmppd->{$slot}}) {
193
$tmppd->{$slot}->{$pdriveindex}->{runtime} = $self->{runtime};
194
push(@{$self->{physical_drives}},
195
HP::Proliant::Component::DiskSubsystem::Da::PhysicalDrive->new(
196
%{$tmppd->{$slot}->{$pdriveindex}}));
204
return 1 if $info =~ /Parallel SCSI/;
205
return 1 if $info =~ /Smart Array/; # Trond: works fine on E200i, P400, E400
206
return 1 if $info =~ /MSA500/;
207
#return 1 if $info =~ /Smart Array (5|6)/;
208
#return 1 if $info =~ /Smart Array P400i/; # snmp sagt Da, trotz SAS in cli
209
#return 1 if $info =~ /Smart Array P410i/; # dto