| 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::director; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::mode); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
|
| 28 |
# ---------------[ Director Status ]------------- |
| 29 |
# |
| 30 |
# 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 |
| 31 |
# |
| 32 |
# D ON .. .. .. .. .. .. ON ON .. .. .. .. .. .. ON |
| 33 |
# C ON .. .. .. .. .. .. ON ON .. .. .. .. .. .. ON |
| 34 |
# B ON .. .. .. .. .. .. DD ON .. .. .. .. .. .. ON |
| 35 |
# A ON .. .. .. .. .. .. ON ON .. .. .. .. .. .. ON |
| 36 |
# |
| 37 |
# Key: |
| 38 |
# ON - Director is online |
| 39 |
# OF - Director is offline |
| 40 |
# OF - DA is offline |
| 41 |
# DD - Director is in DD state |
| 42 |
# PR - Director is in Probe mode |
| 43 |
# NC - Director is not comunicating |
| 44 |
# ** - Director status is unknown |
| 45 |
|
| 46 |
my %mapping = ( |
| 47 |
DD => 'DD state', |
| 48 |
PR => 'Probe mode', |
| 49 |
NC => 'not comunicating', |
| 50 |
'**' => 'unknown',, |
| 51 |
OF => 'offline', |
| 52 |
ON => 'online',, |
| 53 |
'..' => 'not configured', |
| 54 |
); |
| 55 |
|
| 56 |
sub check { |
| 57 |
my ($self) = @_; |
| 58 |
|
| 59 |
$self->{output}->output_add(long_msg => "Checking directors"); |
| 60 |
$self->{components}->{director} = {name => 'directors', total => 0, skip => 0}; |
| 61 |
return if ($self->check_filter(section => 'director')); |
| 62 |
|
| 63 |
if ($self->{content_file_health} !~ /---------------\[ Director Status(.*?)----\[/msi) { |
| 64 |
$self->{output}->output_add(long_msg => 'skipping: cannot find directors'); |
| 65 |
return ; |
| 66 |
} |
| 67 |
|
| 68 |
my $content = $1; |
| 69 |
while ($content =~ /\s([A-Z]\s+.*?)\n/msig) { |
| 70 |
my ($director, @nums) = split /\s+/, $1; |
| 71 |
my $i = 0; |
| 72 |
foreach (@nums) { |
| 73 |
$i++; |
| 74 |
my $state = defined($mapping{$_}) ? $mapping{$_} : 'unknown'; |
| 75 |
my $instance = $director . '.' . $i; |
| 76 |
|
| 77 |
next if ($self->check_filter(section => 'director', instance => $instance)); |
| 78 |
$self->{components}->{director}->{total}++; |
| 79 |
|
| 80 |
$self->{output}->output_add(long_msg => sprintf("director '%s' state is '%s'", |
| 81 |
$instance, $state)); |
| 82 |
my $exit = $self->get_severity(section => 'director', value => $state); |
| 83 |
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { |
| 84 |
$self->{output}->output_add(severity => $exit, |
| 85 |
short_msg => sprintf("Director '%s' state is '%s'", |
| 86 |
$instance, $state)); |
| 87 |
} |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
1; |