| 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::fcahostctl; |
| 22 |
|
| 23 |
use strict; |
| 24 |
use warnings; |
| 25 |
use centreon::plugins::misc; |
| 26 |
|
| 27 |
my %map_fcahostctl_status = ( |
| 28 |
1 => 'other', |
| 29 |
2 => 'ok', |
| 30 |
3 => 'failed', |
| 31 |
4 => 'shutdown', |
| 32 |
5 => 'loopDegraded', |
| 33 |
6 => 'loopFailed', |
| 34 |
7 => 'notConnected', |
| 35 |
); |
| 36 |
|
| 37 |
my %map_fcahostctl_condition = ( |
| 38 |
1 => 'other', |
| 39 |
2 => 'ok', |
| 40 |
3 => 'degraded', |
| 41 |
4 => 'failed', |
| 42 |
); |
| 43 |
|
| 44 |
my %model_map = ( |
| 45 |
1 => 'other', |
| 46 |
2 => 'fchc-p', |
| 47 |
3 => 'fchc-e', |
| 48 |
4 => 'fchc64', |
| 49 |
5 => 'sa-sam', |
| 50 |
6 => 'fca-2101', |
| 51 |
7 => 'sw64-33', |
| 52 |
8 => 'fca-221x', |
| 53 |
9 => 'dpfcmc', |
| 54 |
10 => 'fca-2404', |
| 55 |
11 => 'fca-2214', |
| 56 |
12 => 'a7298a', |
| 57 |
13 => 'fca-2214dc', |
| 58 |
14 => 'a6826a', |
| 59 |
15 => 'fcmcG3', |
| 60 |
16 => 'fcmcG4', |
| 61 |
17 => 'ab46xa', |
| 62 |
18 => 'fc-generic', |
| 63 |
19 => 'fca-1143', |
| 64 |
20 => 'fca-1243', |
| 65 |
21 => 'fca-2143', |
| 66 |
22 => 'fca-2243', |
| 67 |
23 => 'fca-1050', |
| 68 |
24 => 'fca-lpe1105', |
| 69 |
25 => 'fca-qmh2462', |
| 70 |
26 => 'fca-1142sr', |
| 71 |
27 => 'fca-1242sr', |
| 72 |
28 => 'fca-2142sr', |
| 73 |
29 => 'fca-2242sr', |
| 74 |
30 => 'fcmc20pe', |
| 75 |
31 => 'fca-81q', |
| 76 |
32 => 'fca-82q', |
| 77 |
33 => 'fca-qmh2562', |
| 78 |
34 => 'fca-81e', |
| 79 |
35 => 'fca-82e', |
| 80 |
36 => 'fca-1205', |
| 81 |
); |
| 82 |
|
| 83 |
# In 'CPQFCA-MIB.mib' |
| 84 |
my $mapping = { |
| 85 |
cpqFcaHostCntlrSlot => { oid => '.1.3.6.1.4.1.232.16.2.7.1.1.2' }, |
| 86 |
cpqFcaHostCntlrModel => { oid => '.1.3.6.1.4.1.232.16.2.7.1.1.3', map => \%model_map }, |
| 87 |
cpqFcaHostCntlrStatus => { oid => '.1.3.6.1.4.1.232.16.2.7.1.1.4', map => \%map_fcahostctl_status }, |
| 88 |
cpqFcaHostCntlrCondition => { oid => '.1.3.6.1.4.1.232.16.2.7.1.1.5', map => \%map_fcahostctl_condition }, |
| 89 |
}; |
| 90 |
my $oid_cpqFcaHostCntlrEntry = '.1.3.6.1.4.1.232.16.2.7.1.1'; |
| 91 |
|
| 92 |
sub load { |
| 93 |
my ($self) = @_; |
| 94 |
|
| 95 |
push @{$self->{request}}, { oid => $oid_cpqFcaHostCntlrEntry, start => $mapping->{cpqFcaHostCntlrSlot}->{oid}, end => $mapping->{cpqFcaHostCntlrCondition}->{oid} }; |
| 96 |
} |
| 97 |
|
| 98 |
sub check { |
| 99 |
my ($self) = @_; |
| 100 |
|
| 101 |
$self->{output}->output_add(long_msg => "Checking fca host controller"); |
| 102 |
$self->{components}->{fcahostctl} = {name => 'fca host controllers', total => 0, skip => 0}; |
| 103 |
return if ($self->check_filter(section => 'fcahostctl')); |
| 104 |
|
| 105 |
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaHostCntlrEntry}})) { |
| 106 |
next if ($oid !~ /^$mapping->{cpqFcaHostCntlrCondition}->{oid}\.(.*)$/); |
| 107 |
my $instance = $1; |
| 108 |
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaHostCntlrEntry}, instance => $instance); |
| 109 |
|
| 110 |
next if ($self->check_filter(section => 'fcahostctl', instance => $instance)); |
| 111 |
$self->{components}->{fcahostctl}->{total}++; |
| 112 |
|
| 113 |
$self->{output}->output_add(long_msg => sprintf("fca host controller '%s' [slot: %s, model: %s, status: %s] condition is %s.", |
| 114 |
$instance, $result->{cpqFcaHostCntlrSlot}, $result->{cpqFcaHostCntlrModel}, $result->{cpqFcaHostCntlrStatus}, |
| 115 |
$result->{cpqFcaHostCntlrCondition})); |
| 116 |
my $exit = $self->get_severity(label => 'default', section => 'fcahostctl', value => $result->{cpqFcaHostCntlrCondition}); |
| 117 |
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { |
| 118 |
$self->{output}->output_add(severity => $exit, |
| 119 |
short_msg => sprintf("fca host controller '%s' is %s", |
| 120 |
$instance, $result->{cpqFcaHostCntlrCondition})); |
| 121 |
} |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
1; |