#549655 ganglia-webfrontend: The script pie.php creates wrong pie charts.

#549655#5
Date:
2009-10-05 10:02:57 UTC
From:
To:
Hello

The script
/usr/share/ganglia-webfrontend/pie.php
creates the pie charts wrongly.

This happens if 100% of the nodes are up.

The legend shows in fact 100% nodes up, but the pie shows that
100% of the nodes are down.

I assume this is a rounding issue or an issue of  periodic boundary conditions
somewhere.

I added few lines which solves the problem for us. Here is the diff:

# diff pie.php pie_patched.php
153a154,157

#549655#10
Date:
2018-12-01 19:44:20 UTC
From:
To:
I've just had a look at the report and could (temporarily) reproduce it.

First some hints for a reproducer.  In the cluster view we display a
heatmap as the default (and no pie chart).  We can either set
  $conf['heatmaps_enabled'] = 0;
or toggle the host display off with "Show Hosts Scaled:" = "None" in the
cluster view to get a pie chart with hosts up/down.

With these settings I got a gray pie with 100% hosts up. I tried your patch
and got a green pie as expected.  Now I've reverted your patch and still have
a green pie...

I wanted to try this patch instead of your's:
--- /usr/src/ganglia-web-3.6.1/pie.php  2014-04-04 12:20:44.000000000 +0200
+++ pie.php     2018-12-01 20:33:24.468726328 +0100
@@ -150,6 +150,8 @@
       $from = 0;$to = 0;
       for ($i = 0; $i < $n; $i++) {
         $this->angles[$i] = $this->roundoff( ($this->data[$i][0] * 360) / doubleval($this->sum));
+        if ( $this->angles[$i]>360 )
+          $this->angles[$i]=360;
       }
       $this->draw_slices( $this->center_x, $this->center_y, $this->angles, $this->colors );
     }

I now see that this shouldn't make a difference since we have in draw_slices():

286           if( $to > 360 )
287             $to = 360;

For now I'm unable to reproduce and don't have a fix, but my guess is some rounding error.
What's your host count?

#549655#15
Date:
2018-12-06 09:41:11 UTC
From:
To:
Hi,

Thanks for feedback on these bugs

There have been many new upstream releases, fixing a lot of bugs, but
they haven't been packaged yet because nobody has had time to package a
couple of new Javascript dependencies.

It was also suggested that the FTP masters might accept the new
Javascript as long as the ganglia-webfrontend source package includes
the unminified version of each.

If anybody wants to volunteer to help with that it would be very welcome.

Regards,

Daniel

#549655#20
Date:
2022-03-07 18:35:00 UTC
From:
To:
Dear Maintainer,

I still can't reproduce the bug. I agree that the bug should be closed.

Jochen