Are all_max_peak percentile calculations wrong?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
butch42
Posts: 1
Joined: Fri Nov 02, 2012 3:57 am

Are all_max_peak percentile calculations wrong?

Post by butch42 »

Hello,

as far as I checked and understood the source code the
calculations for 'all_max_peak' are wrong currently.

For type 'max' as well as 'all_max_peak' function
nth_percentile() is called with one $local_data_id,
returning a nth_percentile for the given datasource as
well as a calculated field 'nth_percentile_maximum'.

When using 'max', this field 'nth_percentile_maximum' is
used and this looks right for me.

When using 'all_max_peak', the nth_cache is iterated, seeking
for a maximum. But within each iteration the nth_percentile_maximum
is used which should be the same for every local_data_id of that
RRD. I think the iteration should seek for the maximum of the
n'th percentiles of the respective data sources.


The following patch makes that happen:

root@...# diff -u lib/graph_variables.php.20121008-dist lib/graph_variables.php
--- lib/graph_variables.php.20121008-dist 2012-10-25 15:18:56.000000000 +0200
+++ lib/graph_variables.php 2012-10-25 15:58:42.000000000 +0200
@@ -366,8 +366,8 @@
}elseif ($regexp_match_array[4] == "all_max_peak") {
for ($t=0;($t<count($graph_items));$t++) {
if ((preg_match("/(AREA|STACK|LINE[123])/", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
- if (! empty($nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"])) {
- $local_nth = $nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"];
+ if (! empty($nth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]})) {
+ $local_nth = $nth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]};
$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
$local_nth /= pow(10,intval($regexp_match_array[3]));


Is anyone able and willing to comment on this, check
my investigations or correct me?

I did post this to the mailinglist already, but the forum seems to be
more active than the list to mee.


Regards
Florian
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests