Debian Codegraph @

src/storage/netapp/santricity/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::netapp::santricity::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} = '^(?:drive.temperature)$';
32
33 $self->{cb_hook2} = 'execute_custom';
34
35 $self->{thresholds} = {
36 battery => [
37 ['optimal', 'OK'],
38 ['fullCharging', 'OK'],
39 ['nearExpiration', 'WARNING'],
40 ['failed', 'CRITICAL'],
41 ['removed', 'OK'],
42 ['unknown', 'UNKNOWN'],
43 ['notInConfig', 'WARNING'],
44 ['configMismatch', 'WARNING'],
45 ['learning', 'OK'],
46 ['overtemp', ''],
47 ['expired', 'WARNING'],
48 ['maintenanceCharging', 'OK'],
49 ['replacementRequired', 'CRITICAL']
50 ],
51 board => [
52 ['unknown', 'UNKNOWN'],
53 ['optimal', 'OK'],
54 ['needsAttention', 'WARNING'],
55 ['notPresent', 'OK'],
56 ['degraded', 'WARNING'],
57 ['failed', 'CRITICAL'],
58 ['diagInProgress', 'OK']
59 ],
60 cbd => [
61 ['unknown', 'UNKNOWN'],
62 ['optimal', 'OK'],
63 ['failed', 'CRITICAL'],
64 ['removed', 'OK'],
65 ['writeProtected', 'OK'],
66 ['incompatible', 'CRITICAL']
67 ],
68 cmd => [
69 ['unknown', 'UNKNOWN'],
70 ['optimal', 'OK'],
71 ['failed', 'CRITICAL'],
72 ['empty', 'OK']
73 ],
74 ctrl => [
75 ['unknown', 'UNKNOWN'],
76 ['optimal', 'OK'],
77 ['failed', 'CRITICAL'],
78 ['removed', 'OK'],
79 ['rpaParErr', 'WARNING'],
80 ['serviceMode', 'OK'],
81 ['suspended', 'OK'],
82 ['degraded', 'WARNING']
83 ],
84 drive => [
85 ['optimal', 'OK'],
86 ['failed', 'CRITICAL'],
87 ['replaced', 'OK'],
88 ['bypassed', 'OK'],
89 ['unresponsive', 'WARNING'],
90 ['removed', 'OK'],
91 ['incompatible', 'WARNING'],
92 ['dataRelocation', 'OK'],
93 ['preFailCopy', 'WARNING'],
94 ['preFailCopyPending', 'WARNING']
95 ],
96 fan => [
97 ['optimal', 'OK'],
98 ['removed', 'OK'],
99 ['failed', 'CRITICAL'],
100 ['unknown', 'UNKNOWN']
101 ],
102 psu => [
103 ['optimal', 'OK'],
104 ['removed', 'OK'],
105 ['failed', 'CRITICAL'],
106 ['unknown', 'UNKNOWN'],
107 ['noinput', 'WARNING']
108 ],
109 storage => [
110 ['neverContacted', 'UNKNOWN'],
111 ['offline', 'OK'],
112 ['optimal', 'OK'],
113 ['needsAttn', 'WARNING'],
114 ['newDevice', 'OK'],
115 ['lockDown', 'WARNING']
116 ],
117 thsensor => [
118 ['optimal', 'OK'],
119 ['nominalTempExceed', 'WARNING'],
120 ['maxTempExceed', 'CRITICAL'],
121 ['unknown', 'UNKNOWN'],
122 ['removed', 'OK']
123 ]
124 };
125
126 $self->{components_exec_load} = 0;
127
128 $self->{components_path} = 'storage::netapp::santricity::restapi::mode::components';
129 $self->{components_module} = [
130 'storage', 'ctrl', 'battery', 'board', 'cbd', 'cmd', 'drive', 'psu', 'fan',
131 'thsensor'
132 ];
133 }
134
135 sub new {
136 my ($class, %options) = @_;
137 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1);
138 bless $self, $class;
139
140 $options{options}->add_options(arguments => {});
141
142 return $self;
143 }
144
145 sub execute_custom {
146 my ($self, %options) = @_;
147
148 $self->{json_results} = $options{custom}->execute_storages_request(
149 endpoints => [ { endpoint => '/hardware-inventory' } ]
150 );
151 }
152
153 1;
154
155 =head1 MODE
156
157 Check hardware.
158
159 =over 8
160
161 =item B<--component>
162
163 Which component to check (default: '.*').
164 Can be: 'storage', 'ctrl', 'battery', 'board', 'cbd', 'cmd', 'drive', 'psu', 'fan', 'thsensor'.
165
166 =item B<--filter>
167
168 Exclude some parts (comma separated list)
169 You can also exclude items from specific instances: --filter='drive,010000005000C500C244251B0000000000000000'
170
171 =item B<--no-component>
172
173 Define the expected status if no components are found (default: critical).
174
175 =item B<--threshold-overload>
176
177 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp).
178 Example: --threshold-overload='drive,OK,preFailCopy'
179
180 =item B<--warning>
181
182 Set warning threshold for 'temperature' (syntax: type,regexp,threshold)
183 Example: --warning='drive.temperature,.*,40'
184
185 =item B<--critical>
186
187 Set critical threshold for 'drive.temperature' (syntax: type,regexp,threshold)
188 Example: --critical='drive.temperature,.*,50'
189
190 =back
191
192 =cut