Debian Codegraph @

src/network/dlink/standard/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 network::dlink::standard::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} = '^(fan|temperature)$';
32
33 $self->{cb_hook2} = 'snmp_execute';
34
35 $self->{thresholds} = {
36 psu => [
37 ['inOperation', 'OK'],
38 ['failed', 'CRITICAL'],
39 ['empty', 'OK'],
40
41 ['connect', 'OK'],
42 ['working', 'OK'],
43 ['other', 'UNKNOWN'],
44 ['lowVoltage', 'WARNING'],
45 ['overCurrent', 'CRITICAL'],
46 ['fail', 'CRITICAL'],
47 ['disconnect', 'WARNING']
48 ],
49 fan => [
50 ['ok', 'OK'],
51 ['fault', 'CRITICAL'],
52
53 ['working', 'OK'],
54 ['fail', 'CRITICAL'],
55 ['other', 'UNKNOWN'],
56 ['speed-0', 'WARNING'],
57 ['speed-low', 'WARNING'],
58 ['speed-middle', 'OK'],
59 ['speed-high', 'WARNING']
60 ],
61 temperature => [
62 ['ok', 'OK'],
63 ['abnormal', 'CRITICAL']
64 ]
65 };
66
67 $self->{components_path} = 'network::dlink::standard::snmp::mode::components';
68 $self->{components_module} = ['fan', 'psu', 'temperature'];
69 }
70
71 sub snmp_execute {
72 my ($self, %options) = @_;
73
74 $self->{snmp} = $options{snmp};
75 $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
76 }
77
78 sub new {
79 my ($class, %options) = @_;
80 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1);
81 bless $self, $class;
82
83 $options{options}->add_options(arguments => {});
84
85 return $self;
86 }
87
88 1;
89
90 __END__
91
92 =head1 MODE
93
94 Check hardware (Fans, Power Supplies, Temperatures).
95
96 =over 8
97
98 =item B<--component>
99
100 Which component to check (default: '.*').
101 Can be: 'psu', 'fan', 'temperature'.
102
103 =item B<--filter>
104
105 Exclude the items given as a comma-separated list (example: --filter=psu).
106 You can also exclude items from specific instances: --filter=fan,1.1
107
108 =item B<--no-component>
109
110 Define the expected status if no components are found (default: critical).
111
112
113 =item B<--threshold-overload>
114
115 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,status,regexp).
116 Example: --threshold-overload='fan,CRITICAL,^(?!(working)$)'
117
118 =item B<--warning>
119
120 Set warning threshold for temperatures (syntax: section,[instance,]status,regexp)
121 Example: --warning='temperature,.*,30' --warning='fan,.*,1000'
122
123 =item B<--critical>
124
125 Set critical threshold for temperatures (syntax: section,[instance,]status,regexp)
126 Example: --critical='temperature,.*,40'
127
128 =back
129
130 =cut