Debian Codegraph @

src/storage/emc/symmetrix/dmx34/local/mode/components/disk.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::disk;
22
23 use base qw(centreon::plugins::mode);
24
25 use strict;
26 use warnings;
27
28 # ------------[ Device Information ]-------------
29 #
30 # RAID6 Configured: NO
31 # RAID5 Configured: NO
32 # RDF Configured: NO_RDF
33
34 # Verify Volume Status
35 # There are 16 local devices are not ready (device(DA)):- à 0 si pas de problème
36 # 10000(01a) 10072(01a) 20086(01a) 1009A(01a) 200AE(01a) 100C2(01a) 100EA(01a)
37 # 10112(01a) 20075(01d) 10089(01d) 2009D(01d) 100B1(01d) 100C9(01d) 100F1(01d)
38 # 10119(01d) 20061(01d)
39 #
40 # No local devices have invalid tracks
41 #
42 # Deferred disk service is NOT enabled
43 #
44 # 8 hot spares are configured, 1 are invoked, none are not ready à none si pas de problème
45 #
46 # HotSpare 16d:D5 is invoked against 1d:D4 Time: MAR/24/16 04:48:49 à récupérer si pb
47 #
48 # No DAs have any volumes with Not Ready bit set
49 #
50 # All DAs have Write Optimize enabled
51 #
52 # No devices have TimeFinder Lock
53 #
54 # No Devices Found in Transient State
55
56 sub check {
57 my ($self) = @_;
58
59 $self->{output}->output_add(long_msg => "Checking disks");
60 $self->{components}->{disk} = {name => 'disks (1 means all)', total => 0, skip => 0};
61 return if ($self->check_filter(section => 'disk'));
62
63 if ($self->{content_file_health} !~ /----\[ Device Information(.*?)----\[/msi) {
64 $self->{output}->output_add(long_msg => 'skipping: cannot find devices');
65 return ;
66 }
67
68 my $content = $1;
69 $self->{components}->{disk}->{total}++;
70
71 # Error if not present:
72 # No local devices have invalid tracks
73
74 if ($content !~ /No local devices have invalid tracks/msi) {
75 $self->{output}->output_add(severity => 'CRITICAL',
76 short_msg => sprintf("problem of invalid tracks on disks"));
77 } else {
78 $self->{output}->output_add(long_msg => sprintf("no invalid tracks on disks"));
79 }
80
81 # Error if not present:
82 # All local devices are ready
83 if ($content !~ /All local devices are ready/msi) {
84 $content =~ /There are\s+(\S+)\s+local devices are not ready.*?\n(.*?)\n\s*\n/msi;
85 my ($num, $disks) = ($1, $2);
86 $disks =~ s/\n/ /msg;
87 $disks =~ s/\s+/ /msg;
88 $disks =~ s/^\s+//;
89 $self->{output}->output_add(long_msg => sprintf("problem on following disks '%s'", $disks));
90 $self->{output}->output_add(severity => 'CRITICAL',
91 short_msg => sprintf("problem on '%s' disks", $num));
92 } else {
93 $self->{output}->output_add(long_msg => sprintf("all devices are ready"));
94 }
95
96 return if ($content !~ /(\S+) hot spares are configured,\s*(\S+)\s+are invoked,\s*(\S+)\s+are not ready/msi);
97 my ($total, $used, $not_ready) = ($1, $2, $3);
98 $used = 0 if ($used =~ /none/i);
99 $not_ready = 0 if ($not_ready =~ /none/i);
100
101 my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'disk', instance => '1', value => $total - $used - $not_ready);
102
103 $self->{output}->output_add(long_msg => sprintf("'%s' spare disk availables on '%s'",
104 $total - $used - $not_ready, $total));
105 if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
106 $self->{output}->output_add(severity => $exit,
107 short_msg => sprintf("'%s' spare disk availables on '%s'",
108 $total - $used - $not_ready, $total));
109 }
110
111 $self->{output}->perfdata_add(
112 label => "disk_spare_available",
113 nlabel => 'hardware.disk.spare.available.count',
114 value => $total - $used - $not_ready,
115 warning => $warn,
116 critical => $crit, min => 0, max => $total
117 );
118 }
119
120 1;