Debian Codegraph @

src/storage/emc/symmetrix/dmx34/local/mode/components/memory.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 storage::emc::symmetrix::dmx34::local::mode::components::memory;
22
23 use base qw(centreon::plugins::mode);
24
25 use strict;
26 use warnings;
27
28 #------------[ Memory Information ]-------------
29 #
30 # Memory Size: 80 GB
31 # Cache start Addr: 00088000 (Hex)
32 # Cache start Bank: 00000022 (Hex)
33 # Cache last Addr: 01400000 (Hex)
34 # Cache last Bank: 000004FF (Hex)
35 #
36 # Board Number M0 M1 M2 M3 M4 M5 M6 M7
37 # Slot Number 10 11 12 13 14 15 16 17
38 # ----------------------------------------------------------
39 # Size (GB) 16 16 16 16 8 8 .. ..
40 # Mode OPER OPER OPER OPER OPER OPER .. ..
41 # Status OK OK OK OK OK OK .. ..
42 #
43 # Status Key
44 # OK - Board is operating normally
45
46 sub check {
47 my ($self) = @_;
48
49 $self->{output}->output_add(long_msg => "Checking memory");
50 $self->{components}->{memory} = {name => 'memory', total => 0, skip => 0};
51 return if ($self->check_filter(section => 'memory'));
52
53 if ($self->{content_file_health} !~ /----\[ Memory Information(.*?)----\[/msi) {
54 $self->{output}->output_add(long_msg => 'skipping: cannot find memory');
55 return ;
56 }
57
58 my $content = $1;
59
60 $content =~ /Board Number\s+(.*?)\n/msi;
61 my @board_numbers = split /\s+/, $1;
62
63 $content =~ /Slot Number\s+(.*?)\n/msi;
64 my @slot_numbers = split /\s+/, $1;
65
66 $content =~ /Mode\s+(.*?)\n/msi;
67 my @modes = split /\s+/, $1;
68
69 $content =~ /Status\s+(.*?)\n/msi;
70 my @status = split /\s+/, $1;
71
72 my $i = -1;
73 foreach my $name (@board_numbers) {
74 $i++;
75 my $instance = $name . '#' . $slot_numbers[$i];
76 my $state = $modes[$i] . '/' . $status[$i];
77
78 next if ($self->check_filter(section => 'memory', instance => $instance));
79 $self->{components}->{memory}->{total}++;
80
81 $self->{output}->output_add(long_msg => sprintf("memory '%s' state is '%s'",
82 $instance, $state));
83 my $exit = $self->get_severity(section => 'memory', value => $state);
84 if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
85 $self->{output}->output_add(severity => $exit,
86 short_msg => sprintf("Memory '%s' state is '%s'",
87 $instance, $state));
88 }
89 }
90 }
91
92 1;