Debian Codegraph @

src/network/ruckus/scg/snmp/mode/systemstats.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::ruckus::scg::snmp::mode::systemstats;
22
23 use base qw(centreon::plugins::templates::counter);
24
25 use strict;
26 use warnings;
27 use Digest::MD5 qw(md5_hex);
28
29 sub set_counters {
30 my ($self, %options) = @_;
31
32 $self->{maps_counters_type} = [
33 { name => 'global', type => 0 },
34 ];
35
36 $self->{maps_counters}->{global} = [
37 { label => 'aps-count', set => {
38 key_values => [ { name => 'ruckusSystemStatsNumAP' } ],
39 output_template => 'APs count: %s',
40 perfdatas => [
41 { label => 'aps_count', template => '%s', unit => 'aps', min => 0 },
42 ],
43 }
44 },
45 { label => 'users-count', set => {
46 key_values => [ { name => 'ruckusSystemStatsNumSta' } ],
47 output_template => 'Users count: %s',
48 perfdatas => [
49 { label => 'users_count', template => '%s', unit => 'users', min => 0 },
50 ],
51 }
52 },
53 { label => 'total-traffic-in', set => {
54 key_values => [ { name => 'ruckusSystemStatsWLANTotalRxBytes', per_second => 1 } ],
55 output_template => 'Total Traffic In: %s %s/s',
56 output_change_bytes => 2,
57 perfdatas => [
58 { label => 'total_traffic_in', template => '%s', min => 0, unit => 'b/s' },
59 ],
60 }
61 },
62 { label => 'total-traffic-out', set => {
63 key_values => [ { name => 'ruckusSystemStatsWLANTotalTxBytes', per_second => 1 } ],
64 output_template => 'Total Traffic Out: %s %s/s',
65 output_change_bytes => 2,
66 perfdatas => [
67 { label => 'total_traffic_out', template => '%s', min => 0, unit => 'b/s' },
68 ],
69 }
70 },
71 { label => 'total-packets-in', set => {
72 key_values => [ { name => 'ruckusSystemStatsWLANTotalRxPkts', per_second => 1 } ],
73 output_template => 'Total Packets In: %s packets/s',
74 perfdatas => [
75 { label => 'total_packets_in', template => '%s', min => 0, unit => 'packets/s' },
76 ],
77 }
78 },
79 { label => 'total-mcast-packets-in', set => {
80 key_values => [ { name => 'ruckusSystemStatsWLANTotalRxMulticast', per_second => 1 } ],
81 output_template => 'Total Multicast Packets In: %s packets/s',
82 perfdatas => [
83 { label => 'total_mcast_packets_in', template => '%s', min => 0, unit => 'packets/s' },
84 ],
85 }
86 },
87 { label => 'total-packets-out', set => {
88 key_values => [ { name => 'ruckusSystemStatsWLANTotalTxPkts', per_second => 1 } ],
89 output_template => 'Total Packets Out: %s packets/s',
90 perfdatas => [
91 { label => 'total_packets_out', template => '%s', min => 0, unit => 'packets/s' },
92 ],
93 }
94 },
95 { label => 'total-mcast-packets-out', set => {
96 key_values => [ { name => 'ruckusSystemStatsWLANTotalTxMulticast', per_second => 1 } ],
97 output_template => 'Total Multicast Packets Out: %s packets/s',
98 perfdatas => [
99 { label => 'total_mcast_packets_out', template => '%s', min => 0, unit => 'packets/s' },
100 ],
101 }
102 },
103 { label => 'total-fail-packets-out', set => {
104 key_values => [ { name => 'ruckusSystemStatsWLANTotalTxFail', per_second => 1 } ],
105 output_template => 'Total Fail Packets Out: %s packets/s',
106 perfdatas => [
107 { label => 'total_fail_packets_out', template => '%s', min => 0, unit => 'packets/s' },
108 ],
109 }
110 },
111 { label => 'total-retry-packets-out', set => {
112 key_values => [ { name => 'ruckusSystemStatsWLANTotalTxRetry', per_second => 1 } ],
113 output_template => 'Total Retry Packets Out: %s packets/s',
114 perfdatas => [
115 { label => 'total_retry_packets_out', template => '%s', min => 0, unit => 'packets/s' },
116 ],
117 }
118 },
119 ];
120 }
121
122 sub new {
123 my ($class, %options) = @_;
124 my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
125 bless $self, $class;
126
127 $options{options}->add_options(arguments => {
128 });
129
130 return $self;
131 }
132
133 sub check_options {
134 my ($self, %options) = @_;
135 $self->SUPER::check_options(%options);
136 }
137
138 my $oid_ruckusSystemStatsNumAP = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.1.0';
139 my $oid_ruckusSystemStatsNumSta = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.2.0';
140 my $oid_ruckusSystemStatsWLANTotalRxPkts = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.5.0';
141 my $oid_ruckusSystemStatsWLANTotalRxBytes = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.6.0';
142 my $oid_ruckusSystemStatsWLANTotalRxMulticast = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.7.0';
143 my $oid_ruckusSystemStatsWLANTotalTxPkts = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.8.0';
144 my $oid_ruckusSystemStatsWLANTotalTxBytes = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.9.0';
145 my $oid_ruckusSystemStatsWLANTotalTxMulticast = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.10.0';
146 my $oid_ruckusSystemStatsWLANTotalTxFail = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.11.0';
147 my $oid_ruckusSystemStatsWLANTotalTxRetry = '.1.3.6.1.4.1.25053.1.3.1.1.1.15.12.0';
148
149 sub manage_selection {
150 my ($self, %options) = @_;
151
152 if ($options{snmp}->is_snmpv1()) {
153 $self->{output}->add_option_msg(short_msg => "Need to use SNMP v2c or v3.");
154 $self->{output}->option_exit();
155 }
156
157 my $result = $options{snmp}->get_leef(oids => [ $oid_ruckusSystemStatsNumAP, $oid_ruckusSystemStatsNumSta,
158 $oid_ruckusSystemStatsWLANTotalRxPkts, $oid_ruckusSystemStatsWLANTotalRxBytes,
159 $oid_ruckusSystemStatsWLANTotalRxMulticast, $oid_ruckusSystemStatsWLANTotalTxPkts,
160 $oid_ruckusSystemStatsWLANTotalTxBytes, $oid_ruckusSystemStatsWLANTotalTxMulticast,
161 $oid_ruckusSystemStatsWLANTotalTxFail, $oid_ruckusSystemStatsWLANTotalTxRetry ],
162 nothing_quit => 1);
163
164 $self->{global} = {
165 ruckusSystemStatsNumAP => $result->{$oid_ruckusSystemStatsNumAP},
166 ruckusSystemStatsNumSta => $result->{$oid_ruckusSystemStatsNumSta},
167 ruckusSystemStatsWLANTotalRxPkts => $result->{$oid_ruckusSystemStatsWLANTotalRxPkts},
168 ruckusSystemStatsWLANTotalRxBytes => $result->{$oid_ruckusSystemStatsWLANTotalRxBytes},
169 ruckusSystemStatsWLANTotalRxMulticast => $result->{$oid_ruckusSystemStatsWLANTotalRxMulticast},
170 ruckusSystemStatsWLANTotalTxPkts => $result->{$oid_ruckusSystemStatsWLANTotalTxPkts},
171 ruckusSystemStatsWLANTotalTxBytes => $result->{$oid_ruckusSystemStatsWLANTotalTxBytes},
172 ruckusSystemStatsWLANTotalTxMulticast => $result->{$oid_ruckusSystemStatsWLANTotalTxMulticast},
173 ruckusSystemStatsWLANTotalTxFail => $result->{$oid_ruckusSystemStatsWLANTotalTxFail},
174 ruckusSystemStatsWLANTotalTxRetry => $result->{$oid_ruckusSystemStatsWLANTotalTxRetry},
175 };
176
177 $self->{cache_name} = "ruckus_scg_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
178 (defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'));
179 }
180
181 1;
182
183 __END__
184
185 =head1 MODE
186
187 Check system statistics.
188
189 =over 8
190
191 =item B<--warning-*>
192
193 Warning threshold.
194 Can be: 'aps-count', 'users-count', 'total-traffic-in', 'total-traffic-out', 'total-packets-in',
195 'total-mcast-packets-in', 'total-packets-out', 'total-mcast-packets-out', 'total-fail-packets-in',
196 'total-retry-packets-out'.
197
198 =item B<--critical-*>
199
200 Critical threshold.
201 Can be: 'aps-count', 'users-count', 'total-traffic-in', 'total-traffic-out', 'total-packets-in',
202 'total-mcast-packets-in', 'total-packets-out', 'total-mcast-packets-out', 'total-fail-packets-in',
203 'total-retry-packets-out'.
204
205 =back
206
207 =cut
208