Debian Codegraph @

src/storage/emc/symmetrix/vmax/local/mode/components/power.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::vmax::local::mode::components::power;
22
23 use base qw(centreon::plugins::mode);
24
25 use strict;
26 use warnings;
27 use centreon::plugins::misc;
28
29 #Power system: OK
30 #
31 #+--------------------------------------------------------+--------------------------------------+
32 #| Item | Status |
33 #+--------------------------------------------------------+--------------------------------------+
34 #| Power input type | Three Phases |
35 #| System Bay AC Zones Status | OK |
36 #| AC Status Zone A | Zone AC OK |
37 #| AC Status Zone B | Zone AC OK |
38 #| Power modules status | OK |
39 #| System Bay 1 | OK |
40 #| Engine SPS 4A | OK |
41 #| General Status | OK |
42 #| Detailed Status | OK |
43 #| Condition Register | OK |
44 #| Battery Life (sec) | 600 |
45 #| Days of Operation | Unknown |
46 #| Slot | Slot B |
47 #| Manufacturer Information | ASTEC,AA23540,7E, 04/11/2008 |
48 #+--------------------------------------------------------+--------------------------------------+
49 #| Item | Status |
50 #+--------------------------------------------------------+--------------------------------------+
51
52 sub check {
53 my ($self) = @_;
54
55 $self->{output}->output_add(long_msg => "Checking powers");
56 $self->{components}->{power} = {name => 'powers', total => 0, skip => 0};
57 return if ($self->check_filter(section => 'power'));
58
59 if ($self->{content_file_health_env} !~ /Ethernet cabling.*?Power system.*?---------.*?Item.*?---------.*?\n(.*?\n)\+---------/msi) {
60 $self->{output}->output_add(long_msg => 'skipping: cannot find powers');
61 return ;
62 }
63
64 my $content = $1;
65
66 my $total_components = 0;
67 my @stack = ({ indent => 0, long_instance => '' });
68 while ($content =~ /^\|([ \t]+)(.*?)\|(.*?)\|\n/msig) {
69 my ($indent, $name, $status) = (length($1), centreon::plugins::misc::trim($2), centreon::plugins::misc::trim($3));
70
71 pop @stack while ($indent <= $stack[$#stack]->{indent});
72
73 my $long_instance = $stack[$#stack]->{long_instance} . '>' . $name;
74 if ($indent > $stack[$#stack]->{indent}) {
75 push @stack, { indent => $indent,
76 long_instance => $stack[$#stack]->{long_instance} . '>' . $name };
77 }
78
79 next if ($name !~ /status/i);
80
81 next if ($self->check_filter(section => 'power', instance => $long_instance));
82 $self->{components}->{power}->{total}++;
83
84 $self->{output}->output_add(long_msg => sprintf("power '%s' status is '%s'",
85 $long_instance, $status));
86 my $exit = $self->get_severity(label => 'default', section => 'power', value => $status);
87 if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
88 $self->{output}->output_add(severity => $exit,
89 short_msg => sprintf("Power '%s' status is '%s'",
90 $long_instance, $status));
91 }
92 }
93 }
94
95 1;