Debian Codegraph @

src/storage/dell/equallogic/snmp/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::equallogic::snmp::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} = '^(?:temperature|fan)$';
32
33 $self->{cb_hook1} = 'get_system_information';
34 $self->{cb_hook2} = 'snmp_execute';
35
36 $self->{thresholds} = {
37 fan => [
38 ['unknown', 'UNKNOWN'],
39 ['normal', 'OK'],
40 ['warning', 'WARNING'],
41 ['critical', 'CRITICAL']
42 ],
43 temperature => [
44 ['unknown', 'UNKNOWN'],
45 ['normal', 'OK'],
46 ['warning', 'WARNING'],
47 ['critical', 'CRITICAL']
48 ],
49 health => [
50 ['unknown', 'UNKNOWN'],
51 ['normal', 'OK'],
52 ['warning', 'WARNING'],
53 ['critical', 'CRITICAL']
54 ],
55 psu => [
56 ['on-and-operating', 'OK'],
57 ['no-ac-power', 'CRITICAL'],
58 ['failed-or-no-data', 'CRITICAL']
59 ],
60 'psu.fan' => [
61 ['not-applicable', 'OK'],
62 ['fan-is-operational', 'OK'],
63 ['fan-not-operational', 'CRITICAL']
64 ],
65 raid => [
66 ['ok', 'OK'],
67 ['degraded', 'WARNING'],
68 ['verifying', 'OK'],
69 ['reconstructing', 'WARNING'],
70 ['failed', 'CRITICAL'],
71 ['catastrophicLoss', 'CRITICAL'],
72 ['expanding', 'OK'],
73 ['mirroring', 'OK']
74 ],
75 disk => [
76 ['on-line', 'OK'],
77 ['spare', 'OK'],
78 ['failed', 'CRITICAL'],
79 ['off-line', 'WARNING'],
80 ['alt-sig', 'WARNING'],
81 ['too-small', 'WARNING'],
82 ['history-of-failures', 'WARNING'],
83 ['unsupported-version', 'CRITICAL'],
84 ['unhealthy', 'CRITICAL'],
85 ['replacement', 'CRITICAL']
86 ]
87 };
88
89 $self->{components_path} = 'storage::dell::equallogic::snmp::mode::components';
90 $self->{components_module} = ['fan', 'psu', 'temperature', 'raid', 'disk', 'health'];
91 }
92
93 sub new {
94 my ($class, %options) = @_;
95 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1);
96 bless $self, $class;
97
98 $options{options}->add_options(arguments => {});
99
100 return $self;
101 }
102
103 my $oid_eqlMemberName = '.1.3.6.1.4.1.12740.2.1.1.1.9';
104
105 sub snmp_execute {
106 my ($self, %options) = @_;
107
108 $self->{snmp} = $options{snmp};
109 push @{$self->{request}}, { oid => $oid_eqlMemberName };
110 $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
111 }
112
113 sub get_member_name {
114 my ($self, %options) = @_;
115
116 my $name = defined($self->{results}->{$oid_eqlMemberName}->{$oid_eqlMemberName . '.' . $options{instance}}) ?
117 $self->{results}->{$oid_eqlMemberName}->{$oid_eqlMemberName . '.' . $options{instance}} : 'unknown';
118 return $name;
119 }
120
121 1;
122
123 __END__
124
125 =head1 MODE
126
127 Check Hardware (Power Supplies, Fans, Temperatures, Raids, Disks, Health).
128
129 =over 8
130
131 =item B<--component>
132
133 Which component to check (default: '.*').
134 Can be: 'fan', 'psu', 'temperature', 'raid', 'disk', 'health'.
135
136 =item B<--filter>
137
138 Exclude the items given as a comma-separated list (example: --filter=fan --filter=psu).
139 You can also exclude items from specific instances: --filter=fan,1
140
141 =item B<--no-component>
142
143 Define the expected status if no components are found (default: critical).
144
145 =item B<--threshold-overload>
146
147 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,status,regexp).
148 Example: --threshold-overload='fan,CRITICAL,^(?!(normal)$)'
149
150 =item B<--warning>
151
152 Set warning threshold for 'temperature', 'fan' (syntax: type,regexp,threshold)
153 Example: --warning='temperature,.*,30'
154
155 =item B<--critical>
156
157 Set critical threshold for 'temperature', 'fan' (syntax: type,regexp,threshold)
158 Example: --critical='temperature,.*,40'
159
160 =back
161
162 =cut