Debian Codegraph @

src/storage/hp/3par/ssh/mode/hardware.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::hp::3par::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} = '^(battery\.charge|sensor)$';
32
33 $self->{cb_hook2} = 'ssh_execute';
34
35 $self->{thresholds} = {
36 default => [
37 ['normal', 'OK'], # disk only
38 ['ok', 'OK'],
39 ['new', 'OK'],
40 ['degraded', 'WARNING'],
41 ['failed', 'CRITICAL']
42 ],
43 'default.status' => [
44 ['enabled', 'OK'],
45 ['.*', 'CRITICAL']
46 ],
47 'default.state' => [
48 ['active', 'OK'],
49 ['.*', 'CRITICAL']
50 ],
51 port => [
52 ['ready', 'OK'],
53 ['loss_sync', 'WARNING'],
54 ['offline', 'CRITICAL']
55 ]
56 };
57
58 $self->{components_path} = 'storage::hp::3par::ssh::mode::components';
59 $self->{components_module} = ['battery', 'cim', 'port', 'node', 'disk', 'psu', 'sensor', 'wsapi'];
60 }
61
62 sub ssh_execute {
63 my ($self, %options) = @_;
64
65 ($self->{results}, $self->{exit_code}) = $options{custom}->execute_command(commands => $self->{commands});
66 }
67
68 sub new {
69 my ($class, %options) = @_;
70 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1);
71 bless $self, $class;
72
73 $options{options}->add_options(arguments => {});
74
75 $self->{commands} = [];
76 return $self;
77 }
78
79 1;
80
81 __END__
82
83 =head1 MODE
84
85 Check components.
86
87 =over 8
88
89 =item B<--component>
90
91 Which component to check (default: '.*').
92 Can be: 'battery', 'cim', 'port', 'node', 'disk', 'psu', 'sensor', 'wsapi'.
93
94 =item B<--filter>
95
96 Exclude the items given as a comma-separated list (example: --filter=battery --filter=cim).
97 You can also exclude items from specific instances: --filter=port,free
98
99 =item B<--add-name-instance>
100
101 Add literal description for instance value (used in filter and threshold options).
102
103 =item B<--no-component>
104
105 Define the expected status if no components are found (default: critical).
106
107 =item B<--threshold-overload>
108
109 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp).
110 Example: --threshold-overload='battery,OK,degraded'
111
112 =item B<--warning>
113
114 Set warning threshold for 'battery.charge' (syntax: type,regexp,threshold)
115 Example: --warning='battery.charge,.*,30'
116
117 =item B<--critical>
118
119 Set critical threshold for 'battery.charge' (syntax: type,regexp,threshold)
120 Example: --critical='battery.charge,.*,50'
121
122 =back
123
124 =cut