Debian Codegraph @

src/storage/buffalo/terastation/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::buffalo::terastation::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 disk => [
35 ['notSupport', 'WARNING'],
36 ['normal', 'OK'],
37 ['array1', 'OK'],
38 ['array2', 'OK'],
39 ['standby', 'OK'],
40 ['degrade', 'WARNING'],
41 ['remove', 'OK'],
42 ['standbyRemoved', 'OK'],
43 ['degradeRemoved', 'WARNING'],
44 ['removeRemoved', 'OK'],
45 ['array3', 'OK'],
46 ['array4', 'OK'],
47 ['mediaCartridge', 'OK'],
48 ['array5', 'OK'],
49 ['array6', 'OK']
50 ],
51 iscsi => [
52 ['unknown', 'WARNING'],
53 ['connected', 'OK'],
54 ['standing-by', 'OK']
55 ],
56 psu => [
57 ['unknown', 'WARNING'],
58 ['fine', 'OK'],
59 ['broken', 'CRITICAL']
60 ]
61 };
62
63 $self->{components_path} = 'storage::buffalo::terastation::snmp::mode::components';
64 $self->{components_module} = ['disk', 'psu', 'iscsi'];
65 }
66
67 sub new {
68 my ($class, %options) = @_;
69 my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_performance => 1, force_new_perfdata => 1);
70 bless $self, $class;
71
72 $options{options}->add_options(arguments => {});
73
74 return $self;
75 }
76
77 sub snmp_execute {
78 my ($self, %options) = @_;
79
80 $self->{snmp} = $options{snmp};
81 $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
82 }
83
84 1;
85
86 __END__
87
88 =head1 MODE
89
90 Check hardware.
91
92 =over 8
93
94 =item B<--component>
95
96 Which component to check (default: '.*').
97 Can be: 'disk', 'iscsi', 'psu'.
98
99 =item B<--filter>
100
101 Exclude the items given as a comma-separated list (example: --filter=disk --filter=psu).
102 You can also exclude items from specific instances: --filter=psu,1
103
104 =item B<--no-component>
105
106 Define the expected status if no components are found (default: critical).
107
108 =item B<--threshold-overload>
109
110 Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,status,regexp).
111 Example: --threshold-overload='disk,OK,^(?!(degrade)$)'
112
113 =back
114
115 =cut