| 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::ibm::storwize::ssh::mode::hardware; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::hardware); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
|
| 28 |
sub set_system { |
| 29 |
my ($self, %options) = @_; |
| 30 |
|
| 31 |
$self->{regexp_threshold_numeric_check_section_option} = '^(systemstats)$'; |
| 32 |
|
| 33 |
$self->{cb_hook2} = 'ssh_execute'; |
| 34 |
|
| 35 |
$self->{thresholds} = { |
| 36 |
default => [ |
| 37 |
['online', 'OK'], |
| 38 |
['offline', 'CRITICAL'], |
| 39 |
['degraded', 'WARNING'], |
| 40 |
['excluded', 'OK'], # lsarray |
| 41 |
['mask', 'OK'] # lshost |
| 42 |
], |
| 43 |
portfc => [ |
| 44 |
['active', 'OK'], |
| 45 |
['inactive_unconfigured', 'OK'], |
| 46 |
['.*', 'CRITICAL'] |
| 47 |
], |
| 48 |
portsas => [ |
| 49 |
['online', 'OK'], |
| 50 |
['offline_unconfigured', 'OK'], |
| 51 |
['excluded', 'OK'], |
| 52 |
['offline', 'CRITICAL'], |
| 53 |
['degraded', 'WARNING'] |
| 54 |
], |
| 55 |
mdisk => [ |
| 56 |
['online', 'OK'], |
| 57 |
['excluded', 'OK'], |
| 58 |
['offline', 'CRITICAL'], |
| 59 |
['degraded_paths', 'WARNING'], |
| 60 |
['degraded_ports', 'WARNING'], |
| 61 |
['degraded', 'WARNING'] |
| 62 |
] |
| 63 |
}; |
| 64 |
|
| 65 |
$self->{components_path} = 'storage::ibm::storwize::ssh::mode::components'; |
| 66 |
$self->{components_module} = [ |
| 67 |
'array', 'drive', 'enclosure', 'enclosurebattery', 'enclosurecanister', |
| 68 |
'enclosurepsu', 'host', 'portfc', 'portsas', 'vdisk', 'node', 'quorum', 'mdisk', 'systemstats' |
| 69 |
]; |
| 70 |
} |
| 71 |
|
| 72 |
sub ssh_execute { |
| 73 |
my ($self, %options) = @_; |
| 74 |
|
| 75 |
($self->{results}) = $options{custom}->execute_command(command => $self->{ssh_commands}); |
| 76 |
$self->{custom} = $options{custom}; |
| 77 |
} |
| 78 |
|
| 79 |
sub new { |
| 80 |
my ($class, %options) = @_; |
| 81 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1); |
| 82 |
bless $self, $class; |
| 83 |
|
| 84 |
$options{options}->add_options(arguments => {}); |
| 85 |
|
| 86 |
$self->{ssh_commands} = ''; |
| 87 |
return $self; |
| 88 |
} |
| 89 |
|
| 90 |
1; |
| 91 |
|
| 92 |
__END__ |
| 93 |
|
| 94 |
=head1 MODE |
| 95 |
|
| 96 |
Check components. |
| 97 |
|
| 98 |
=over 8 |
| 99 |
|
| 100 |
=item B<--component> |
| 101 |
|
| 102 |
Which component to check (default: '.*'). |
| 103 |
Can be: 'array', 'drive', 'enclosure', 'enclosurebattery', 'enclosurecanister', |
| 104 |
'enclosurepsu', 'host', 'portfc', 'portsas', 'vdisk', 'node', 'quorum', 'mdisk', 'systemstats'. |
| 105 |
|
| 106 |
=item B<--add-name-instance> |
| 107 |
|
| 108 |
Add literal description for instance value (used in filter, absent-problem and threshold options). |
| 109 |
|
| 110 |
=item B<--filter> |
| 111 |
|
| 112 |
Exclude the items given as a comma-separated list (example: --filter=host --filter=enclosurecanister). |
| 113 |
You can also exclude items from specific instances: --filter=host,10 |
| 114 |
|
| 115 |
=item B<--no-component> |
| 116 |
|
| 117 |
Define the expected status if no components are found (default: critical). |
| 118 |
|
| 119 |
=item B<--threshold-overload> |
| 120 |
|
| 121 |
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). |
| 122 |
Example: ---threshold-overload='host,.*,OK,degraded' |
| 123 |
|
| 124 |
=item B<--warning> |
| 125 |
|
| 126 |
Set warning threshold for temperatures (syntax: type,regexp,threshold) |
| 127 |
Example: --warning='systemstats,cpu_pc,30' |
| 128 |
|
| 129 |
=item B<--critical> |
| 130 |
|
| 131 |
Set critical threshold for temperatures (syntax: type,regexp,threshold) |
| 132 |
Example: --critical='systemstats,cpu_pc,40' |
| 133 |
|
| 134 |
=back |
| 135 |
|
| 136 |
=cut |