Debian Codegraph @

src/network/nortel/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::nortel::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} = '^(?:temperature|fan.temperature)$';
32
33 $self->{cb_hook2} = 'snmp_execute';
34
35 $self->{thresholds} = {
36 fan => [
37 ['up', 'OK'],
38 ['down', 'CRITICAL'],
39 ['unknown', 'UNKNOWN'],
40 ['notpresent', 'OK']
41 ],
42 psu => [
43 ['up', 'OK'],
44 ['down', 'CRITICAL'],
45 ['unknown', 'UNKNOWN'],
46 ['empty', 'OK']
47 ],
48 card => [
49 ['up', 'OK'],
50 ['down', 'CRITICAL'],
51 ['unknown', 'UNKNOWN'],
52 ['testing', 'OK'],
53 ['dormant', 'OK']
54 ],
55 entity => [
56 ['other', 'UNKNOWN'],
57 ['notAvail', 'OK'],
58 ['removed', 'OK'],
59 ['disabled', 'OK'],
60 ['normal', 'OK'],
61 ['resetInProg', 'OK'],
62 ['testing', 'OK'],
63 ['warning', 'WARNING'],
64 ['nonFatalErr', 'WARNING'],
65 ['fatalErr', 'CRITICAL'],
66 ['notConfig', 'OK'],
67 ['obsoleted', 'WARNING']
68 ],
69 led => [
70 ['unknown', 'UNKNOWN'],
71 ['greenSteady', 'OK'],
72 ['greenBlinking', 'OK'],
73 ['amberSteady', 'WARNING'],
74 ['amberBlinking', 'WARNING'],
75 ['greenamberBlinking', 'WARNING'],
76 ['off', 'OK']
77 ]
78 };
79
80 $self->{components_path} = 'network::nortel::standard::snmp::mode::components';
81 $self->{components_module} = ['card', 'entity', 'fan', 'led', 'psu', 'temperature'];
82 }
83
84 sub snmp_execute {
85 my ($self, %options) = @_;
86
87 $self->{snmp} = $options{snmp};
88 $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
89 }
90
91 sub new {
92 my ($class, %options) = @_;
93 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1);
94 bless $self, $class;
95
96 $options{options}->add_options(arguments => {});
97
98 return $self;
99 }
100
101 1;
102
103 __END__
104
105 =head1 MODE
106
107 Check hardware.
108
109 =over 8
110
111 =item B<--component>
112
113 Which component to check (default: '.*').
114 Can be: 'fan', 'psu', 'card', 'entity', 'led'.
115
116 =item B<--filter>
117
118 Exclude the items given as a comma-separated list (example: --filter=psu).
119 You can also exclude items from specific instances: --filter=psu,1
120
121 =item B<--no-component>
122
123 Define the expected status if no components are found (default: critical).
124
125 =item B<--threshold-overload>
126
127 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp).
128 Example: --threshold-overload='entity,WARNING,disabled'
129
130 =item B<--warning>
131
132 Set warning threshold (syntax: type,regexp,threshold)
133 Example: --warning='temperature,.*,30' --warning=fan.temperature,.*,10
134
135 =item B<--critical>
136
137 Set critical threshold (syntax: type,regexp,threshold)
138 Example: --critical='temperature,.*,40'
139
140 =back
141
142 =cut