| 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 centreon::common::cisco::standard::snmp::mode::interfaces; |
| 22 |
|
| 23 |
use base qw(snmp_standard::mode::interfaces); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
|
| 28 |
sub custom_status_output { |
| 29 |
my ($self, %options) = @_; |
| 30 |
my $msg = 'Status : ' . $self->{result_values}->{opstatus} . ' (admin: ' . $self->{result_values}->{admstatus} . ')'; |
| 31 |
if (defined($self->{instance_mode}->{option_results}->{add_duplex_status})) { |
| 32 |
$msg .= ' (duplex: ' . $self->{result_values}->{duplexstatus} . ')'; |
| 33 |
} |
| 34 |
if (defined($self->{instance_mode}->{option_results}->{add_err_disable})) { |
| 35 |
$msg .= ' (error disable: ' . $self->{result_values}->{errdisable} . ')'; |
| 36 |
} |
| 37 |
|
| 38 |
return $msg; |
| 39 |
} |
| 40 |
|
| 41 |
sub custom_status_calc { |
| 42 |
my ($self, %options) = @_; |
| 43 |
|
| 44 |
$self->SUPER::custom_status_calc(%options); |
| 45 |
$self->{result_values}->{errdisable} = $options{new_datas}->{$self->{instance} . '_errdisable'}; |
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
sub set_key_values_status { |
| 50 |
my ($self, %options) = @_; |
| 51 |
|
| 52 |
return [ { name => 'opstatus' }, { name => 'admstatus' }, { name => 'duplexstatus' }, { name => 'errdisable' }, { name => 'display' } ]; |
| 53 |
} |
| 54 |
|
| 55 |
sub set_oids_status { |
| 56 |
my ($self, %options) = @_; |
| 57 |
|
| 58 |
$self->SUPER::set_oids_status(%options); |
| 59 |
$self->{oid_cErrDisableIfStatusCause} = '.1.3.6.1.4.1.9.9.548.1.3.1.1.2'; |
| 60 |
$self->{oid_cErrDisableIfStatusCause_mapping} = { |
| 61 |
1 => 'udld', 2 => 'bpduGuard', 3 => 'channelMisconfig', |
| 62 |
4 => 'pagpFlap', 5 => 'dtpFlap', 6 => 'linkFlap', |
| 63 |
7 => 'l2ptGuard', 8 => 'dot1xSecurityViolation', |
| 64 |
9 => 'portSecurityViolation', 10 => 'gbicInvalid', |
| 65 |
11 => 'dhcpRateLimit', 12 => 'unicastFlood', |
| 66 |
13 => 'vmps', 14 => 'stormControl', 15 => 'inlinePower', |
| 67 |
16 => 'arpInspection', 17 => 'portLoopback', |
| 68 |
18 => 'packetBuffer', 19 => 'macLimit', 20 => 'linkMonitorFailure', |
| 69 |
21 => 'oamRemoteFailure', 22 => 'dot1adIncompEtype', 23 => 'dot1adIncompTunnel', |
| 70 |
24 => 'sfpConfigMismatch', 25 => 'communityLimit', 26 => 'invalidPolicy', |
| 71 |
27 => 'lsGroup', 28 => 'ekey', 29 => 'portModeFailure', |
| 72 |
30 => 'pppoeIaRateLimit', 31 => 'oamRemoteCriticalEvent', |
| 73 |
32 => 'oamRemoteDyingGasp', 33 => 'oamRemoteLinkFault', |
| 74 |
34 => 'mvrp', 35 => 'tranceiverIncomp', 36 => 'other', |
| 75 |
37 => 'portReinitLimitReached', 38 => 'adminRxBBCreditPerfBufIncomp', |
| 76 |
39 => 'ficonNotEnabled', 40 => 'adminModeIncomp', 41 => 'adminSpeedIncomp', |
| 77 |
42 => 'adminRxBBCreditIncomp', 43 => 'adminRxBufSizeIncomp', |
| 78 |
44 => 'eppFailure', 45 => 'osmEPortUp', 46 => 'osmNonEPortUp', |
| 79 |
47 => 'udldUniDir', 48 => 'udldTxRxLoop', 49 => 'udldNeighbourMismatch', |
| 80 |
50 => 'udldEmptyEcho', 51 => 'udldAggrasiveModeLinkFailed', |
| 81 |
52 => 'excessivePortInterrupts', 53 => 'channelErrDisabled', |
| 82 |
54 => 'hwProgFailed', 55 => 'internalHandshakeFailed', |
| 83 |
56 => 'stpInconsistencyOnVpcPeerLink', 57 => 'stpPortStateFailure', |
| 84 |
58 => 'ipConflict', 59 => 'multipleMSapIdsRcvd', |
| 85 |
60 => 'oneHundredPdusWithoutAck', 61 => 'ipQosCompatCheckFailure', |
| 86 |
}; |
| 87 |
} |
| 88 |
|
| 89 |
sub set_oids_errors { |
| 90 |
my ($self, %options) = @_; |
| 91 |
|
| 92 |
$self->SUPER::set_oids_errors(%options); |
| 93 |
$self->{oid_ifInFCSError} = '.1.3.6.1.2.1.10.7.2.1.3'; # dot3StatsFCSErrors |
| 94 |
$self->{oid_ifInCrc} = '.1.3.6.1.4.1.9.2.2.1.1.12'; |
| 95 |
} |
| 96 |
|
| 97 |
sub set_counters_errors { |
| 98 |
my ($self, %options) = @_; |
| 99 |
|
| 100 |
$self->SUPER::set_counters_errors(%options); |
| 101 |
|
| 102 |
push @{$self->{maps_counters}->{int}}, |
| 103 |
{ label => 'in-traffic-limit', filter => 'add_qos_limit', nlabel => 'interface.traffic.in.limit.bitspersecond', set => { |
| 104 |
key_values => [ { name => 'traffic_in_limit' }, { name => 'display' } ], |
| 105 |
output_template => 'Traffic In Limit : %s %s/s', |
| 106 |
output_change_bytes => 2, |
| 107 |
perfdatas => [ |
| 108 |
{ label => 'traffic_in_limit', template => '%s', |
| 109 |
unit => 'b/s', label_extra_instance => 1, instance_use => 'display' } |
| 110 |
] |
| 111 |
} |
| 112 |
}, |
| 113 |
{ label => 'out-traffic-limit', filter => 'add_qos_limit', nlabel => 'interface.traffic.out.limit.bitspersecond', set => { |
| 114 |
key_values => [ { name => 'traffic_out_limit' }, { name => 'display' } ], |
| 115 |
output_template => 'Traffic Out Limit : %s %s/s', |
| 116 |
output_change_bytes => 2, |
| 117 |
perfdatas => [ |
| 118 |
{ label => 'traffic_out_limit', template => '%s', |
| 119 |
unit => 'b/s', label_extra_instance => 1, instance_use => 'display' } |
| 120 |
] |
| 121 |
} |
| 122 |
}, |
| 123 |
{ label => 'in-crc', filter => 'add_errors', nlabel => 'interface.packets.in.crc.count', set => { |
| 124 |
key_values => [ { name => 'incrc', diff => 1 }, { name => 'total_in_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ], |
| 125 |
closure_custom_calc => $self->can('custom_errors_calc'), closure_custom_calc_extra_options => { label_ref1 => 'in', label_ref2 => 'crc' }, |
| 126 |
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets In Crc : %s', |
| 127 |
closure_custom_perfdata => $self->can('custom_errors_perfdata'), |
| 128 |
closure_custom_threshold_check => $self->can('custom_errors_threshold') |
| 129 |
} |
| 130 |
}, |
| 131 |
{ label => 'in-fcserror', filter => 'add_errors', nlabel => 'interface.packets.in.fcserror.count', set => { |
| 132 |
key_values => [ { name => 'infcserror', diff => 1 }, { name => 'total_in_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ], |
| 133 |
closure_custom_calc => $self->can('custom_errors_calc'), |
| 134 |
closure_custom_calc_extra_options => { label_ref1 => 'in', label_ref2 => 'fcserror' }, |
| 135 |
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets In FCS Error : %s', |
| 136 |
closure_custom_perfdata => $self->can('custom_errors_perfdata'), |
| 137 |
closure_custom_threshold_check => $self->can('custom_errors_threshold') |
| 138 |
} |
| 139 |
}, |
| 140 |
{ label => 'out-fc-wait', filter => 'add_fc_fe_errors', nlabel => 'interface.wait.out.count', set => { |
| 141 |
key_values => [ { name => 'fcTxWait', diff => 1 }, { name => 'display' } ], |
| 142 |
output_template => 'Fc Out Wait : %s', |
| 143 |
perfdatas => [ |
| 144 |
{ label => 'fcTxWait', template => '%s', label_extra_instance => 1, instance_use => 'display' } |
| 145 |
] |
| 146 |
} |
| 147 |
} |
| 148 |
; |
| 149 |
} |
| 150 |
|
| 151 |
sub new { |
| 152 |
my ($class, %options) = @_; |
| 153 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options); |
| 154 |
bless $self, $class; |
| 155 |
|
| 156 |
$options{options}->add_options(arguments => { |
| 157 |
'add-qos-limit' => { name => 'add_qos_limit' }, |
| 158 |
'add-err-disable' => { name => 'add_err_disable' }, |
| 159 |
'add-fc-fe-errors' => { name => 'add_fc_fe_errors' } |
| 160 |
}); |
| 161 |
|
| 162 |
return $self; |
| 163 |
} |
| 164 |
|
| 165 |
sub check_options { |
| 166 |
my ($self, %options) = @_; |
| 167 |
$self->SUPER::check_options(%options); |
| 168 |
|
| 169 |
$self->{checking} = ''; |
| 170 |
foreach (('add_global', 'add_status', 'add_errors', 'add_traffic', 'add_cast', 'add_speed', 'add_volume', 'add_qos_limit', 'add_fc_fe_errors')) { |
| 171 |
if (defined($self->{option_results}->{$_})) { |
| 172 |
$self->{checking} .= $_; |
| 173 |
} |
| 174 |
} |
| 175 |
} |
| 176 |
|
| 177 |
sub reload_cache_qos_limit { |
| 178 |
my ($self, %options) = @_; |
| 179 |
|
| 180 |
return if (!defined($self->{option_results}->{add_qos_limit})); |
| 181 |
|
| 182 |
my $map_direction = { 1 => 'input', 2 => 'output' }; |
| 183 |
|
| 184 |
my $mapping = { |
| 185 |
policyDirection => { oid => '.1.3.6.1.4.1.9.9.166.1.1.1.1.3', map => $map_direction }, # cbQosPolicyDirection |
| 186 |
ifIndex => { oid => '.1.3.6.1.4.1.9.9.166.1.1.1.1.4' } # cbQosIfIndex |
| 187 |
}; |
| 188 |
my $mapping2 = { |
| 189 |
configIndex => { oid => '.1.3.6.1.4.1.9.9.166.1.5.1.1.2' }, # cbQosConfigIndex |
| 190 |
objectsType => { oid => '.1.3.6.1.4.1.9.9.166.1.5.1.1.3' } # cbQosObjectsType |
| 191 |
}; |
| 192 |
|
| 193 |
my $oid_cbQosServicePolicyEntry = '.1.3.6.1.4.1.9.9.166.1.1.1.1'; |
| 194 |
my $oid_cbQosObjectsEntry = '.1.3.6.1.4.1.9.9.166.1.5.1.1'; |
| 195 |
my $snmp_result = $self->{snmp}->get_multiple_table( |
| 196 |
oids => [ |
| 197 |
{ oid => $oid_cbQosServicePolicyEntry, start => $mapping->{policyDirection}->{oid}, end => $mapping->{ifIndex}->{oid} }, |
| 198 |
{ oid => $oid_cbQosObjectsEntry, start => $mapping2->{configIndex}->{oid}, end => $mapping2->{objectsType}->{oid} }, |
| 199 |
] |
| 200 |
); |
| 201 |
|
| 202 |
$options{datas}->{qos} = {}; |
| 203 |
foreach (keys %{$snmp_result->{$oid_cbQosServicePolicyEntry}}) { |
| 204 |
next if ($_ !~ /^$mapping->{ifIndex}->{oid}\.(.*)$/); |
| 205 |
my $policyIndex = $1; |
| 206 |
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $snmp_result->{$oid_cbQosServicePolicyEntry}, instance => $policyIndex); |
| 207 |
|
| 208 |
foreach (keys %{$snmp_result->{$oid_cbQosObjectsEntry}}) { |
| 209 |
# 7 = police |
| 210 |
next if ($_ !~ /^$mapping2->{objectsType}->{oid}\.$policyIndex\.(.*)$/ || $snmp_result->{$oid_cbQosObjectsEntry}->{$_} != 7); |
| 211 |
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $snmp_result->{$oid_cbQosObjectsEntry}, instance => $policyIndex . '.' . $1); |
| 212 |
|
| 213 |
$options{datas}->{qos}->{ $result->{ifIndex} } = {} if (!defined($options{datas}->{qos}->{ $result->{ifIndex} })); |
| 214 |
$options{datas}->{qos}->{ $result->{ifIndex} }->{ $result->{policyDirection} } = $result2->{configIndex}; |
| 215 |
} |
| 216 |
} |
| 217 |
} |
| 218 |
|
| 219 |
sub reload_cache_fc_fe_errors { |
| 220 |
my ($self, %options) = @_; |
| 221 |
|
| 222 |
return if (!defined($self->{option_results}->{add_fc_fe_errors})); |
| 223 |
|
| 224 |
my $oid_fcIfWwn = '.1.3.6.1.4.1.9.9.289.1.1.2.1.1'; |
| 225 |
my $snmp_result = $self->{snmp}->get_table(oid => $oid_fcIfWwn); |
| 226 |
|
| 227 |
$options{datas}->{fc_fe} = {}; |
| 228 |
foreach (keys %$snmp_result) { |
| 229 |
next if ($_ !~ /^$oid_fcIfWwn\.(.*)$/); |
| 230 |
$options{datas}->{fc_fe}->{$1} = { wwn => $snmp_result->{$_} }; |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
sub reload_cache_custom { |
| 235 |
my ($self, %options) = @_; |
| 236 |
|
| 237 |
$self->reload_cache_fc_fe_errors(%options); |
| 238 |
$self->reload_cache_qos_limit(%options); |
| 239 |
} |
| 240 |
|
| 241 |
sub custom_load_qos_limit { |
| 242 |
my ($self, %options) = @_; |
| 243 |
|
| 244 |
return if (!defined($self->{option_results}->{add_qos_limit})); |
| 245 |
|
| 246 |
my $oid_cbQosPoliceCfgRate64 = '.1.3.6.1.4.1.9.9.166.1.12.1.1.11'; |
| 247 |
|
| 248 |
my $qos = $self->{statefile_cache}->get(name => 'qos'); |
| 249 |
my $instances = []; |
| 250 |
foreach (keys %$qos) { |
| 251 |
push @$instances, $qos->{$_}->{input} if (defined($qos->{$_}->{input})); |
| 252 |
push @$instances, $qos->{$_}->{output} if (defined($qos->{$_}->{output})); |
| 253 |
} |
| 254 |
|
| 255 |
return if (scalar(@$instances) <= 0); |
| 256 |
|
| 257 |
$self->{snmp}->load( |
| 258 |
oids => [ $oid_cbQosPoliceCfgRate64 ], |
| 259 |
instances => $instances, |
| 260 |
instance_regexp => '^(.*)$' |
| 261 |
); |
| 262 |
} |
| 263 |
|
| 264 |
sub custom_load_fc_fe_errors { |
| 265 |
my ($self, %options) = @_; |
| 266 |
|
| 267 |
return if (!defined($self->{option_results}->{add_fc_fe_errors})); |
| 268 |
|
| 269 |
my $oid_fcIfTxWaitCount = '.1.3.6.1.4.1.9.9.289.1.2.1.1.15'; |
| 270 |
|
| 271 |
my $entries = $self->{statefile_cache}->get(name => 'fc_fe'); |
| 272 |
my @instances = keys %$entries; |
| 273 |
|
| 274 |
return if (scalar(@instances) <= 0); |
| 275 |
|
| 276 |
$self->{snmp}->load( |
| 277 |
oids => [ $oid_fcIfTxWaitCount ], |
| 278 |
instances => [@instances], |
| 279 |
instance_regexp => '^(.*)$' |
| 280 |
); |
| 281 |
} |
| 282 |
|
| 283 |
sub custom_load { |
| 284 |
my ($self, %options) = @_; |
| 285 |
|
| 286 |
$self->custom_load_fc_fe_errors(%options); |
| 287 |
$self->custom_load_qos_limit(%options); |
| 288 |
} |
| 289 |
|
| 290 |
sub load_errors { |
| 291 |
my ($self, %options) = @_; |
| 292 |
|
| 293 |
$self->set_oids_errors(); |
| 294 |
$self->{snmp}->load( |
| 295 |
oids => [ |
| 296 |
$self->{oid_ifInDiscards}, $self->{oid_ifInErrors}, |
| 297 |
$self->{oid_ifOutDiscards}, $self->{oid_ifOutErrors}, |
| 298 |
$self->{oid_ifInCrc}, $self->{oid_ifInFCSError} |
| 299 |
], |
| 300 |
instances => $self->{array_interface_selected} |
| 301 |
); |
| 302 |
} |
| 303 |
|
| 304 |
sub load_status { |
| 305 |
my ($self, %options) = @_; |
| 306 |
|
| 307 |
$self->SUPER::load_status(%options); |
| 308 |
if (defined($self->{option_results}->{add_err_disable})) { |
| 309 |
$self->{snmp_errdisable_result} = $self->{snmp}->get_table(oid => $self->{oid_cErrDisableIfStatusCause}); |
| 310 |
} |
| 311 |
} |
| 312 |
|
| 313 |
sub add_result_errors { |
| 314 |
my ($self, %options) = @_; |
| 315 |
|
| 316 |
$self->{int}->{$options{instance}}->{indiscard} = $self->{results}->{$self->{oid_ifInDiscards} . '.' . $options{instance}}; |
| 317 |
$self->{int}->{$options{instance}}->{inerror} = $self->{results}->{$self->{oid_ifInErrors} . '.' . $options{instance}}; |
| 318 |
$self->{int}->{$options{instance}}->{outdiscard} = $self->{results}->{$self->{oid_ifOutDiscards} . '.' . $options{instance}}; |
| 319 |
$self->{int}->{$options{instance}}->{outerror} = $self->{results}->{$self->{oid_ifOutErrors} . '.' . $options{instance}}; |
| 320 |
$self->{int}->{$options{instance}}->{incrc} = $self->{results}->{$self->{oid_ifInCrc} . '.' . $options{instance}}; |
| 321 |
$self->{int}->{$options{instance}}->{infcserror} = $self->{results}->{$self->{oid_ifInFCSError} . '.' . $options{instance}}; |
| 322 |
} |
| 323 |
|
| 324 |
sub add_result_status { |
| 325 |
my ($self, %options) = @_; |
| 326 |
|
| 327 |
$self->SUPER::add_result_status(%options); |
| 328 |
|
| 329 |
$self->{int}->{$options{instance}}->{errdisable} = ''; |
| 330 |
if (defined($self->{option_results}->{add_err_disable})) { |
| 331 |
my $append = ''; |
| 332 |
# ifIndex.vlanIndex (if physical interface, vlanIndex = 0) |
| 333 |
foreach (keys %{$self->{snmp_errdisable_result}}) { |
| 334 |
next if (! /^$self->{oid_cErrDisableIfStatusCause}\.$options{instance}\.(.*)/); |
| 335 |
if ($1 == 0) { |
| 336 |
$self->{int}->{$options{instance}}->{errdisable} = $self->{oid_cErrDisableIfStatusCause_mapping}->{ $self->{snmp_errdisable_result}->{$_} }; |
| 337 |
last; |
| 338 |
} |
| 339 |
|
| 340 |
$self->{int}->{$options{instance}}->{errdisable} .= $append . 'vlan' . $1 . ':' . $self->{oid_cErrDisableIfStatusCause_mapping}->{ $self->{snmp_errdisable_result}->{$_} }; |
| 341 |
$append = ','; |
| 342 |
} |
| 343 |
} |
| 344 |
|
| 345 |
$self->{int}->{$options{instance}}->{errdisable} = '-' |
| 346 |
if ($self->{int}->{$options{instance}}->{errdisable} eq ''); |
| 347 |
} |
| 348 |
|
| 349 |
sub custom_add_result_qos_limit { |
| 350 |
my ($self, %options) = @_; |
| 351 |
|
| 352 |
return if (!defined($self->{option_results}->{add_qos_limit})); |
| 353 |
|
| 354 |
my $qos = $self->{statefile_cache}->get(name => 'qos'); |
| 355 |
|
| 356 |
return if (!defined($qos->{ $options{instance} })); |
| 357 |
|
| 358 |
my $oid_cbQosPoliceCfgRate64 = '.1.3.6.1.4.1.9.9.166.1.12.1.1.11'; |
| 359 |
|
| 360 |
if (defined($qos->{ $options{instance} }->{input}) && |
| 361 |
defined($self->{results}->{$oid_cbQosPoliceCfgRate64 . '.' . $qos->{ $options{instance} }->{input}}) && |
| 362 |
$self->{results}->{$oid_cbQosPoliceCfgRate64 . '.' . $qos->{ $options{instance} }->{input}} =~ /(\d+)/) { |
| 363 |
$self->{int}->{ $options{instance} }->{traffic_in_limit} = $self->{results}->{$oid_cbQosPoliceCfgRate64 . '.' . $qos->{ $options{instance} }->{input}}; |
| 364 |
|
| 365 |
$self->{int}->{ $options{instance} }->{speed_in} = $self->{results}->{$oid_cbQosPoliceCfgRate64 . '.' . $qos->{ $options{instance} }->{input}} |
| 366 |
if (!defined($self->{option_results}->{speed_in}) || $self->{option_results}->{speed_in} eq ''); |
| 367 |
} |
| 368 |
|
| 369 |
if (defined($qos->{ $options{instance} }->{output}) && |
| 370 |
defined($self->{results}->{$oid_cbQosPoliceCfgRate64 . '.' . $qos->{ $options{instance} }->{output}}) && |
| 371 |
$self->{results}->{$oid_cbQosPoliceCfgRate64 . '.' . $qos->{ $options{instance} }->{output}} =~ /(\d+)/) { |
| 372 |
$self->{int}->{ $options{instance} }->{traffic_out_limit} = $self->{results}->{$oid_cbQosPoliceCfgRate64 . '.' . $qos->{ $options{instance} }->{output}}; |
| 373 |
|
| 374 |
$self->{int}->{ $options{instance} }->{speed_out} = $self->{results}->{$oid_cbQosPoliceCfgRate64 . '.' . $qos->{ $options{instance} }->{output}} |
| 375 |
if (!defined($self->{option_results}->{speed_out}) || $self->{option_results}->{speed_out} eq ''); |
| 376 |
} |
| 377 |
} |
| 378 |
|
| 379 |
sub custom_add_result_fc_fe_errors { |
| 380 |
my ($self, %options) = @_; |
| 381 |
|
| 382 |
return if (!defined($self->{option_results}->{add_fc_fe_errors})); |
| 383 |
|
| 384 |
my $entries = $self->{statefile_cache}->get(name => 'fc_fe'); |
| 385 |
|
| 386 |
return if (!defined($entries->{ $options{instance} })); |
| 387 |
|
| 388 |
my $oid_fcIfTxWaitCount = '.1.3.6.1.4.1.9.9.289.1.2.1.1.15'; |
| 389 |
|
| 390 |
if (defined($self->{results}->{ $oid_fcIfTxWaitCount . '.' . $options{instance} }) && |
| 391 |
$self->{results}->{ $oid_fcIfTxWaitCount . '.' . $options{instance} } =~ /(\d+)/) { |
| 392 |
$self->{int}->{ $options{instance} }->{fcTxWait} = $self->{results}->{ $oid_fcIfTxWaitCount . '.' . $options{instance} }; |
| 393 |
} |
| 394 |
} |
| 395 |
|
| 396 |
sub custom_add_result { |
| 397 |
my ($self, %options) = @_; |
| 398 |
|
| 399 |
$self->custom_add_result_fc_fe_errors(%options); |
| 400 |
$self->custom_add_result_qos_limit(%options); |
| 401 |
} |
| 402 |
|
| 403 |
1; |
| 404 |
|
| 405 |
__END__ |
| 406 |
|
| 407 |
=head1 MODE |
| 408 |
|
| 409 |
Check interfaces. |
| 410 |
|
| 411 |
=over 8 |
| 412 |
|
| 413 |
=item B<--add-global> |
| 414 |
|
| 415 |
Check global port statistics (by default if no --add-* option is set). |
| 416 |
|
| 417 |
=item B<--add-status> |
| 418 |
|
| 419 |
Check interface status. |
| 420 |
|
| 421 |
=item B<--add-duplex-status> |
| 422 |
|
| 423 |
Check duplex status (with --warning-status and --critical-status). |
| 424 |
|
| 425 |
=item B<--add-err-disable> |
| 426 |
|
| 427 |
Check error disable (with --warning-status and --critical-status). |
| 428 |
|
| 429 |
=item B<--add-traffic> |
| 430 |
|
| 431 |
Check interface traffic. |
| 432 |
|
| 433 |
=item B<--add-errors> |
| 434 |
|
| 435 |
Check interface errors. |
| 436 |
|
| 437 |
=item B<--add-fc-fe-errors> |
| 438 |
|
| 439 |
Check interface fiber channel fiber element errors. |
| 440 |
|
| 441 |
=item B<--add-cast> |
| 442 |
|
| 443 |
Check interface cast. |
| 444 |
|
| 445 |
=item B<--add-speed> |
| 446 |
|
| 447 |
Check interface speed. |
| 448 |
|
| 449 |
=item B<--add-volume> |
| 450 |
|
| 451 |
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting). |
| 452 |
|
| 453 |
=item B<--add-qos-limit> |
| 454 |
|
| 455 |
Check QoS traffic limit rate. |
| 456 |
|
| 457 |
=item B<--check-metrics> |
| 458 |
|
| 459 |
If the expression is true, metrics are checked (default: '%{opstatus} eq "up"'). |
| 460 |
|
| 461 |
=item B<--warning-status> |
| 462 |
|
| 463 |
Define the conditions to match for the status to be WARNING. |
| 464 |
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{errdisable}, %{display} |
| 465 |
|
| 466 |
=item B<--critical-status> |
| 467 |
|
| 468 |
Define the conditions to match for the status to be CRITICAL (default: '%{admstatus} eq "up" and %{opstatus} ne "up"'). |
| 469 |
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{errdisable}, %{display} |
| 470 |
|
| 471 |
=item B<--warning-*> B<--critical-*> |
| 472 |
|
| 473 |
Thresholds. |
| 474 |
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down', |
| 475 |
'in-traffic', 'out-traffic', 'in-traffic-limit', 'out-traffic-limit', |
| 476 |
'in-crc', 'in-fcserror', 'out-fc-wait', 'in-error', 'in-discard', 'out-error', 'out-discard', |
| 477 |
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast', |
| 478 |
'speed' (b/s). |
| 479 |
|
| 480 |
=item B<--units-traffic> |
| 481 |
|
| 482 |
Units of thresholds for the traffic (default: 'percent_delta') ('percent_delta', 'bps', 'counter'). |
| 483 |
|
| 484 |
=item B<--units-errors> |
| 485 |
|
| 486 |
Units of thresholds for errors/discards (default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter'). |
| 487 |
|
| 488 |
=item B<--units-cast> |
| 489 |
|
| 490 |
Units of thresholds for communication types (default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter'). |
| 491 |
|
| 492 |
=item B<--nagvis-perfdata> |
| 493 |
|
| 494 |
Display traffic perfdata to be compatible with NagVis widget. |
| 495 |
|
| 496 |
=item B<--interface> |
| 497 |
|
| 498 |
Set the interface (number expected) example: 1,2,... (empty means 'check all interfaces'). |
| 499 |
|
| 500 |
=item B<--name> |
| 501 |
|
| 502 |
Allows you to define the interface (in option --interface) by name instead of OID index. The name matching mode supports regular expressions. |
| 503 |
|
| 504 |
=item B<--speed> |
| 505 |
|
| 506 |
Set interface speed for incoming/outgoing traffic (in Mb). |
| 507 |
|
| 508 |
=item B<--speed-in> |
| 509 |
|
| 510 |
Set interface speed for incoming traffic (in Mb). |
| 511 |
|
| 512 |
=item B<--speed-out> |
| 513 |
|
| 514 |
Set interface speed for outgoing traffic (in Mb). |
| 515 |
|
| 516 |
=item B<--force-counters32> |
| 517 |
|
| 518 |
Force to use 32 bits counters (even in SNMP version 2c and version 3). Should be used when 64 bits counters are buggy. |
| 519 |
|
| 520 |
=item B<--reload-cache-time> |
| 521 |
|
| 522 |
Time in minutes before reloading cache file (default: 180). |
| 523 |
|
| 524 |
=item B<--oid-filter> |
| 525 |
|
| 526 |
Define the OID to be used to filter interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr). |
| 527 |
|
| 528 |
=item B<--oid-display> |
| 529 |
|
| 530 |
Define the OID that will be used to name the interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr). |
| 531 |
|
| 532 |
=item B<--oid-extra-display> |
| 533 |
|
| 534 |
Add an OID to display. |
| 535 |
|
| 536 |
=item B<--display-transform-src> B<--display-transform-dst> |
| 537 |
|
| 538 |
Modify the interface name displayed by using a regular expression. |
| 539 |
|
| 540 |
Example: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens' |
| 541 |
|
| 542 |
=item B<--show-cache> |
| 543 |
|
| 544 |
Display cache interface data. |
| 545 |
|
| 546 |
=back |
| 547 |
|
| 548 |
=cut |