Debian Codegraph @

src/storage/netapp/ontap/snmp/mode/shelf.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::ontap::snmp::mode::shelf;
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} = '^(voltage|temperature|fan)$';
32
33 $self->{cb_hook1} = 'init_shelf';
34 $self->{cb_hook2} = 'snmp_execute';
35
36 $self->{thresholds} = {
37 communication => [
38 ['initializing', 'WARNING'],
39 ['transitioning', 'WARNING'],
40 ['inactive', 'CRITICAL'],
41 ['reconfiguring', 'WARNING'],
42 ['nonexistent', 'CRITICAL'],
43 ['active', 'OK'],
44 ],
45 raid => [
46 ['initializing', 'WARNING'],
47 ['reconstructionInProgress', 'WARNING'],
48 ['parityVerificationInProgress', 'OK'],
49 ['scrubbingInProgress', 'OK'],
50 ['prefailed', 'CRITICAL'],
51 ['failed', 'CRITICAL'],
52 ['active', 'OK'],
53 ],
54 fan => [
55 ['failed', 'CRITICAL'],
56 ['ok', 'OK'],
57 ],
58 psu => [
59 ['failed', 'CRITICAL'],
60 ['ok', 'OK'],
61 ],
62 electronics => [
63 ['failed', 'CRITICAL'],
64 ['ok', 'OK'],
65 ],
66 voltage => [
67 ['under critical threshold', 'CRITICAL'],
68 ['under warning threshold', 'WARNING'],
69 ['over critical threshold', 'CRITICAL'],
70 ['over warning threshold', 'WARNING'],
71 ['ok', 'OK'],
72 ],
73 temperature => [
74 ['under critical threshold', 'CRITICAL'],
75 ['under warning threshold', 'WARNING'],
76 ['over critical threshold', 'CRITICAL'],
77 ['over warning threshold', 'WARNING'],
78 ['ok', 'OK'],
79 ],
80 };
81
82 $self->{components_path} = 'storage::netapp::ontap::snmp::mode::components';
83 $self->{components_module} = ['communication', 'psu', 'fan', 'temperature', 'voltage', 'electronics', 'raid'];
84 }
85
86 my $oid_enclNumber = '.1.3.6.1.4.1.789.1.21.1.1';
87 my $oid_enclChannelShelfAddr = '.1.3.6.1.4.1.789.1.21.1.2.1.3';
88
89 sub snmp_execute {
90 my ($self, %options) = @_;
91
92 $self->{snmp} = $options{snmp};
93 $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
94 $self->{number_shelf} = defined($self->{results}->{$oid_enclNumber}->{$oid_enclNumber . '.0'}) ? $self->{results}->{$oid_enclNumber}->{$oid_enclNumber . '.0'} : -1;
95 $self->{shelf_addr} = $self->{results}->{$oid_enclChannelShelfAddr};
96 }
97
98 sub new {
99 my ($class, %options) = @_;
100 my $self = $class->SUPER::new(package => __PACKAGE__, %options);
101 bless $self, $class;
102
103 $options{options}->add_options(arguments => {
104 });
105
106 return $self;
107 }
108
109 sub init_shelf {
110 my ($self, %options) = @_;
111
112 push @{$self->{request}}, ({ oid => $oid_enclNumber }, { oid => $oid_enclChannelShelfAddr });
113 }
114
115 1;
116
117 __END__
118
119 =head1 MODE
120
121 Check Shelves hardware (temperatures, voltages, electronics, fan, power supplies).
122
123 =over 8
124
125 =item B<--component>
126
127 Which component to check (default: '.*').
128 Can be: 'psu', 'fan', 'communication', 'voltage', 'temperature', 'electronics', 'raid'.
129
130 =item B<--filter>
131
132 Exclude the items given as a comma-separated list (example: --filter=fan --filter=psu).
133 You can also exclude items from specific instances: --filter=psu,41239F00647-A
134
135 =item B<--absent-problem>
136
137 Return an error if an entity is not 'present' (default is skipping) (comma separated list)
138 Can be specific or global: --absent-problem=fan,41239F00647-fan02
139
140 =item B<--no-component>
141
142 Define the expected status if no components are found (default: critical).
143
144 =item B<--threshold-overload>
145
146 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp).
147 Example: --threshold-overload='gfc,CRITICAL,^(?!(Online)$)'
148
149 =item B<--warning>
150
151 Set warning threshold for temperature, fan, voltage (syntax: type,regexp,threshold)
152 Example: --warning='41239F00647-vimm46,20' --warning='41239F00647-vimm5.*,30'
153
154 =item B<--critical>
155
156 Set critical threshold for temperature, fan, voltage (syntax: type,regexp,threshold)
157 Example: --critical='temperature,.*,25' --warning='temperature,.*,35'
158
159 =back
160
161 =cut
162