Debian Codegraph @

src/storage/dell/me4/restapi/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::dell::me4::restapi::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} = '^(fan|disk|sensor)$';
32
33 $self->{cb_hook1} = 'init_custom';
34
35 $self->{thresholds} = {
36 controller => [
37 ['OK', 'OK'],
38 ['Operational', 'OK'],
39 ['Redundant', 'OK'],
40 ['Redundant with independent cache', 'OK'],
41 ['Degraded', 'WARNING'],
42 ['Operational but not redundant', 'WARNING'],
43 ['Fault', 'CRITICAL'],
44 ['Down', 'CRITICAL'],
45 ['N/A', 'UNKNOWN'],
46 ['Unknown', 'UNKNOWN'],
47 ['Not Installed', 'UNKNOWN']
48 ],
49 disk => [
50 ['OK', 'OK'],
51 ['Up', 'OK'],
52 ['AVAIL', 'OK'],
53 ['LINEAR POOL', 'OK'],
54 ['LINEAR POOLVRSC', 'OK'],
55 ['DEDICATED SP', 'OK'],
56 ['GLOBAL SP', 'OK'],
57 ['LEFTOVR', 'OK'],
58 ['VDISK', 'OK'],
59 ['VDISK SP', 'OK'],
60 ['VIRTUAL POOL', 'OK'],
61 ['Degraded', 'WARNING'],
62 ['Warning', 'WARNING'],
63 ['Unsupported', 'WARNING'],
64 ['Fault', 'CRITICAL'],
65 ['Spun Down', 'CRITICAL'],
66 ['Error', 'CRITICAL'],
67 ['Unrecoverable', 'CRITICAL'],
68 ['Unavailable', 'CRITICAL'],
69 ['FAILED', 'CRITICAL'],
70 ['UNUSABLE', 'CRITICAL'],
71 ['N/A', 'UNKNOWN'],
72 ['Unknown', 'UNKNOWN'],
73 ['Not Present', 'UNKNOWN']
74 ],
75 fan => [
76 ['OK', 'OK'],
77 ['Up', 'OK'],
78 ['Degraded', 'WARNING'],
79 ['Error', 'CRITICAL'],
80 ['Fault', 'CRITICAL'],
81 ['Missing', 'UNKNOWN'],
82 ['Off', 'UNKNOWN'],
83 ['N/A', 'UNKNOWN'],
84 ['Unknown', 'UNKNOWN']
85 ],
86 fru => [
87 ['OK', 'OK'],
88 ['Fault', 'CRITICAL'],
89 ['Invalid Data', 'CRITICAL'],
90 ['Power OFF', 'UNKNOWN'],
91 ['Absent', 'UNKNOWN']
92 ],
93 psu => [
94 ['OK', 'OK'],
95 ['Up', 'OK'],
96 ['Degraded', 'WARNING'],
97 ['Error', 'CRITICAL'],
98 ['Fault', 'CRITICAL'],
99 ['Missing', 'UNKNOWN'],
100 ['Off', 'UNKNOWN'],
101 ['N/A', 'UNKNOWN'],
102 ['Unknown', 'UNKNOWN']
103 ],
104 sensor => [
105 ['OK', 'OK'],
106 ['Warning', 'WARNING'],
107 ['Critical', 'CRITICAL'],
108 ['Unavailable', 'CRITICAL'],
109 ['Unrecoverable', 'UNKNOWN'],
110 ['Not Installed', 'UNKNOWN'],
111 ['Unsupported', 'UNKNOWN'],
112 ['Unknown', 'UNKNOWN']
113 ],
114 volume => [
115 ['OK', 'OK'],
116 ['Degraded', 'WARNING'],
117 ['Fault', 'CRITICAL'],
118 ['N/A', 'UNKNOWN'],
119 ['Unknown', 'UNKNOWN']
120 ]
121 };
122
123 $self->{components_path} = 'storage::dell::me4::restapi::mode::components';
124 $self->{components_module} = ['controller', 'disk', 'fan', 'fru', 'psu', 'sensor', 'volume'];
125 }
126
127 sub new {
128 my ($class, %options) = @_;
129 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1);
130 bless $self, $class;
131
132 $options{options}->add_options(arguments => {});
133
134 return $self;
135 }
136
137 sub init_custom {
138 my ($self, %options) = @_;
139
140 $self->{custom} = $options{custom};
141 }
142
143 1;
144
145 =head1 MODE
146
147 Check hardware.
148
149 =over 8
150
151 =item B<--component>
152
153 Which component to check (default: '.*').
154 Can be: 'controller', 'disk', 'fan', 'fru', 'psu', 'sensor', 'volume'.
155
156 =item B<--filter>
157
158 Exclude some parts (comma separated list)
159 You can also exclude items from specific instances: --filter='sensor,Overall Sensor'
160
161 =item B<--no-component>
162
163 Define the expected status if no components are found (default: critical).
164
165 =item B<--threshold-overload>
166
167 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp).
168 Example: --threshold-overload='controller,OK,Operational but not redundant'
169
170 =item B<--warning>
171
172 Set warning threshold for 'temperature' (syntax: type,regexp,threshold)
173 Example: --warning='temperature,.*,40'
174
175 =item B<--critical>
176
177 Set critical threshold for 'temperature' (syntax: type,regexp,threshold)
178 Example: --critical='temperature,.*,50'
179
180 =back
181
182 =cut