| 1 |
# |
| 2 |
# Copyright 2024 Centreon (http://www.centreon.com/) |
| 3 |
# |
| 4 |
# Centreon is a full-fledged industry-strength solution that meets |
| 5 |
# the needs in IT infrastructure and application monitoring for |
| 6 |
# service performance. |
| 7 |
# |
| 8 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 |
# you may not use this file except in compliance with the License. |
| 10 |
# You may obtain a copy of the License at |
| 11 |
# |
| 12 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 13 |
# |
| 14 |
# Unless required by applicable law or agreed to in writing, software |
| 15 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 16 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 |
# See the License for the specific language governing permissions and |
| 18 |
# limitations under the License. |
| 19 |
# |
| 20 |
|
| 21 |
package hardware::server::hp::proliant::snmp::mode::components::dactl; |
| 22 |
|
| 23 |
use strict; |
| 24 |
use warnings; |
| 25 |
|
| 26 |
my %map_controller_condition = ( |
| 27 |
1 => 'other', |
| 28 |
2 => 'ok', |
| 29 |
3 => 'degraded', |
| 30 |
4 => 'failed', |
| 31 |
); |
| 32 |
my %model_map = ( |
| 33 |
1 => 'other', |
| 34 |
2 => 'ida', |
| 35 |
3 => 'idaExpansion', |
| 36 |
4 => 'ida-2', |
| 37 |
5 => 'smart', |
| 38 |
6 => 'smart-2e', |
| 39 |
7 => 'smart-2p', |
| 40 |
8 => 'smart-2sl', |
| 41 |
9 => 'smart-3100es', |
| 42 |
10 => 'smart-3200', |
| 43 |
11 => 'smart-2dh', |
| 44 |
12 => 'smart-221', |
| 45 |
13 => 'sa-4250es', |
| 46 |
14 => 'sa-4200', |
| 47 |
15 => 'sa-integrated', |
| 48 |
16 => 'sa-431', |
| 49 |
17 => 'sa-5300', |
| 50 |
18 => 'raidLc2', |
| 51 |
19 => 'sa-5i', |
| 52 |
20 => 'sa-532', |
| 53 |
21 => 'sa-5312', |
| 54 |
22 => 'sa-641', |
| 55 |
23 => 'sa-642', |
| 56 |
24 => 'sa-6400', |
| 57 |
25 => 'sa-6400em', |
| 58 |
26 => 'sa-6i', |
| 59 |
27 => 'sa-generic', |
| 60 |
29 => 'sa-p600', |
| 61 |
30 => 'sa-p400', |
| 62 |
31 => 'sa-e200', |
| 63 |
32 => 'sa-e200i', |
| 64 |
33 => 'sa-p400i', |
| 65 |
34 => 'sa-p800', |
| 66 |
35 => 'sa-e500', |
| 67 |
36 => 'sa-p700m', |
| 68 |
37 => 'sa-p212', |
| 69 |
38 => 'sa-p410(38)', |
| 70 |
39 => 'sa-p410i', |
| 71 |
40 => 'sa-p411', |
| 72 |
41 => 'sa-b110i', |
| 73 |
42 => 'sa-p712m', |
| 74 |
43 => 'sa-p711m', |
| 75 |
44 => 'sa-p812' |
| 76 |
); |
| 77 |
# In 'CPQIDA-MIB.mib' |
| 78 |
my $mapping = { |
| 79 |
cpqDaCntlrModel => { oid => '.1.3.6.1.4.1.232.3.2.2.1.1.2', map => \%model_map }, |
| 80 |
}; |
| 81 |
my $mapping2 = { |
| 82 |
cpqDaCntlrSlot => { oid => '.1.3.6.1.4.1.232.3.2.2.1.1.5' }, |
| 83 |
cpqDaCntlrCondition => { oid => '.1.3.6.1.4.1.232.3.2.2.1.1.6', map => \%map_controller_condition }, |
| 84 |
}; |
| 85 |
my $oid_cpqDaCntlrEntry = '.1.3.6.1.4.1.232.3.2.2.1.1'; |
| 86 |
my $oid_cpqDaCntlrModel = '.1.3.6.1.4.1.232.3.2.2.1.1.2'; |
| 87 |
|
| 88 |
sub load { |
| 89 |
my ($self) = @_; |
| 90 |
|
| 91 |
push @{$self->{request}}, { oid => $oid_cpqDaCntlrEntry, start => $mapping2->{cpqDaCntlrSlot}->{oid}, end => $mapping2->{cpqDaCntlrCondition}->{oid} }, |
| 92 |
{ oid => $oid_cpqDaCntlrModel }; |
| 93 |
} |
| 94 |
|
| 95 |
sub check { |
| 96 |
my ($self) = @_; |
| 97 |
|
| 98 |
$self->{output}->output_add(long_msg => "Checking da controller"); |
| 99 |
$self->{components}->{dactl} = {name => 'da controllers', total => 0, skip => 0}; |
| 100 |
return if ($self->check_filter(section => 'dactl')); |
| 101 |
|
| 102 |
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaCntlrEntry}})) { |
| 103 |
next if ($oid !~ /^$mapping2->{cpqDaCntlrCondition}->{oid}\.(.*)$/); |
| 104 |
my $instance = $1; |
| 105 |
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqDaCntlrModel}, instance => $instance); |
| 106 |
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaCntlrEntry}, instance => $instance); |
| 107 |
|
| 108 |
next if ($self->check_filter(section => 'dactl', instance => $instance)); |
| 109 |
$self->{components}->{dactl}->{total}++; |
| 110 |
|
| 111 |
$self->{output}->output_add(long_msg => sprintf("da controller '%s' [slot: %s, model: %s] status is %s.", |
| 112 |
$instance, $result2->{cpqDaCntlrSlot}, $result->{cpqDaCntlrModel}, |
| 113 |
$result2->{cpqDaCntlrCondition})); |
| 114 |
my $exit = $self->get_severity(label => 'default', section => 'dactl', value => $result2->{cpqDaCntlrCondition}); |
| 115 |
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { |
| 116 |
$self->{output}->output_add(severity => $exit, |
| 117 |
short_msg => sprintf("da controller '%s' is %s", |
| 118 |
$instance, $result2->{cpqDaCntlrCondition})); |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
1; |