Below is a link to a patch against the current SVN trunk (r931) to split
graphing into discrete parts.  This is a rehash of a post from early
January[1], but with a number of fixes, and a lot of updated
documentation in the code.  I would post it inline, but it's too large
for the mailing list.[2]

The patch can be found here:

  http://pliernose.ath.cx/ganglia/patches/modular-graph.patch

As always, comments are welcome.

As before, each chart is generated from a specific .php file, with
graph.php acting as a "frontend" of sorts.
There is one file per report (Load, CPU, Network, etc), a generic
metric.php for reporting individual metrics, and a heavily commented
"sample_report.php" file.  Gone is the huge if/else block for all of
the different graph types.  Various sanitation and check routines are,
I hope, more clearly laid out.

Adding a new report should now be straightforward:
 1) Add a new report file named "<namehere>_report.php" in web/graphs.d/
 2) Add the report name to the $optional_graphs variable in conf.php.

This should also help down the road during the hypothetical UI
overhaul.  Since the graphs are split more cleanly, it should easier
for the front end code (and users) to request specific graphs.

For people who like this sort of thing, here's a diffstat of the patch:

 conf.php                   |    3
 functions.php              |    5
 graph.d/cpu_report.php     |   77 ++++++++
 graph.d/load_report.php    |   48 +++++
 graph.d/mem_report.php     |   58 ++++++
 graph.d/metric.php         |  127 ++++++++++++++
 graph.d/network_report.php |   35 ++++
 graph.d/packet_report.php  |   35 ++++
 graph.d/sample_report.php  |  137 +++++++++++++++
 graph.php                  |  389
++++++++++++++-------------------------------
 10 files changed, 652 insertions(+), 262 deletions(-)

This nicely reflects the complexity of the various reports.  The
individual metrics are, by far, the most complicated, as there is
different handling depending on context.  The sample_report is
actually just the CPU_report, but has about 50 lines of comments on
how the graphs are created.

I have been using this patch "in production" for the last two weeks on
a moderate sized cluster, and it has worked well.

[1] 
http://sf.net/mailarchive/message.php?msg_id=dbdc3b250801072023g70116de4lf7bb2751ad9eaba2%40mail.gmail.com
[2] List moderators:  feel free to reject that other email from the to
the list. :-)
-- 
Jesse Becker
GPG Fingerprint -- BD00 7AA4 4483 AFCC 82D0  2720 0083 0931 9A2B 06A2

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to