Debian Codegraph @

src/hardware/server/ibm/bladecenter/snmp/mode/components/chassisstatus.pm

raw
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::ibm::bladecenter::snmp::mode::components::chassisstatus;
22
23 use strict;
24 use warnings;
25
26 # In MIB 'mmblade.mib' and 'cme.mib'
27 my $oid_mmBistAndChassisStatus = '.1.3.6.1.4.1.2.3.51.2.2.5.2';
28 my $oid_bistLogicalNetworkLink = '.1.3.6.1.4.1.2.3.51.2.2.5.2.30.0';
29 my $oids = {
30 bistSdram => '.1.3.6.1.4.1.2.3.51.2.2.5.2.1.0',
31 bistRs485Port1 => '.1.3.6.1.4.1.2.3.51.2.2.5.2.2.0',
32 bistRs485Port2 => '.1.3.6.1.4.1.2.3.51.2.2.5.2.3.0',
33 bistNvram => '.1.3.6.1.4.1.2.3.51.2.2.5.2.4.0',
34 bistRtc => '.1.3.6.1.4.1.2.3.51.2.2.5.2.5.0',
35 bistLocalI2CBus => '.1.3.6.1.4.1.2.3.51.2.2.5.2.7.0',
36 bistPrimaryMainAppFlashImage => '.1.3.6.1.4.1.2.3.51.2.2.5.2.8.0',
37 bistSecondaryMainAppFlashImage => '.1.3.6.1.4.1.2.3.51.2.2.5.2.9.0',
38 bistBootRomFlashImage => '.1.3.6.1.4.1.2.3.51.2.2.5.2.10.0',
39 bistEthernetPort1 => '.1.3.6.1.4.1.2.3.51.2.2.5.2.11.0',
40 bistEthernetPort2 => '.1.3.6.1.4.1.2.3.51.2.2.5.2.12.0',
41 bistInternalPCIBus => '.1.3.6.1.4.1.2.3.51.2.2.5.2.13.0',
42 bistExternalI2CDevices => '.1.3.6.1.4.1.2.3.51.2.2.5.2.14.0',
43 bistUSBController => '.1.3.6.1.4.1.2.3.51.2.2.5.2.15.0',
44 bistVideoCompressorBoard => '.1.3.6.1.4.1.2.3.51.2.2.5.2.16.0',
45 bistRemoteVideo => '.1.3.6.1.4.1.2.3.51.2.2.5.2.17.0',
46 bistPrimaryBus => '.1.3.6.1.4.1.2.3.51.2.2.5.2.18.0',
47 bistInternalEthernetSwitch => '.1.3.6.1.4.1.2.3.51.2.2.5.2.19.0',
48 bistVideoCapture => '.1.3.6.1.4.1.2.3.51.2.2.5.2.20.0',
49 bistUSBKeyboardMouseEmulation => '.1.3.6.1.4.1.2.3.51.2.2.5.2.21.0',
50 bistUSBMassStorageEmulation => '.1.3.6.1.4.1.2.3.51.2.2.5.2.22.0',
51 bistUSBKeyboardMouseFirmware => '.1.3.6.1.4.1.2.3.51.2.2.5.2.23.0',
52 bistUSBMassStorageFirmware => '.1.3.6.1.4.1.2.3.51.2.2.5.2.24.0',
53 bistPrimaryCore => '.1.3.6.1.4.1.2.3.51.2.2.5.2.25.0',
54 bistSecondaryCore => '.1.3.6.1.4.1.2.3.51.2.2.5.2.26.0',
55 bistInternalIOExpander => '.1.3.6.1.4.1.2.3.51.2.2.5.2.27.0',
56 bistRemoteControlFirmware => '.1.3.6.1.4.1.2.3.51.2.2.5.2.28.0',
57 bistPhysicalNetworkLink => '.1.3.6.1.4.1.2.3.51.2.2.5.2.29.0',
58 bistLogicalNetworkLink => '.1.3.6.1.4.1.2.3.51.2.2.5.2.30.0',
59 };
60
61 my %map_test_state = (
62 0 => 'testSucceeded',
63 1 => 'testFailed',
64 );
65
66 sub load {
67 my ($self) = @_;
68
69 push @{$self->{request}}, { oid => $oid_mmBistAndChassisStatus, end => $oid_bistLogicalNetworkLink };
70 }
71
72 sub check {
73 my ($self) = @_;
74
75 $self->{output}->output_add(long_msg => "Checking chassis status");
76 $self->{components}->{chassisstatus} = {name => 'chassis-status', total => 0, skip => 0};
77 return if ($self->check_filter(section => 'chassisstatus'));
78
79 foreach my $name (sort keys %{$oids}) {
80 if (!defined($self->{results}->{$oid_mmBistAndChassisStatus}->{$oids->{$name}})) {
81 $self->{output}->output_add(long_msg => sprintf("skip '%s': no value",
82 $name));
83 next;
84 }
85
86 my $value = $map_test_state{$self->{results}->{$oid_mmBistAndChassisStatus}->{$oids->{$name}}};
87 next if ($self->check_filter(section => 'chassisstatus', instance => $name));
88 $self->{components}->{chassisstatus}->{total}++;
89
90 $self->{output}->output_add(long_msg => sprintf("Chassis status '%s' state is %s",
91 $name, $value));
92 my $exit = $self->get_severity(section => 'chassisstatus', value => $value);
93 if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
94 $self->{output}->output_add(severity => $exit,
95 short_msg => sprintf("Chassis status '%s' state is %s",
96 $name, $value));
97 }
98 }
99 }
100
101 1;