Re: Are all_max_peak percentile calculations wrong?
Gandalf <[email protected]>
| Newsgroups | gmane.network.cacti.user |
|---|---|
| Message-ID | <[email protected]> |
It would be a good move to open a bug report to help tracking this issue
(http://bugs.cacti.net).
In case you have an example (e.g. set of rrd files and a graph or the like) this
would help reproducing this issue and verifying the fix.
Reinhard
On 25.10.2012 16:30, Florian Roscher wrote:
> 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@cacti:/var/www/cacti_test# 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?
>
>
> Regards
> Florian
>
>
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov