Attached are several files that break graph.php into several smaller and more modular components. Each chart is now generated from a specific .php file, and graph.php now serves as a frontend to these. There is one file per report, and a generic metric.php for reporting individual metrics. Adding a new report should be very straightforward: add a new report file named "<namehere>_report.php" to the new web/graphs/ directory, and add the report name to the $optional_graphs variable in conf.php.
I'm including only one actual patch file (to function.php) for this
change. Everything else is either a new file (all *_report.php
files), or the diff is large enough that following it may not make
much sense. I've tested this against r919 and updated it for r920.
Here are the files
function.php-add_sanitize.patch
Short patch to add a "sanitize" function, no other changes.
Better to have this here, and usable everywhere in the web FE, than
just for graphs.
graph.php
A *replacement* for the current graph.php. I can create a formal
patch file, but it is, I think easier to just replace the file
completely (then make your own diff if you want). There are a number
of changes in this file. The largest is the removal of all code to
actually generate the chart series for rrdtool. The huge if {} elseif
{} block is gone, with the contents pulled out into multiple
*_report.php files. Values from $_GET are checked in a slightly more
consistent manner, and a fair bit of documentation and commenting has
been added as well.
graphs/*
This is a new directory, with all new files. This directory needs
to be created, then place all "*_report.php" files and "metric.php"
in this location. A more commented version of the CPU report is also
included as "sample_report.php" to help with writing your own custom
report.s
With only a few minor cosmetic exceptions, the actual charts are the
same code as from the monolithic graph.php. None of the reports have
changed, just the structure around them.
I've not heard anything about progress on the proposed improvements
for 3.1.0 to the front end, and so far as things go, this isn't a huge
change. However, it's a start, and should help make future changes to
graphs a bit more self-contained. I'm sure that there can be some
improvements made, so right now I'd just like help testing, and to get
comments and feedback on code.
So...any comments or criticisms?
--
Jesse Becker
GPG Fingerprint -- BD00 7AA4 4483 AFCC 82D0 2720 0083 0931 9A2B 06A2
functions.php-add_sanitize.patch
Description: Binary data
graph.php
Description: Binary data
cpu_report.php
Description: Binary data
load_report.php
Description: Binary data
mem_report.php
Description: Binary data
metric.php
Description: Binary data
network_report.php
Description: Binary data
packet_report.php
Description: Binary data
sample_report.php
Description: Binary data
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________ Ganglia-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ganglia-developers
