add datapoints in fetchstatistics mode

This commit is contained in:
Colin Gagnaire 2019-07-10 17:44:49 +02:00
parent d5dcba0fe3
commit 7308882503
1 changed files with 23 additions and 0 deletions

View File

@ -95,6 +95,25 @@ sub set_counters {
],
}
},
{ label => 'datapoints-count', nlabel => 'fetch.datapoints.count', set => {
key_values => [ { name => 'datapoints', diff => 1 }, { name => 'display' } ],
output_template => 'Datapoints: %d',
perfdatas => [
{ value => 'datapoints_absolute', template => '%d',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'datapoints-persecond', nlabel => 'fetch.datapoints.persecond', set => {
key_values => [ { name => 'datapoints', diff => 1 }, { name => 'display' } ],
per_second => 1,
output_template => 'Datapoints (per second): %.2f',
perfdatas => [
{ value => 'datapoints_per_second', template => '%.2f',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
];
}
@ -137,6 +156,10 @@ sub manage_selection {
$self->{fetchs}->{$fetch->{dimensions}->{app}}->{bytes_keys} = $fetch->{value};
$self->{fetchs}->{$fetch->{dimensions}->{app}}->{display} = $fetch->{dimensions}->{app};
}
foreach my $fetch (@{$self->{metrics}->{'warp.fetch.datapoints'}->{data}}) {
$self->{fetchs}->{$fetch->{dimensions}->{app}}->{datapoints} = $fetch->{value};
$self->{fetchs}->{$fetch->{dimensions}->{app}}->{display} = $fetch->{dimensions}->{app};
}
foreach (keys %{$self->{fetchs}}) {
delete $self->{fetchs}->{$_} if (defined($self->{option_results}->{filter_name}) &&