Debian Codegraph @

src/hardware/telephony/avaya/mediagateway/snmp/mode/components/alarm.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::telephony::avaya::mediagateway::snmp::mode::components::alarm;
22
23 use strict;
24 use warnings;
25
26 sub load {}
27
28 my $bits_alarm = {
29 23 => 'at least two fans have been operating at less than 90% of their nominal speed for 5 minutes or more',
30 22 => 'the power supply fan has been operating at less than 90% of its nominal speed for 10 minutes or more, but less than 15 minutes',
31 21 => 'the power supply fan has been operating at less than 90% of its nominal speed for 15 minutes or more',
32 19 => 'cmgCpuTemp has exceeded its warning threshold',
33 18 => 'mgDspTemp has exceeded its warning threshold',
34 16 => 'Power On Status Test failure -NCE, QUICC test failures on power up',
35 15 => 'The +5.1 v power supply to the MG processor is out of range',
36 14 => 'The +3.3 v power supply to the VoIP complexes is out of range',
37 13 => 'The +3.3 v power supply to the VoIP complexes is out of range',
38 12 => 'The +1.58 v power supply to the DSP units is out of range',
39 11 => 'The +2.5 v power supply to the 8260 processor is out of range',
40 10 => 'The -48 v auxiliary power supply to the endpoints is out of range',
41 9 => 'The +12 v power supply to the fans is out of range',
42 7 => 'Clock synchronization signal is lost',
43 6 => 'Clock synchronization signal warning. Only one clock syncronization signal source remains',
44 5 => 'Clock synchronization signal excessive switching',
45 4 => 'TDM Test Expansion Box 1 Failure',
46 3 => 'TDM Test Expansion Box 2 Failure',
47 2 => 'PoE Power Supply Base Box Failure',
48 1 => 'PoE Power Supply Expansion Box 1 Failure',
49 0 => 'PoE Power Supply Expansion Box 2 Failure',
50 };
51
52 sub check {
53 my ($self) = @_;
54
55 $self->{output}->output_add(long_msg => "Checking alarms");
56 $self->{components}->{alarm} = { name => 'alarms', total => 0, skip => 0 };
57 return if ($self->check_filter(section => 'alarm'));
58
59 my $oid_cmgHardwareFaultMask = '.1.3.6.1.4.1.6889.2.9.1.1.10.12.0';
60 return if (!defined($self->{results}->{$oid_cmgHardwareFaultMask}));
61
62 $self->{results}->{$oid_cmgHardwareFaultMask} = oct("0b" . unpack('B*', $self->{results}->{$oid_cmgHardwareFaultMask}));
63 foreach (sort { $a <=> $b } keys %$bits_alarm) {
64 my $instance = $_;
65 my $status = 'disabled';
66 if (($self->{results}->{$oid_cmgHardwareFaultMask} & (1 << $_))) {
67 $status = 'enabled';
68 }
69
70 next if ($self->check_filter(section => 'alarm', instance => $instance));
71 $self->{components}->{alarm}->{total}++;
72
73 $self->{output}->output_add(
74 long_msg => sprintf(
75 "alarm '%s' status is '%s' [instance: %s]",
76 $bits_alarm->{$_}, $status, $instance
77 )
78 );
79 my $exit = $self->get_severity(section => 'alarm', instance => $instance, value => $status);
80 if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
81 $self->{output}->output_add(severity => $exit,
82 short_msg => sprintf("Alarm '%s' status is '%s'",
83 $bits_alarm->{$_}, $status));
84 }
85 }
86 }
87
88 1;