Debian Codegraph @

src/network/hp/vc/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::hp::vc::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->{cb_hook2} = 'snmp_execute';
32
33 $self->{thresholds} = {
34 default => [
35 ['unknown', 'UNKNOWN'],
36 ['normal', 'OK'],
37 ['warning', 'WARNING'],
38 ['minor', 'WARNING'],
39 ['major', 'CRITICAL'],
40 ['critical', 'CRITICAL'],
41 ['disabled', 'OK'],
42 ['info', 'OK']
43 ],
44 'moduleport.loop' => [
45 ['ok', 'OK'],
46 ['loop-detected', 'CRITICAL']
47 ],
48 'moduleport.protection' => [
49 ['ok', 'OK'],
50 ['pause-flood-detected', 'CRITICAL'],
51 ['in-pause-condition', 'WARNING']
52 ],
53 };
54
55 $self->{components_path} = 'network::hp::vc::snmp::mode::components';
56 $self->{components_module} = ['domain', 'enclosure', 'module', 'moduleport', 'port', 'physicalserver', 'enet', 'fc', 'profile'];
57 }
58
59 sub snmp_execute {
60 my ($self, %options) = @_;
61
62 $self->{snmp} = $options{snmp};
63 $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
64 }
65
66 sub new {
67 my ($class, %options) = @_;
68 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_performance => 1, no_absent => 1);
69 bless $self, $class;
70
71 $options{options}->add_options(arguments => {
72 });
73
74 return $self;
75 }
76
77 1;
78
79 __END__
80
81 =head1 MODE
82
83 Check Hardware.
84
85 =over 8
86
87 =item B<--component>
88
89 Which component to check (default: '.*').
90 Can be: 'domain', 'enclosure', 'module', 'moduleport', 'port', 'physicalserver', 'enet', 'fc', 'profile'.
91
92 =item B<--filter>
93
94 Exclude the items given as a comma-separated list (example: --filter=enet --filter=fc).
95 You can also exclude items from specific instances: --filter=fc,1
96
97 =item B<--no-component>
98
99 Define the expected status if no components are found (default: critical).
100
101
102 =item B<--threshold-overload>
103
104 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp).
105 Example: --threshold-overload='module,CRITICAL,^(?!(normal)$)'
106
107 =back
108
109 =cut