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