From 7308882503e7a248090f6808251f44768fa83d4a Mon Sep 17 00:00:00 2001 From: Colin Gagnaire Date: Wed, 10 Jul 2019 17:44:49 +0200 Subject: [PATCH] add datapoints in fetchstatistics mode --- .../warp10/sensision/mode/fetchstatistics.pm | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/database/warp10/sensision/mode/fetchstatistics.pm b/database/warp10/sensision/mode/fetchstatistics.pm index 5e4bc46df..c57b21c2c 100644 --- a/database/warp10/sensision/mode/fetchstatistics.pm +++ b/database/warp10/sensision/mode/fetchstatistics.pm @@ -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}) &&