(snmp_standard) mode interfaces - manage deltaps unit for errors and cast (#4481)

This commit is contained in:
qgarnier 2023-06-16 17:00:04 +02:00 committed by GitHub
parent 4b73ff2bc4
commit 0b420c90a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 132 additions and 71 deletions

View File

@ -115,11 +115,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -115,11 +115,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -398,11 +398,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -126,11 +126,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -249,11 +249,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -431,7 +431,7 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--interface>

View File

@ -319,11 +319,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -190,11 +190,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -143,11 +143,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -336,11 +336,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -245,11 +245,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -320,11 +320,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -216,11 +216,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -483,11 +483,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -125,11 +125,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -103,11 +103,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -249,11 +249,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -91,6 +91,19 @@ sub custom_cast_perfdata {
min => 0,
max => 100
);
} elsif ($self->{instance_mode}->{option_results}->{units_cast} eq 'deltaps') {
my $nlabel = $self->{nlabel};
$nlabel =~ s/count$/persecond/;
$self->{output}->perfdata_add(
force_new_perfdata => 1,
nlabel => $nlabel,
instances => $self->{result_values}->{display},
value => sprintf('%.2f', $self->{result_values}->{used_ps}),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
unit => '/s',
min => 0
);
} else {
$self->{output}->perfdata_add(
force_new_perfdata => 1,
@ -111,6 +124,8 @@ sub custom_cast_threshold {
my $exit = 'ok';
if ($self->{instance_mode}->{option_results}->{units_cast} =~ /percent/) {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{prct}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]);
} elsif ($self->{instance_mode}->{option_results}->{units_cast} eq 'deltaps') {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{used_ps}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]);
} else {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{used}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]);
}
@ -120,6 +135,18 @@ sub custom_cast_threshold {
sub custom_cast_output {
my ($self, %options) = @_;
if ($self->{instance_mode}->{option_results}->{units_cast} eq 'deltaps') {
return sprintf(
'%s %s : %.2f/s (%.2f%% - %s on %s)',
$self->{result_values}->{cast_going} eq 'i' ? 'In' : 'Out',
ucfirst($self->{result_values}->{cast_test}),
$self->{result_values}->{used_ps},
$self->{result_values}->{prct},
$self->{result_values}->{used},
$self->{result_values}->{total}
);
}
return sprintf(
'%s %s : %.2f%% (%s on %s)',
$self->{result_values}->{cast_going} eq 'i' ? 'In' : 'Out',
@ -163,6 +190,10 @@ sub custom_cast_calc {
} elsif ($self->{instance_mode}->{option_results}->{units_cast} eq 'delta') {
$self->{result_values}->{prct} = $cast_diff * 100 / $total_diff if ($total_diff > 0);
$self->{result_values}->{used} = $cast_diff;
} elsif ($self->{instance_mode}->{option_results}->{units_cast} eq 'deltaps') {
$self->{result_values}->{prct} = $cast_diff * 100 / $total_diff if ($total_diff > 0);
$self->{result_values}->{used} = $cast_diff;
$self->{result_values}->{used_ps} = $cast_diff / $options{delta_time};
} else {
$self->{result_values}->{prct} = $cast_diff * 100 / $total_diff if ($total_diff > 0);
$self->{result_values}->{used} = $cast;
@ -296,6 +327,19 @@ sub custom_errors_perfdata {
min => 0,
max => 100
);
} elsif ($self->{instance_mode}->{option_results}->{units_errors} eq 'deltaps') {
my $nlabel = $self->{nlabel};
$nlabel =~ s/count$/persecond/;
$self->{output}->perfdata_add(
force_new_perfdata => 1,
nlabel => $nlabel,
unit => '/s',
instances => $self->{result_values}->{display},
value => sprintf('%.2f', $self->{result_values}->{used_ps}),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
min => 0
);
} else {
$self->{output}->perfdata_add(
label => 'packets_' . $self->{result_values}->{label2} . '_' . $self->{result_values}->{label1},
@ -316,6 +360,8 @@ sub custom_errors_threshold {
my $exit = 'ok';
if ($self->{instance_mode}->{option_results}->{units_errors} =~ /percent/) {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{prct}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]);
} elsif ($self->{instance_mode}->{option_results}->{units_errors} eq 'deltaps') {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{used_ps}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]);
} else {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{used}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]);
}
@ -325,6 +371,17 @@ sub custom_errors_threshold {
sub custom_errors_output {
my ($self, %options) = @_;
if ($self->{instance_mode}->{option_results}->{units_errors} eq 'deltaps') {
return sprintf(
'Packets %s : %.2f/s (%.2f%% - %s on %s)',
$self->{result_values}->{label},
$self->{result_values}->{used_ps},
$self->{result_values}->{prct},
$self->{result_values}->{used},
$self->{result_values}->{total}
);
}
return sprintf(
'Packets %s : %.2f%% (%s on %s)',
$self->{result_values}->{label},
@ -362,6 +419,10 @@ sub custom_errors_calc {
} elsif ($self->{instance_mode}->{option_results}->{units_errors} eq 'delta') {
$self->{result_values}->{prct} = $errors_diff * 100 / $total_diff if ($total_diff > 0);
$self->{result_values}->{used} = $errors_diff;
} elsif ($self->{instance_mode}->{option_results}->{units_errors} eq 'deltaps') {
$self->{result_values}->{prct} = $errors_diff * 100 / $total_diff if ($total_diff > 0);
$self->{result_values}->{used} = $errors_diff;
$self->{result_values}->{used_ps} = $errors_diff / $options{delta_time};
} else {
$self->{result_values}->{prct} = $errors * 100 / $total if ($total > 0);
$self->{result_values}->{used} = $errors;
@ -954,7 +1015,7 @@ sub check_options {
$self->{option_results}->{units_errors} eq '' ||
$self->{option_results}->{units_errors} eq '%');
$self->{option_results}->{units_errors} = 'delta' if ($self->{option_results}->{units_errors} eq 'absolute'); # compat
if ($self->{option_results}->{units_errors} !~ /^(?:percent|percent_delta|delta|counter)$/) {
if ($self->{option_results}->{units_errors} !~ /^(?:percent|percent_delta|delta|deltaps|counter)$/) {
$self->{output}->add_option_msg(short_msg => 'Wrong option --units-errors.');
$self->{output}->option_exit();
}
@ -962,7 +1023,7 @@ sub check_options {
if (defined($self->{option_results}->{add_cast})) {
$self->{option_results}->{units_cast} = 'percent_delta'
if (!defined($self->{option_results}->{units_cast}) || $self->{option_results}->{units_cast} eq '');
if ($self->{option_results}->{units_cast} !~ /^(?:percent|percent_delta|delta|counter)$/) {
if ($self->{option_results}->{units_cast} !~ /^(?:percent|percent_delta|delta|deltaps|counter)$/) {
$self->{output}->add_option_msg(short_msg => 'Wrong option --units-cast.');
$self->{output}->option_exit();
}
@ -1606,11 +1667,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>

View File

@ -116,11 +116,11 @@ Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta',
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>