add new perfdata for interfaces mode

This commit is contained in:
garnier-quentin 2019-06-03 18:04:45 +02:00
parent c30dc4abb7
commit 39f2b6bdf8
5 changed files with 67 additions and 70 deletions

View File

@ -41,7 +41,7 @@ sub set_counters_errors {
$self->SUPER::set_counters_errors(%options);
push @{$self->{maps_counters}->{int}},
{ label => 'in-crc', filter => 'add_errors', set => {
{ label => 'in-crc', filter => 'add_errors', nlabel => 'interface.packets.in.crc.count', set => {
key_values => [ { name => 'incrc', diff => 1 }, { name => 'total_in_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => $self->can('custom_errors_calc'), closure_custom_calc_extra_options => { label_ref1 => 'in', label_ref2 => 'crc' },
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets In Crc : %s',

View File

@ -40,7 +40,7 @@ sub set_counters_traffic {
my ($self, %options) = @_;
push @{$self->{maps_counters}->{int}},
{ label => 'traffic-in', filter => 'add_traffic', set => {
{ label => 'traffic-in', filter => 'add_traffic', nlabel => 'interface.traffic.in.bitspersecond', set => {
key_values => [ { name => 'traffic_in_15min', diff => 1 }, { name => 'traffic_in_1day', diff => 1 }, { name => 'speed_in'}, { name => 'display' } ],
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in' },
@ -49,7 +49,7 @@ sub set_counters_traffic {
closure_custom_threshold_check => $self->can('custom_traffic_threshold'),
}
},
{ label => 'traffic-out', filter => 'add_traffic', set => {
{ label => 'traffic-out', filter => 'add_traffic', nlabel => 'interface.traffic.out.bitspersecond', set => {
key_values => [ { name => 'traffic_out_15min', diff => 1 }, { name => 'traffic_out_1day', diff => 1 }, { name => 'speed_out'}, { name => 'display' } ],
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'out' },
@ -67,7 +67,7 @@ sub set_counters {
$self->SUPER::set_counters(%options);
push @{$self->{maps_counters}->{int}},
{ label => 'laser-temp', filter => 'add_optical', set => {
{ label => 'laser-temp', filter => 'add_optical', nlabel => 'interface.laser.temperature.celsius', set => {
key_values => [ { name => 'laser_temp' }, { name => 'display' } ],
output_template => 'Laser Temperature : %.2f C', output_error_template => 'Laser Temperature : %.2f',
perfdatas => [
@ -76,7 +76,7 @@ sub set_counters {
],
}
},
{ label => 'input-power', filter => 'add_optical', set => {
{ label => 'input-power', filter => 'add_optical', nlabel => 'interface.input.power.dbm', set => {
key_values => [ { name => 'input_power' }, { name => 'display' } ],
output_template => 'Input Power : %s dBm', output_error_template => 'Input Power : %s',
perfdatas => [
@ -85,7 +85,7 @@ sub set_counters {
],
}
},
{ label => 'output-power', filter => 'add_optical', set => {
{ label => 'output-power', filter => 'add_optical', nlabel => 'interface.output.power.dbm', set => {
key_values => [ { name => 'output_power' }, { name => 'display' } ],
output_template => 'Output Power : %s dBm', output_error_template => 'Output Power : %s',
perfdatas => [
@ -100,11 +100,6 @@ sub set_counters {
sub custom_traffic_perfdata {
my ($self, %options) = @_;
my $extra_label = '';
if (!defined($options{extra_instance}) || $options{extra_instance} != 0) {
$extra_label .= '_' . $self->{result_values}->{display};
}
my ($warning, $critical);
if ($self->{instance_mode}->{option_results}->{units_traffic} eq '%' && defined($self->{result_values}->{speed})) {
$warning = $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, total => $self->{result_values}->{speed}, cast_int => 1);
@ -114,11 +109,15 @@ sub custom_traffic_perfdata {
$critical = $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label});
}
$self->{output}->perfdata_add(label => 'traffic_' . $self->{result_values}->{label} . $extra_label, unit => 'b/s',
value => sprintf("%.2f", $self->{result_values}->{traffic_per_seconds}),
warning => $warning,
critical => $critical,
min => 0, max => $self->{result_values}->{speed});
$self->{output}->perfdata_add(
label => 'traffic_' . $self->{result_values}->{label}, unit => 'b/s',
nlabel => $self->{nlabel},
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef,
value => sprintf("%.2f", $self->{result_values}->{traffic_per_seconds}),
warning => $warning,
critical => $critical,
min => 0, max => $self->{result_values}->{speed}
);
}
sub custom_traffic_threshold {
@ -126,9 +125,9 @@ sub custom_traffic_threshold {
my $exit = 'ok';
if ($self->{instance_mode}->{option_results}->{units_traffic} eq '%' && defined($self->{result_values}->{speed})) {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{traffic_prct}, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]);
$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' } ]);
} elsif ($self->{instance_mode}->{option_results}->{units_traffic} eq 'b/s') {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{traffic_per_seconds}, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]);
$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' } ]);
}
return $exit;
}

View File

@ -146,7 +146,7 @@ sub set_counters_traffic {
my ($self, %options) = @_;
push @{$self->{maps_counters}->{int}},
{ label => 'in-cir', filter => 'add_traffic', set => {
{ label => 'in-cir', filter => 'add_traffic', nlabel => 'interface.traffic.in.cir.bitspersecond', set => {
key_values => [ { name => 'in_cir', diff => 1 }, { name => 'speed_in'}, { name => 'display' } ],
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in_cir' },
@ -155,7 +155,7 @@ sub set_counters_traffic {
closure_custom_threshold_check => $self->can('custom_traffic_threshold'),
}
},
{ label => 'in-eir', filter => 'add_traffic', set => {
{ label => 'in-eir', filter => 'add_traffic', nlabel => 'interface.traffic.in.eir.bitspersecond', set => {
key_values => [ { name => 'in_eir', diff => 1 }, { name => 'speed_in'}, { name => 'display' } ],
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in_eir' },
@ -164,7 +164,7 @@ sub set_counters_traffic {
closure_custom_threshold_check => $self->can('custom_traffic_threshold'),
}
},
{ label => 'out-cir', filter => 'add_traffic', set => {
{ label => 'out-cir', filter => 'add_traffic', nlabel => 'interface.traffic.out.cir.bitspersecond', set => {
key_values => [ { name => 'out_cir', diff => 1 }, { name => 'speed_out'}, { name => 'display' } ],
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'out_cir' },
@ -173,7 +173,7 @@ sub set_counters_traffic {
closure_custom_threshold_check => $self->can('custom_traffic_threshold'),
}
},
{ label => 'out-eir', filter => 'add_traffic', set => {
{ label => 'out-eir', filter => 'add_traffic', nlabel => 'interface.traffic.out.eir.bitspersecond', set => {
key_values => [ { name => 'out_eir', diff => 1 }, { name => 'speed_out'}, { name => 'display' } ],
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'out_eir' },
@ -189,7 +189,7 @@ sub set_counters_errors {
my ($self, %options) = @_;
push @{$self->{maps_counters}->{int}},
{ label => 'in-eir-discard', filter => 'add_errors', set => {
{ label => 'in-eir-discard', filter => 'add_errors', nlabel => 'interface.packets.in.eir.discards.count', set => {
key_values => [ { name => 'in_eir_discard', diff => 1 }, { name => 'speed_in'}, { name => 'display' } ],
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in_eir_discard' },
@ -198,7 +198,7 @@ sub set_counters_errors {
closure_custom_threshold_check => $self->can('custom_traffic_threshold'),
}
},
{ label => 'out-eir-discard', filter => 'add_errors', set => {
{ label => 'out-eir-discard', filter => 'add_errors', nlabel => 'interface.packets.out.eir.discards.count', set => {
key_values => [ { name => 'out_eir_discard', diff => 1 }, { name => 'speed_out'}, { name => 'display' } ],
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'out_eir_discard' },
@ -213,11 +213,6 @@ sub set_counters_errors {
sub custom_traffic_perfdata {
my ($self, %options) = @_;
my $extra_label = '';
if (!defined($options{extra_instance}) || $options{extra_instance} != 0) {
$extra_label .= '_' . $self->{result_values}->{display};
}
my ($warning, $critical);
if ($self->{instance_mode}->{option_results}->{units_traffic} eq '%' && defined($self->{result_values}->{speed})) {
$warning = $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, total => $self->{result_values}->{speed}, cast_int => 1);
@ -227,11 +222,15 @@ sub custom_traffic_perfdata {
$critical = $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label});
}
$self->{output}->perfdata_add(label => $self->{result_values}->{label} . $extra_label, unit => 'b/s',
value => sprintf("%.2f", $self->{result_values}->{traffic_per_seconds}),
warning => $warning,
critical => $critical,
min => 0, max => $self->{result_values}->{speed});
$self->{output}->perfdata_add(
label => $self->{result_values}->{label}, unit => 'b/s',
nlabel => $self->{nlabel},
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef,
value => sprintf("%.2f", $self->{result_values}->{traffic_per_seconds}),
warning => $warning,
critical => $critical,
min => 0, max => $self->{result_values}->{speed}
);
}
sub custom_traffic_threshold {

View File

@ -52,7 +52,7 @@ sub set_counters_global {
$self->SUPER::set_counters_global(%options);
push @{$self->{maps_counters}->{global}},
{ label => 'total-link-up', filter => 'add_global', set => {
{ label => 'total-link-up', filter => 'add_global', nlabel => 'total.interfaces.link.up.count', set => {
key_values => [ { name => 'global_link_up' }, { name => 'total_port' } ],
output_template => 'LinkStatus Up : %s', output_error_template => 'LinkStatus Up : %s',
output_use => 'global_link_up_absolute', threshold_use => 'global_link_up_absolute',
@ -62,7 +62,7 @@ sub set_counters_global {
],
}
},
{ label => 'total-link-down', filter => 'add_global', set => {
{ label => 'total-link-down', filter => 'add_global', nlabel => 'total.interfaces.link.down.count', set => {
key_values => [ { name => 'global_link_down' }, { name => 'total_port' } ],
output_template => 'LinkStatus Down : %s', output_error_template => 'LinkStatus Down : %s',
output_use => 'global_link_down_absolute', threshold_use => 'global_link_down_absolute',
@ -79,7 +79,7 @@ sub set_counters_errors {
my ($self, %options) = @_;
push @{$self->{maps_counters}->{int}},
{ label => 'in-crc', filter => 'add_errors', set => {
{ label => 'in-crc', filter => 'add_errors', nlabel => 'interface.packets.in.crc.count', set => {
key_values => [ { name => 'incrc', diff => 1 }, { name => 'total_in_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => $self->can('custom_errors_calc'), closure_custom_calc_extra_options => { label_ref1 => 'in', label_ref2 => 'crc' },
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets In Crc : %s',

View File

@ -108,10 +108,6 @@ sub custom_cast_calc {
sub custom_traffic_perfdata {
my ($self, %options) = @_;
my $extra_label = '';
if (!defined($options{extra_instance}) || $options{extra_instance} != 0) {
$extra_label .= '_' . $self->{result_values}->{display};
}
if (defined($self->{instance_mode}->{option_results}->{nagvis_perfdata})) {
$self->{result_values}->{traffic_per_seconds} /= 8;
$self->{result_values}->{speed} /= 8 if (defined($self->{result_values}->{speed}));
@ -128,7 +124,8 @@ sub custom_traffic_perfdata {
if (defined($self->{instance_mode}->{option_results}->{nagvis_perfdata})) {
$self->{output}->perfdata_add(
label => $self->{result_values}->{label} . $extra_label,
label => $self->{result_values}->{label},
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef,
value => sprintf("%.2f", $self->{result_values}->{traffic_per_seconds}),
warning => $warning,
critical => $critical,
@ -136,7 +133,9 @@ sub custom_traffic_perfdata {
);
} else {
$self->{output}->perfdata_add(
label => 'traffic_' . $self->{result_values}->{label} . $extra_label, unit => 'b/s',
label => 'traffic_' . $self->{result_values}->{label}, unit => 'b/s',
nlabel => $self->{nlabel},
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef,
value => sprintf("%.2f", $self->{result_values}->{traffic_per_seconds}),
warning => $warning,
critical => $critical,
@ -198,14 +197,12 @@ sub custom_traffic_calc {
# Errors
sub custom_errors_perfdata {
my ($self, %options) = @_;
my $extra_label = '';
if (!defined($options{extra_instance}) || $options{extra_instance} != 0) {
$extra_label .= '_' . $self->{result_values}->{display};
}
if ($self->{instance_mode}->{option_results}->{units_errors} eq '%') {
$self->{output}->perfdata_add(
label => 'packets_' . $self->{result_values}->{label2} . '_' . $self->{result_values}->{label1} . $extra_label, unit => '%',
label => 'packets_' . $self->{result_values}->{label2} . '_' . $self->{result_values}->{label1}, unit => '%',
nlabel => 'interface.packets.' . $self->{result_values}->{label1} . '.' . $self->{result_values}->{label2} . 's.percentage',
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef,
value => sprintf("%.2f", $self->{result_values}->{prct}),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}),
@ -213,7 +210,9 @@ sub custom_errors_perfdata {
);
} else {
$self->{output}->perfdata_add(
label => 'packets_' . $self->{result_values}->{label2} . '_' . $self->{result_values}->{label1} . $extra_label,
label => 'packets_' . $self->{result_values}->{label2} . '_' . $self->{result_values}->{label1},
nlabel => $self->{nlabel},
instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef,
value => $self->{result_values}->{used},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}),
@ -286,7 +285,7 @@ sub set_counters_global {
my ($self, %options) = @_;
push @{$self->{maps_counters}->{global}},
{ label => 'total-port', filter => 'add_global', set => {
{ label => 'total-port', filter => 'add_global', nlabel => 'total.interfaces.count', set => {
key_values => [ { name => 'total_port' } ],
output_template => 'Total port : %s', output_error_template => 'Total port : %s',
output_use => 'total_port_absolute', threshold_use => 'total_port_absolute',
@ -296,7 +295,7 @@ sub set_counters_global {
],
}
},
{ label => 'global-admin-up', filter => 'add_global', set => {
{ label => 'global-admin-up', filter => 'add_global', nlabel => 'total.interfaces.admin.up.count', set => {
key_values => [ { name => 'global_admin_up' }, { name => 'total_port' } ],
output_template => 'AdminStatus Up : %s', output_error_template => 'AdminStatus Up : %s',
output_use => 'global_admin_up_absolute', threshold_use => 'global_admin_up_absolute',
@ -306,7 +305,7 @@ sub set_counters_global {
],
}
},
{ label => 'total-admin-down', filter => 'add_global', set => {
{ label => 'total-admin-down', filter => 'add_global', nlabel => 'total.interfaces.admin.down.count', set => {
key_values => [ { name => 'global_admin_down' }, { name => 'total_port' } ],
output_template => 'AdminStatus Down : %s', output_error_template => 'AdminStatus Down : %s',
output_use => 'global_admin_down_absolute', threshold_use => 'global_admin_down_absolute',
@ -316,7 +315,7 @@ sub set_counters_global {
],
}
},
{ label => 'total-oper-up', filter => 'add_global', set => {
{ label => 'total-oper-up', filter => 'add_global', nlabel => 'total.interfaces.operational.up.count', set => {
key_values => [ { name => 'global_oper_up' }, { name => 'total_port' } ],
output_template => 'OperStatus Up : %s', output_error_template => 'OperStatus Up : %s',
output_use => 'global_oper_up_absolute', threshold_use => 'global_oper_up_absolute',
@ -326,7 +325,7 @@ sub set_counters_global {
],
}
},
{ label => 'total-oper-down', filter => 'add_global', set => {
{ label => 'total-oper-down', filter => 'add_global', nlabel => 'total.interfaces.operational.down.count', set => {
key_values => [ { name => 'global_oper_down' }, { name => 'total_port' } ],
output_template => 'OperStatus Down : %s', output_error_template => 'OperStatus Down : %s',
output_use => 'global_oper_down_absolute', threshold_use => 'global_oper_down_absolute',
@ -360,7 +359,7 @@ sub set_counters_traffic {
return if ($self->{no_traffic} != 0 && $self->{no_set_traffic} != 0);
push @{$self->{maps_counters}->{int}},
{ label => 'in-traffic', filter => 'add_traffic', set => {
{ label => 'in-traffic', filter => 'add_traffic', nlabel => 'interface.traffic.in.bitspersecond', set => {
key_values => $self->set_key_values_in_traffic(),
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in' },
@ -369,7 +368,7 @@ sub set_counters_traffic {
closure_custom_threshold_check => $self->can('custom_traffic_threshold'),
}
},
{ label => 'out-traffic', filter => 'add_traffic', set => {
{ label => 'out-traffic', filter => 'add_traffic', nlabel => 'interface.traffic.out.bitspersecond', set => {
key_values => $self->set_key_values_out_traffic(),
per_second => 1,
closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'out' },
@ -387,7 +386,7 @@ sub set_counters_errors {
return if ($self->{no_errors} != 0 && $self->{no_set_errors} != 0);
push @{$self->{maps_counters}->{int}},
{ label => 'in-discard', filter => 'add_errors', set => {
{ label => 'in-discard', filter => 'add_errors', nlabel => 'interface.packets.in.discards.count', set => {
key_values => [ { name => 'indiscard', diff => 1 }, { name => 'total_in_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => $self->can('custom_errors_calc'), closure_custom_calc_extra_options => { label_ref1 => 'in', label_ref2 => 'discard' },
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets In Discard : %s',
@ -395,7 +394,7 @@ sub set_counters_errors {
closure_custom_threshold_check => $self->can('custom_errors_threshold'),
}
},
{ label => 'in-error', filter => 'add_errors', set => {
{ label => 'in-error', filter => 'add_errors', nlabel => 'interface.packets.in.errors.count', set => {
key_values => [ { name => 'inerror', diff => 1 }, { name => 'total_in_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => $self->can('custom_errors_calc'), closure_custom_calc_extra_options => { label_ref1 => 'in', label_ref2 => 'error' },
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets In Error : %s',
@ -403,7 +402,7 @@ sub set_counters_errors {
closure_custom_threshold_check => $self->can('custom_errors_threshold'),
}
},
{ label => 'out-discard', filter => 'add_errors', set => {
{ label => 'out-discard', filter => 'add_errors', nlabel => 'interface.packets.out.discards.count', set => {
key_values => [ { name => 'outdiscard', diff => 1 }, { name => 'total_out_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => $self->can('custom_errors_calc'), closure_custom_calc_extra_options => { label_ref1 => 'out', label_ref2 => 'discard' },
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets Out Discard : %s',
@ -411,7 +410,7 @@ sub set_counters_errors {
closure_custom_threshold_check => $self->can('custom_errors_threshold'),
}
},
{ label => 'out-error', filter => 'add_errors', set => {
{ label => 'out-error', filter => 'add_errors', nlabel => 'interface.packets.out.errors.count', set => {
key_values => [ { name => 'outerror', diff => 1 }, { name => 'total_out_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => $self->can('custom_errors_calc'), closure_custom_calc_extra_options => { label_ref1 => 'out', label_ref2 => 'error' },
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets Out Error : %s',
@ -428,7 +427,7 @@ sub set_counters_cast {
return if ($self->{no_cast} != 0 && $self->{no_set_cast} != 0);
push @{$self->{maps_counters}->{int}},
{ label => 'in-ucast', filter => 'add_cast', set => {
{ label => 'in-ucast', filter => 'add_cast', nlabel => 'interface.packets.in.unicast.count', set => {
key_values => [ { name => 'iucast', diff => 1 }, { name => 'imcast', diff => 1 }, { name => 'ibcast', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => \&custom_cast_calc, closure_custom_calc_extra_options => { label_ref => 'iucast', total_ref1 => 'ibcast', total_ref2 => 'imcast' },
output_template => 'In Ucast : %.2f %%', output_error_template => 'In Ucast : %s',
@ -439,7 +438,7 @@ sub set_counters_cast {
],
}
},
{ label => 'in-bcast', filter => 'add_cast', set => {
{ label => 'in-bcast', filter => 'add_cast', nlabel => 'interface.packets.in.broadcast.count', set => {
key_values => [ { name => 'iucast', diff => 1 }, { name => 'imcast', diff => 1 }, { name => 'ibcast', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => \&custom_cast_calc, closure_custom_calc_extra_options => { label_ref => 'ibcast', total_ref1 => 'iucast', total_ref2 => 'imcast' },
output_template => 'In Bcast : %.2f %%', output_error_template => 'In Bcast : %s',
@ -450,7 +449,7 @@ sub set_counters_cast {
],
}
},
{ label => 'in-mcast', filter => 'add_cast', set => {
{ label => 'in-mcast', filter => 'add_cast', nlabel => 'interface.packets.in.multicast.count', set => {
key_values => [ { name => 'iucast', diff => 1 }, { name => 'imcast', diff => 1 }, { name => 'ibcast', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => \&custom_cast_calc, closure_custom_calc_extra_options => { label_ref => 'imcast', total_ref1 => 'iucast', total_ref2 => 'ibcast' },
output_template => 'In Mcast : %.2f %%', output_error_template => 'In Mcast : %s',
@ -461,7 +460,7 @@ sub set_counters_cast {
],
}
},
{ label => 'out-ucast', filter => 'add_cast', set => {
{ label => 'out-ucast', filter => 'add_cast', nlabel => 'interface.packets.out.unicast.count', set => {
key_values => [ { name => 'oucast', diff => 1 }, { name => 'omcast', diff => 1 }, { name => 'obcast', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => \&custom_cast_calc, closure_custom_calc_extra_options => { label_ref => 'oucast', total_ref1 => 'omcast', total_ref2 => 'obcast' },
output_template => 'Out Ucast : %.2f %%', output_error_template => 'Out Ucast : %s',
@ -472,7 +471,7 @@ sub set_counters_cast {
],
}
},
{ label => 'out-bcast', filter => 'add_cast', set => {
{ label => 'out-bcast', filter => 'add_cast', nlabel => 'interface.packets.out.broadcast.count', set => {
key_values => [ { name => 'oucast', diff => 1 }, { name => 'omcast', diff => 1 }, { name => 'obcast', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => \&custom_cast_calc, closure_custom_calc_extra_options => { label_ref => 'obcast', total_ref1 => 'omcast', total_ref2 => 'oucast' },
output_template => 'Out Bcast : %.2f %%', output_error_template => 'Out Bcast : %s',
@ -483,7 +482,7 @@ sub set_counters_cast {
],
}
},
{ label => 'out-mcast', filter => 'add_cast', set => {
{ label => 'out-mcast', filter => 'add_cast', nlabel => 'interface.packets.out.multicast.count', set => {
key_values => [ { name => 'oucast', diff => 1 }, { name => 'omcast', diff => 1 }, { name => 'obcast', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
closure_custom_calc => \&custom_cast_calc, closure_custom_calc_extra_options => { label_ref => 'omcast', total_ref1 => 'oucast', total_ref2 => 'obcast' },
output_template => 'Out Mcast : %.2f %%', output_error_template => 'Out Mcast : %s',
@ -503,7 +502,7 @@ sub set_counters_speed {
return if ($self->{no_speed} != 0 && $self->{no_set_speed} != 0);
push @{$self->{maps_counters}->{int}},
{ label => 'speed', filter => 'add_speed', set => {
{ label => 'speed', filter => 'add_speed', nlabel => 'interface.speed.bitspersecond', set => {
key_values => [ { name => 'speed' }, { name => 'display' } ],
closure_custom_calc => $self->can('custom_speed_calc'),
output_template => 'Speed : %s%s/s', output_error_template => 'Speed : %s%s/s',
@ -524,7 +523,7 @@ sub set_counters_volume {
return if ($self->{no_volume} != 0 && $self->{no_set_volume} != 0);
push @{$self->{maps_counters}->{int}},
{ label => 'in-volume', filter => 'add_volume', set => {
{ label => 'in-volume', filter => 'add_volume', nlabel => 'interface.volume.in.bytes', set => {
key_values => [ { name => 'in_volume', diff => 1 }, { name => 'display' } ],
output_template => 'Volume In : %.2f %s',
output_change_bytes => 1,
@ -534,7 +533,7 @@ sub set_counters_volume {
],
}
},
{ label => 'out-volume', filter => 'add_volume', set => {
{ label => 'out-volume', filter => 'add_volume', nlabel => 'interface.volume.out.bytes', set => {
key_values => [ { name => 'out_volume', diff => 1 }, { name => 'display' } ],
output_template => 'Volume Out : %.2f %s',
output_change_bytes => 1,