| 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::atrica::snmp::mode::connections; |
| 22 |
|
| 23 |
use base qw(snmp_standard::mode::interfaces); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
|
| 28 |
sub set_oids_label { |
| 29 |
my ($self, %options) = @_; |
| 30 |
|
| 31 |
$self->{oids_label} = { |
| 32 |
'atrconncepgendescr' => { oid => '.1.3.6.1.4.1.6110.2.7.5.1.1', get => 'reload_get_simple', cache => 'reload_cache_index_value' }, |
| 33 |
'atrconningdescr' => { oid => '.1.3.6.1.4.1.6110.2.2.1.1.2', get => 'reload_get_simple', cache => 'reload_cache_index_value' } |
| 34 |
}; |
| 35 |
} |
| 36 |
|
| 37 |
sub set_oids_status { |
| 38 |
my ($self, %options) = @_; |
| 39 |
|
| 40 |
if ($self->{option_results}->{oid_filter} eq 'atrconncepgendescr') { |
| 41 |
$self->{oid_adminstatus} = '.1.3.6.1.4.1.6110.2.7.5.1.7'; |
| 42 |
$self->{oid_adminstatus_mapping} = { |
| 43 |
1 => 'up', 2 => 'down', |
| 44 |
}; |
| 45 |
$self->{oid_opstatus} = '.1.3.6.1.4.1.6110.2.7.5.1.8'; |
| 46 |
$self->{oid_opstatus_mapping} = { |
| 47 |
1 => 'up', 2 => 'down', 3 => 'oneWay', 4 => 'twoWay', 5 => 'fastProtected', |
| 48 |
}; |
| 49 |
if (!defined($self->{option_results}->{critical_status})) { |
| 50 |
$self->{option_results}->{critical_status} = '%{admstatus} eq "up" and %{opstatus} ne "up"'; |
| 51 |
} |
| 52 |
} else { |
| 53 |
$self->{oid_adminstatus} = '.1.3.6.1.4.1.6110.2.2.1.1.3'; |
| 54 |
$self->{oid_adminstatus_mapping} = { |
| 55 |
2 => 'off', 3 => 'on', |
| 56 |
}; |
| 57 |
$self->{oid_opstatus} = '.1.3.6.1.4.1.6110.2.2.1.1.4'; |
| 58 |
$self->{oid_opstatus_mapping} = { |
| 59 |
2 => 'off', 3 => 'systemBusy', 4 => 'dependencyBusy', 5 => 'inService', 6 => 'alterInService', 7 => 'failed', |
| 60 |
8 => 'mainInServiceViaCoreLinkProtec', 9 => 'alterInServiceViaCoreLinkProtec', |
| 61 |
10 => 'mainAndAltDownConnUpSendingToMain', 11 => 'mainAndAltDownConnUpSendingToAlt', |
| 62 |
}; |
| 63 |
if (!defined($self->{option_results}->{critical_status})) { |
| 64 |
$self->{option_results}->{critical_status} = '%{admstatus} eq "on" and %{opstatus} ne "inService"'; |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
sub set_speed { |
| 70 |
my ($self, %options) = @_; |
| 71 |
|
| 72 |
$self->{oid_speed} = '.1.3.6.1.4.1.6110.2.9.1.1.14'; # in Kb/s |
| 73 |
} |
| 74 |
|
| 75 |
sub set_oids_errors { |
| 76 |
my ($self, %options) = @_; |
| 77 |
|
| 78 |
$self->{oid_ing_eir_discard} = '.1.3.6.1.4.1.6110.2.2.4.1.1.7'; # in B |
| 79 |
$self->{oid_eg_eir_discard} = '.1.3.6.1.4.1.6110.2.3.2.1.1.6'; # in B |
| 80 |
} |
| 81 |
|
| 82 |
sub set_oids_traffic { |
| 83 |
my ($self, %options) = @_; |
| 84 |
|
| 85 |
$self->{oid_ing_cir} = '.1.3.6.1.4.1.6110.2.2.4.1.1.4'; # in B |
| 86 |
$self->{oid_ing_eir} = '.1.3.6.1.4.1.6110.2.2.4.1.1.5'; # in B |
| 87 |
$self->{oid_eg_cir} = '.1.3.6.1.4.1.6110.2.3.2.1.1.4'; # in B |
| 88 |
$self->{oid_eg_eir} = '.1.3.6.1.4.1.6110.2.3.2.1.1.5'; # in B |
| 89 |
} |
| 90 |
|
| 91 |
sub default_warning_status { |
| 92 |
my ($self, %options) = @_; |
| 93 |
|
| 94 |
return undef; |
| 95 |
} |
| 96 |
|
| 97 |
sub default_critical_status { |
| 98 |
my ($self, %options) = @_; |
| 99 |
|
| 100 |
return undef; |
| 101 |
} |
| 102 |
|
| 103 |
sub default_check_metrics { |
| 104 |
my ($self, %options) = @_; |
| 105 |
|
| 106 |
return '%{opstatus} eq "up" or %{opstatus} eq "inService"'; |
| 107 |
} |
| 108 |
|
| 109 |
sub default_global_admin_up_rule { |
| 110 |
my ($self, %options) = @_; |
| 111 |
|
| 112 |
return '%{admstatus} eq "up" or %{admstatus} eq "on"'; |
| 113 |
} |
| 114 |
|
| 115 |
sub default_global_admin_down_rule { |
| 116 |
my ($self, %options) = @_; |
| 117 |
|
| 118 |
return '%{admstatus} ne "up" and %{admstatus} ne "on"'; |
| 119 |
} |
| 120 |
|
| 121 |
sub default_global_oper_up_rule { |
| 122 |
my ($self, %options) = @_; |
| 123 |
|
| 124 |
return '%{opstatus} eq "up" or %{opstatus} eq "inService"'; |
| 125 |
} |
| 126 |
|
| 127 |
sub default_global_oper_down_rule { |
| 128 |
my ($self, %options) = @_; |
| 129 |
|
| 130 |
return '%{opstatus} ne "up" and %{opstatus} ne "inService"'; |
| 131 |
} |
| 132 |
|
| 133 |
sub default_oid_filter_name { |
| 134 |
my ($self, %options) = @_; |
| 135 |
|
| 136 |
return 'atrConnCepGenDescr'; |
| 137 |
} |
| 138 |
|
| 139 |
sub default_oid_display_name { |
| 140 |
my ($self, %options) = @_; |
| 141 |
|
| 142 |
return 'atrConnCepGenDescr'; |
| 143 |
} |
| 144 |
|
| 145 |
sub set_counters_traffic { |
| 146 |
my ($self, %options) = @_; |
| 147 |
|
| 148 |
push @{$self->{maps_counters}->{int}}, |
| 149 |
{ label => 'in-cir', filter => 'add_traffic', nlabel => 'interface.traffic.in.cir.bitspersecond', set => { |
| 150 |
key_values => [ { name => 'in_cir', diff => 1 }, { name => 'speed_in'}, { name => 'display' } ], |
| 151 |
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in_cir' }, |
| 152 |
closure_custom_output => $self->can('custom_traffic_output'), output_error_template => 'Traffic In CIR : %s', |
| 153 |
closure_custom_perfdata => $self->can('custom_traffic_perfdata'), |
| 154 |
closure_custom_threshold_check => $self->can('custom_traffic_threshold') |
| 155 |
} |
| 156 |
}, |
| 157 |
{ label => 'in-eir', filter => 'add_traffic', nlabel => 'interface.traffic.in.eir.bitspersecond', set => { |
| 158 |
key_values => [ { name => 'in_eir', diff => 1 }, { name => 'speed_in'}, { name => 'display' } ], |
| 159 |
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in_eir' }, |
| 160 |
closure_custom_output => $self->can('custom_traffic_output'), output_error_template => 'Traffic In EIR : %s', |
| 161 |
closure_custom_perfdata => $self->can('custom_traffic_perfdata'), |
| 162 |
closure_custom_threshold_check => $self->can('custom_traffic_threshold') |
| 163 |
} |
| 164 |
}, |
| 165 |
{ label => 'out-cir', filter => 'add_traffic', nlabel => 'interface.traffic.out.cir.bitspersecond', set => { |
| 166 |
key_values => [ { name => 'out_cir', diff => 1 }, { name => 'speed_out' }, { name => 'display' } ], |
| 167 |
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'out_cir' }, |
| 168 |
closure_custom_output => $self->can('custom_traffic_output'), output_error_template => 'Traffic Out CIR : %s', |
| 169 |
closure_custom_perfdata => $self->can('custom_traffic_perfdata'), |
| 170 |
closure_custom_threshold_check => $self->can('custom_traffic_threshold') |
| 171 |
} |
| 172 |
}, |
| 173 |
{ label => 'out-eir', filter => 'add_traffic', nlabel => 'interface.traffic.out.eir.bitspersecond', set => { |
| 174 |
key_values => [ { name => 'out_eir', diff => 1 }, { name => 'speed_out' }, { name => 'display' } ], |
| 175 |
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'out_eir' }, |
| 176 |
closure_custom_output => $self->can('custom_traffic_output'), output_error_template => 'Traffic Out EIR : %s', |
| 177 |
closure_custom_perfdata => $self->can('custom_traffic_perfdata'), |
| 178 |
closure_custom_threshold_check => $self->can('custom_traffic_threshold') |
| 179 |
} |
| 180 |
} |
| 181 |
; |
| 182 |
} |
| 183 |
|
| 184 |
sub set_counters_errors { |
| 185 |
my ($self, %options) = @_; |
| 186 |
|
| 187 |
push @{$self->{maps_counters}->{int}}, |
| 188 |
{ label => 'in-eir-discard', filter => 'add_errors', nlabel => 'interface.packets.in.eir.discard.count', set => { |
| 189 |
key_values => [ { name => 'in_eir_discard', diff => 1 }, { name => 'speed_in' }, { name => 'display' } ], |
| 190 |
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in_eir_discard' }, |
| 191 |
closure_custom_output => $self->can('custom_traffic_output'), output_error_template => 'Traffic In EIR Discard : %s', |
| 192 |
closure_custom_perfdata => $self->can('custom_traffic_perfdata'), |
| 193 |
closure_custom_threshold_check => $self->can('custom_traffic_threshold') |
| 194 |
} |
| 195 |
}, |
| 196 |
{ label => 'out-eir-discard', filter => 'add_errors', nlabel => 'interface.packets.out.eir.discard.count', set => { |
| 197 |
key_values => [ { name => 'out_eir_discard', diff => 1 }, { name => 'speed_out' }, { name => 'display' } ], |
| 198 |
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'out_eir_discard' }, |
| 199 |
closure_custom_output => $self->can('custom_traffic_output'), output_error_template => 'Traffic Out EIR Discard : %s', |
| 200 |
closure_custom_perfdata => $self->can('custom_traffic_perfdata'), |
| 201 |
closure_custom_threshold_check => $self->can('custom_traffic_threshold') |
| 202 |
} |
| 203 |
} |
| 204 |
; |
| 205 |
} |
| 206 |
|
| 207 |
sub custom_traffic_perfdata { |
| 208 |
my ($self, %options) = @_; |
| 209 |
|
| 210 |
my ($warning, $critical); |
| 211 |
if ($self->{instance_mode}->{option_results}->{units_traffic} eq 'percent_delta' && defined($self->{result_values}->{speed})) { |
| 212 |
$warning = $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}, total => $self->{result_values}->{speed}, cast_int => 1); |
| 213 |
$critical = $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}, total => $self->{result_values}->{speed}, cast_int => 1); |
| 214 |
} elsif ($self->{instance_mode}->{option_results}->{units_traffic} =~ /bps|counter/) { |
| 215 |
$warning = $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}); |
| 216 |
$critical = $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}); |
| 217 |
} |
| 218 |
|
| 219 |
if ($self->{instance_mode}->{option_results}->{units_traffic} eq 'counter') { |
| 220 |
my $nlabel = $self->{nlabel}; |
| 221 |
$nlabel =~ s/bitspersecond/bits/; |
| 222 |
$self->{output}->perfdata_add( |
| 223 |
force_new_perfdata => 1, |
| 224 |
nlabel => $nlabel, |
| 225 |
unit => 'b', |
| 226 |
instances => $self->{result_values}->{display}, |
| 227 |
value => $self->{result_values}->{traffic_counter}, |
| 228 |
warning => $warning, |
| 229 |
critical => $critical, |
| 230 |
min => 0 |
| 231 |
); |
| 232 |
} else { |
| 233 |
$self->{output}->perfdata_add( |
| 234 |
label => $self->{result_values}->{label}, unit => 'b/s', |
| 235 |
nlabel => $self->{nlabel}, |
| 236 |
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef, |
| 237 |
value => sprintf('%.2f', $self->{result_values}->{traffic_per_seconds}), |
| 238 |
warning => $warning, |
| 239 |
critical => $critical, |
| 240 |
min => 0, max => $self->{result_values}->{speed} |
| 241 |
); |
| 242 |
} |
| 243 |
} |
| 244 |
|
| 245 |
sub custom_traffic_threshold { |
| 246 |
my ($self, %options) = @_; |
| 247 |
|
| 248 |
my $exit = 'ok'; |
| 249 |
if ($self->{instance_mode}->{option_results}->{units_traffic} eq 'percent_delta' && defined($self->{result_values}->{speed})) { |
| 250 |
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{traffic_prct}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]); |
| 251 |
} elsif ($self->{instance_mode}->{option_results}->{units_traffic} eq 'bps') { |
| 252 |
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{traffic_per_seconds}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]); |
| 253 |
} elsif ($self->{instance_mode}->{option_results}->{units_traffic} eq 'counter') { |
| 254 |
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{traffic_counter}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]); |
| 255 |
} |
| 256 |
return $exit; |
| 257 |
} |
| 258 |
|
| 259 |
sub custom_traffic_output { |
| 260 |
my ($self, %options) = @_; |
| 261 |
|
| 262 |
my $label = $self->{result_values}->{label}; |
| 263 |
$label =~ s/_/ /g; |
| 264 |
$label =~ s/(\w+)/\u$1/g; |
| 265 |
my ($traffic_value, $traffic_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{traffic_per_seconds}, network => 1); |
| 266 |
my $msg = sprintf( |
| 267 |
"Traffic %s : %s/s (%s)", |
| 268 |
$label, $traffic_value . $traffic_unit, |
| 269 |
defined($self->{result_values}->{traffic_prct}) ? sprintf('%.2f%%', $self->{result_values}->{traffic_prct}) : '-' |
| 270 |
); |
| 271 |
return $msg; |
| 272 |
} |
| 273 |
|
| 274 |
sub custom_traffic_calc { |
| 275 |
my ($self, %options) = @_; |
| 276 |
|
| 277 |
return -10 if (defined($self->{instance_mode}->{last_status}) && $self->{instance_mode}->{last_status} == 0); |
| 278 |
|
| 279 |
my $diff_traffic = ($options{new_datas}->{ $self->{instance} . '_' . $options{extra_options}->{label_ref} } - $options{old_datas}->{ $self->{instance} . '_' . $options{extra_options}->{label_ref} }); |
| 280 |
|
| 281 |
$self->{result_values}->{traffic_per_seconds} = $diff_traffic / $options{delta_time}; |
| 282 |
$self->{result_values}->{traffic_counter} = $options{new_datas}->{ $self->{instance} . '_' . $options{extra_options}->{label_ref} }; |
| 283 |
if (defined($options{new_datas}->{$self->{instance} . '_speed_' . $options{extra_options}->{label_ref}}) && |
| 284 |
$options{new_datas}->{$self->{instance} . '_speed_' . $options{extra_options}->{label_ref}} > 0) { |
| 285 |
$self->{result_values}->{traffic_prct} = $self->{result_values}->{traffic_per_seconds} * 100 / $options{new_datas}->{$self->{instance} . '_speed_' . $options{extra_options}->{label_ref}}; |
| 286 |
$self->{result_values}->{speed} = $options{new_datas}->{$self->{instance} . '_speed_' . $options{extra_options}->{label_ref}}; |
| 287 |
} |
| 288 |
|
| 289 |
$self->{result_values}->{label} = $options{extra_options}->{label_ref}; |
| 290 |
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'}; |
| 291 |
return 0; |
| 292 |
} |
| 293 |
|
| 294 |
sub new { |
| 295 |
my ($class, %options) = @_; |
| 296 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_set_traffic => 1, no_set_errors => 1, no_cast => 1); |
| 297 |
bless $self, $class; |
| 298 |
|
| 299 |
return $self; |
| 300 |
} |
| 301 |
|
| 302 |
sub load_speed { |
| 303 |
my ($self, %options) = @_; |
| 304 |
|
| 305 |
$self->{speed_loaded} = 1; |
| 306 |
$self->{snmp}->load(oids => [$self->{oid_speed}], instances => $self->{array_interface_selected}); |
| 307 |
} |
| 308 |
|
| 309 |
sub load_traffic { |
| 310 |
my ($self, %options) = @_; |
| 311 |
|
| 312 |
if ($self->{snmp}->is_snmpv1()) { |
| 313 |
$self->{output}->add_option_msg(short_msg => "Can't check SNMP 64 bits counters with SNMPv1."); |
| 314 |
$self->{output}->option_exit(); |
| 315 |
} |
| 316 |
|
| 317 |
if (!defined($self->{speed_loaded})) { |
| 318 |
$self->set_speed(); |
| 319 |
$self->load_speed(%options); |
| 320 |
} |
| 321 |
$self->set_oids_traffic(); |
| 322 |
$self->{snmp}->load(oids => [ |
| 323 |
$self->{oid_ing_cir}, $self->{oid_ing_eir}, |
| 324 |
$self->{oid_eg_cir}, $self->{oid_eg_eir}], instances => $self->{array_interface_selected} |
| 325 |
); |
| 326 |
} |
| 327 |
|
| 328 |
sub load_errors { |
| 329 |
my ($self, %options) = @_; |
| 330 |
|
| 331 |
if ($self->{snmp}->is_snmpv1()) { |
| 332 |
$self->{output}->add_option_msg(short_msg => "Can't check SNMP 64 bits counters with SNMPv1."); |
| 333 |
$self->{output}->option_exit(); |
| 334 |
} |
| 335 |
if (!defined($self->{speed_loaded})) { |
| 336 |
$self->set_speed(); |
| 337 |
$self->load_speed(%options); |
| 338 |
} |
| 339 |
$self->set_oids_errors(); |
| 340 |
$self->{snmp}->load(oids => [$self->{oid_ing_eir_discard}, $self->{oid_eg_eir_discard}], instances => $self->{array_interface_selected}); |
| 341 |
} |
| 342 |
|
| 343 |
sub add_result_speed { |
| 344 |
my ($self, %options) = @_; |
| 345 |
|
| 346 |
return if (defined($self->{int}->{$options{instance}}->{speed_in})); |
| 347 |
$self->{int}->{$options{instance}}->{speed_in} = 0; |
| 348 |
$self->{int}->{$options{instance}}->{speed_out} = 0; |
| 349 |
if ($self->{get_speed} == 0) { |
| 350 |
if (defined($self->{option_results}->{speed}) && $self->{option_results}->{speed} ne '') { |
| 351 |
$self->{int}->{$options{instance}}->{speed_in} = $self->{option_results}->{speed} * 1000000; |
| 352 |
$self->{int}->{$options{instance}}->{speed_out} = $self->{option_results}->{speed} * 1000000; |
| 353 |
} |
| 354 |
$self->{int}->{$options{instance}}->{speed_in} = $self->{option_results}->{speed_in} * 1000000 if (defined($self->{option_results}->{speed_in}) && $self->{option_results}->{speed_in} ne ''); |
| 355 |
$self->{int}->{$options{instance}}->{speed_out} = $self->{option_results}->{speed_out} * 1000000 if (defined($self->{option_results}->{speed_out}) && $self->{option_results}->{speed_out} ne ''); |
| 356 |
} else { |
| 357 |
my $interface_speed = defined($self->{results}->{$self->{oid_speed} . "." . $options{instance}}) ? $self->{results}->{$self->{oid_speed} . "." . $options{instance}} : 0; |
| 358 |
$interface_speed *= 1000; |
| 359 |
$self->{int}->{$options{instance}}->{speed_in} = $interface_speed; |
| 360 |
$self->{int}->{$options{instance}}->{speed_out} = $interface_speed; |
| 361 |
$self->{int}->{$options{instance}}->{speed_in} = $self->{option_results}->{speed_in} * 1000000 if (defined($self->{option_results}->{speed_in}) && $self->{option_results}->{speed_in} ne ''); |
| 362 |
$self->{int}->{$options{instance}}->{speed_out} = $self->{option_results}->{speed_out} * 1000000 if (defined($self->{option_results}->{speed_out}) && $self->{option_results}->{speed_out} ne ''); |
| 363 |
} |
| 364 |
} |
| 365 |
|
| 366 |
sub add_result_errors { |
| 367 |
my ($self, %options) = @_; |
| 368 |
|
| 369 |
$self->{int}->{$options{instance}}->{in_eir_discard} = $self->{results}->{$self->{oid_ing_eir_discard} . '.' . $options{instance}} * 8; |
| 370 |
$self->{int}->{$options{instance}}->{out_eir_discard} = $self->{results}->{$self->{oid_eg_eir_discard} . '.' . $options{instance}} * 8; |
| 371 |
$self->add_result_speed(%options); |
| 372 |
} |
| 373 |
|
| 374 |
sub add_result_traffic { |
| 375 |
my ($self, %options) = @_; |
| 376 |
|
| 377 |
$self->{int}->{$options{instance}}->{in_cir} = $self->{results}->{$self->{oid_ing_cir} . '.' . $options{instance}} * 8; |
| 378 |
$self->{int}->{$options{instance}}->{in_eir} = $self->{results}->{$self->{oid_ing_eir} . '.' . $options{instance}} * 8; |
| 379 |
$self->{int}->{$options{instance}}->{out_cir} = $self->{results}->{$self->{oid_eg_cir} . '.' . $options{instance}} * 8; |
| 380 |
$self->{int}->{$options{instance}}->{out_eir} = $self->{results}->{$self->{oid_eg_eir} . '.' . $options{instance}} * 8; |
| 381 |
$self->add_result_speed(%options); |
| 382 |
} |
| 383 |
|
| 384 |
1; |
| 385 |
|
| 386 |
__END__ |
| 387 |
|
| 388 |
=head1 MODE |
| 389 |
|
| 390 |
Check connections (A-Series.mib). |
| 391 |
|
| 392 |
=over 8 |
| 393 |
|
| 394 |
=item B<--add-status> |
| 395 |
|
| 396 |
Check interface status (by default if no --add-* option is set). |
| 397 |
|
| 398 |
=item B<--add-traffic> |
| 399 |
|
| 400 |
Check interface traffic. |
| 401 |
|
| 402 |
=item B<--add-errors> |
| 403 |
|
| 404 |
Check interface errors. |
| 405 |
|
| 406 |
=item B<--check-metrics> |
| 407 |
|
| 408 |
If the expression is true, metrics are checked (default: '%{opstatus} eq "up" or %{opstatus} eq "inService"'). |
| 409 |
|
| 410 |
=item B<--warning-status> |
| 411 |
|
| 412 |
Define the conditions to match for the status to be WARNING. |
| 413 |
You can use the following variables: %{admstatus}, %{opstatus}, %{display} |
| 414 |
|
| 415 |
=item B<--critical-status> |
| 416 |
|
| 417 |
Define the conditions to match for the status to be CRITICAL. |
| 418 |
Default (depends of the atrica release): |
| 419 |
'%{admstatus} eq "on" and %{opstatus} ne "inService"' |
| 420 |
'%{admstatus} eq "up" and %{opstatus} ne "up"' |
| 421 |
You can use the following variables: %{admstatus}, %{opstatus}, %{display} |
| 422 |
|
| 423 |
=item B<--warning-*> B<--critical-*> |
| 424 |
|
| 425 |
Thresholds. |
| 426 |
Can be: 'in-cir', 'in-eir', 'out-cir', 'out-eir', 'in-eir-discard', 'out-eir-discard'. |
| 427 |
|
| 428 |
=item B<--units-traffic> |
| 429 |
|
| 430 |
Units of thresholds for the traffic (default: 'percent_delta') ('percent_delta', 'bps', 'counter'). |
| 431 |
|
| 432 |
=item B<--units-errors> |
| 433 |
|
| 434 |
Units of thresholds for errors/discards (default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter'). |
| 435 |
|
| 436 |
=item B<--interface> |
| 437 |
|
| 438 |
Set the interface (number expected) example: 1,2,... (empty means 'check all interfaces'). |
| 439 |
|
| 440 |
=item B<--name> |
| 441 |
|
| 442 |
Allows you to define the interface (in option --interface) by name instead of OID index. The name matching mode supports regular expressions. |
| 443 |
|
| 444 |
=item B<--speed> |
| 445 |
|
| 446 |
Set interface speed for incoming/outgoing traffic (in Mb). |
| 447 |
|
| 448 |
=item B<--speed-in> |
| 449 |
|
| 450 |
Set interface speed for incoming traffic (in Mb). |
| 451 |
|
| 452 |
=item B<--speed-out> |
| 453 |
|
| 454 |
Set interface speed for outgoing traffic (in Mb). |
| 455 |
|
| 456 |
=item B<--reload-cache-time> |
| 457 |
|
| 458 |
Time in seconds before reloading cache file (default: 180). |
| 459 |
|
| 460 |
=item B<--oid-filter> |
| 461 |
|
| 462 |
Define the OID to be used to filter interfaces (default: atrConnCepGenDescr) (values: atrConnIngDescr, atrConnCepGenDescr). |
| 463 |
|
| 464 |
=item B<--oid-display> |
| 465 |
|
| 466 |
Define the OID that will be used to name the interfaces (default: atrConnCepGenDescr) (values: atrConnIngDescr, atrConnCepGenDescr). |
| 467 |
|
| 468 |
=item B<--oid-extra-display> |
| 469 |
|
| 470 |
Add an OID to display. |
| 471 |
|
| 472 |
=item B<--display-transform-src> B<--display-transform-dst> |
| 473 |
|
| 474 |
Modify the interface name displayed by using a regular expression. |
| 475 |
|
| 476 |
Example: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens' |
| 477 |
|
| 478 |
=item B<--show-cache> |
| 479 |
|
| 480 |
Display cache interface data. |
| 481 |
|
| 482 |
=back |
| 483 |
|
| 484 |
=cut |