Debian Codegraph @

src/storage/purestorage/snmp/mode/stats.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::purestorage::snmp::mode::stats;
22
23 use base qw(centreon::plugins::templates::counter);
24
25 use strict;
26 use warnings;
27
28 sub set_counters {
29 my ($self, %options) = @_;
30
31 $self->{maps_counters_type} = [
32 { name => 'global', type => 0, message_separator => ' - ' },
33 ];
34
35 $self->{maps_counters}->{global} = [
36 { label => 'read-bandwidth', set => {
37 key_values => [ { name => 'pureArrayReadBandwidth' }, ],
38 output_change_bytes => 2,
39 output_template => 'Read Bandwith : %s %s/s',
40 perfdatas => [
41 { label => 'read_bandwidth', value => 'pureArrayReadBandwidth', template => '%.2f',
42 min => 0, unit => 'b/s' },
43 ],
44 }
45 },
46 { label => 'write-bandwidth', set => {
47 key_values => [ { name => 'pureArrayWriteBandwidth' }, ],
48 output_change_bytes => 2,
49 output_template => 'Write Bandwith : %s %s/s',
50 perfdatas => [
51 { label => 'write_bandwidth', value => 'pureArrayWriteBandwidth', template => '%.2f',
52 min => 0, unit => 'b/s' },
53 ],
54 }
55 },
56 { label => 'read-iops', set => {
57 key_values => [ { name => 'pureArrayReadIOPS' } ],
58 output_template => 'Read IOPs : %s',
59 perfdatas => [
60 { label => 'read_iops', value => 'pureArrayReadIOPS', template => '%s',
61 unit => 'iops', min => 0 },
62 ],
63 }
64 },
65 { label => 'write-iops', set => {
66 key_values => [ { name => 'pureArrayWriteIOPS' } ],
67 output_template => 'Write IOPs : %s',
68 perfdatas => [
69 { label => 'write_iops', value => 'pureArrayWriteIOPS', template => '%s',
70 unit => 'iops', min => 0 },
71 ],
72 }
73 },
74 { label => 'read-latency', set => {
75 key_values => [ { name => 'pureArrayReadLatency' } ],
76 output_template => 'Read Latency : %s us/op',
77 perfdatas => [
78 { label => 'read_latency', value => 'pureArrayReadLatency', template => '%s',
79 unit => 'us/op', min => 0 },
80 ],
81 }
82 },
83 { label => 'write-latency', set => {
84 key_values => [ { name => 'pureArrayWriteLatency' } ],
85 output_template => 'Write Latency : %s us/op',
86 perfdatas => [
87 { label => 'write_latency', value => 'pureArrayWriteLatency', template => '%s',
88 unit => 'us/op', min => 0 },
89 ],
90 }
91 },
92 ];
93 }
94
95 sub new {
96 my ($class, %options) = @_;
97 my $self = $class->SUPER::new(package => __PACKAGE__, %options);
98 bless $self, $class;
99
100 $options{options}->add_options(arguments =>
101 {
102 });
103
104 return $self;
105 }
106
107 my $mapping = {
108 pureArrayReadBandwidth => { oid => '.1.3.6.1.4.1.40482.4.1' },
109 pureArrayWriteBandwidth => { oid => '.1.3.6.1.4.1.40482.4.2' },
110 pureArrayReadIOPS => { oid => '.1.3.6.1.4.1.40482.4.3' },
111 pureArrayWriteIOPS => { oid => '.1.3.6.1.4.1.40482.4.4' },
112 pureArrayReadLatency => { oid => '.1.3.6.1.4.1.40482.4.5' },
113 pureArrayWriteLatency => { oid => '.1.3.6.1.4.1.40482.4.6' },
114 };
115 my $oid_purePerformance = '.1.3.6.1.4.1.40482.4';
116
117 sub manage_selection {
118 my ($self, %options) = @_;
119
120 my $snmp_result = $options{snmp}->get_table(oid => $oid_purePerformance,
121 nothing_quit => 1);
122 my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => '0');
123
124 $result->{pureArrayReadBandwidth} *= 8;
125 $result->{pureArrayWriteBandwidth} *= 8;
126
127 $self->{global} = { %$result };
128 }
129
130 1;
131
132 __END__
133
134 =head1 MODE
135
136 Check statistics performance.
137
138 =over 8
139
140 =item B<--filter-counters>
141
142 Only display some counters (regexp can be used).
143 Example: --filter-counters='bandwidth'
144
145 =item B<--warning-*>
146
147 Warning threshold.
148 Can be: 'read-bandwidth', 'write-bandwidth', 'read-iops', 'write-iops',
149 'read-latency', 'write-latency'.
150
151 =item B<--critical-*>
152
153 Critical threshold.
154 Can be: 'read-bandwidth', 'write-bandwidth', 'read-iops', 'write-iops',
155 'read-latency', 'write-latency'.
156
157 =back
158
159 =cut