Debian Codegraph @

src/network/nortel/standard/snmp/mode/interfaces.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::interfaces;
22
23 use base qw(snmp_standard::mode::interfaces);
24
25 use strict;
26 use warnings;
27
28 sub new {
29 my ($class, %options) = @_;
30 my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
31 bless $self, $class;
32
33 return $self;
34 }
35
36 sub load_status {
37 my ($self, %options) = @_;
38
39 $self->SUPER::load_status(%options);
40
41 $self->{oid_rcPortOperDuplex} = '.1.3.6.1.4.1.2272.1.4.10.1.1.13';
42 $self->{oid_rcPortOperDuplex_mapping} = {
43 0 => 'unknown', 1 => 'halfDuplex', 2 => 'fullDuplex',
44 };
45
46 $self->{snmp}->load(oids => [$self->{oid_rcPortOperDuplex}], instances => $self->{array_interface_selected});
47 }
48
49 sub add_result_status {
50 my ($self, %options) = @_;
51
52 $self->SUPER::add_result_status(%options);
53 if ($self->{int}->{ $options{instance} }->{duplexstatus} eq 'n/a') {
54 $self->{int}->{ $options{instance} }->{duplexstatus} = defined($self->{results}->{ $self->{oid_rcPortOperDuplex} . '.' . $options{instance} }) ? $self->{oid_rcPortOperDuplex_mapping}->{ $self->{results}->{ $self->{oid_rcPortOperDuplex} . '.' . $options{instance} } } : 'n/a';
55 }
56 }
57
58 1;
59
60 __END__
61
62 =head1 MODE
63
64 Check interfaces.
65
66 =over 8
67
68 =item B<--add-global>
69
70 Check global port statistics (by default if no --add-* option is set).
71
72 =item B<--add-status>
73
74 Check interface status.
75
76 =item B<--add-duplex-status>
77
78 Check duplex status (with --warning-status and --critical-status).
79
80 =item B<--add-traffic>
81
82 Check interface traffic.
83
84 =item B<--add-errors>
85
86 Check interface errors.
87
88 =item B<--add-cast>
89
90 Check interface cast.
91
92 =item B<--add-speed>
93
94 Check interface speed.
95
96 =item B<--add-volume>
97
98 Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
99
100 =item B<--check-metrics>
101
102 If the expression is true, metrics are checked (default: '%{opstatus} eq "up"').
103
104 =item B<--warning-status>
105
106 Define the conditions to match for the status to be WARNING.
107 You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
108
109 =item B<--critical-status>
110
111 Define the conditions to match for the status to be CRITICAL (default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
112 You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
113
114 =item B<--warning-*> B<--critical-*>
115
116 Thresholds.
117 Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
118 'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
119 'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
120 'speed' (b/s).
121
122 =item B<--units-traffic>
123
124 Units of thresholds for the traffic (default: 'percent_delta') ('percent_delta', 'bps', 'counter').
125
126 =item B<--units-errors>
127
128 Units of thresholds for errors/discards (default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
129
130 =item B<--units-cast>
131
132 Units of thresholds for communication types (default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
133
134 =item B<--nagvis-perfdata>
135
136 Display traffic perfdata to be compatible with nagvis widget.
137
138 =item B<--interface>
139
140 Set the interface (number expected) example: 1,2,... (empty means 'check all interfaces').
141
142 =item B<--name>
143
144 Allows you to define the interface (in option --interface) by name instead of OID index. The name matching mode supports regular expressions.
145
146 =item B<--speed>
147
148 Set interface speed for incoming/outgoing traffic (in Mb).
149
150 =item B<--speed-in>
151
152 Set interface speed for incoming traffic (in Mb).
153
154 =item B<--speed-out>
155
156 Set interface speed for outgoing traffic (in Mb).
157
158 =item B<--map-speed-dsl>
159
160 Get interface speed configuration for interface type 'adsl' and 'vdsl2'.
161
162 Syntax: --map-speed-dsl=interface-src-name,interface-dsl-name
163
164 E.g: --map-speed-dsl=Et0.835,Et0-vdsl2
165
166 =item B<--force-counters64>
167
168 Force to use 64 bits counters only. Can be used to improve performance.
169
170 =item B<--force-counters32>
171
172 Force to use 32 bits counters (even in snmp v2c and v3). Should be used when 64 bits counters are buggy.
173
174 =item B<--reload-cache-time>
175
176 Time in minutes before reloading cache file (default: 180).
177
178 =item B<--oid-filter>
179
180 Define the OID to be used to filter interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
181
182 =item B<--oid-display>
183
184 Define the OID that will be used to name the interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
185
186 =item B<--oid-extra-display>
187
188 Add an OID to display.
189
190 =item B<--display-transform-src> B<--display-transform-dst>
191
192 Modify the interface name displayed by using a regular expression.
193
194 Example: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
195
196 =item B<--show-cache>
197
198 Display cache interface data.
199
200 =back
201
202 =cut