Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for the custom time range in the stacked graph module #289

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
68b0fff
Source1 not needed. apache.conf already in current directory.
olahaye74 Feb 28, 2014
c20d878
[build & packaging] Reworked the install and packaging so it results …
olahaye74 Feb 28, 2014
b0140cf
Merge remote-tracking branch 'upstream/master'
olahaye74 Mar 4, 2014
3e6bbc0
Fix --with values unwanted dashes conversion to underscores.
olahaye74 Mar 5, 2014
5766642
fix a stupid copy-past error from me.
olahaye74 Mar 5, 2014
c01651b
No need to fold since gmetad returns upper-case
Jun 3, 2014
15ec29c
Lock the cache file while writing to prevent partial reads
Jun 3, 2014
7fff792
Merge remote-tracking branch 'upstream/master'
olahaye74 Jul 22, 2014
316e2e1
[Makefile + rpm spec file] Make Makefile more smart and more verbose,…
olahaye74 Jul 22, 2014
08beb2b
Added the capability to control the timezone used to display rrd metr…
Aug 22, 2014
65a6674
Merge pull request #231 from olahaye74/master
vvuksan Aug 23, 2014
dd378f0
Use moment for date/time manipulation in Javascript
Aug 25, 2014
118a94b
Add a timezone-picker to the time manipulation toolbar.
Aug 25, 2014
a521cbb
Fixed issue in overlay event logic. Expanded rrd variable regular exp…
Aug 25, 2014
8b9512b
Encode summary and host_regex parameters when adding events
Aug 26, 2014
cd84ec3
Upgraded to jQueryUI 1.11.1
Aug 28, 2014
629dcf6
Upgraded to jQueryUI 1.11.1
Aug 28, 2014
06e2982
Upgraded to jQuery/UI 1.11.1
Aug 28, 2014
0cef828
Upgraded to jQuery/UI 1.11.1
Aug 28, 2014
8c58e71
Merge remote branch 'upstream/master'
Aug 28, 2014
a3fd5b2
Upgrade to version 1.4.13 of the jquery.scrollTo plugin
Sep 7, 2014
e60a91f
When selecting a custom date-time range using the date-time picker on…
Sep 9, 2014
91a9f3c
Merge pull request #245 from pcpiela/master
vvuksan Sep 9, 2014
1bbffef
Merge pull request #246 from cddude229/lock-cache-file
vvuksan Sep 9, 2014
88cdaa9
Merge pull request #247 from cddude229/xml-folding
vvuksan Sep 9, 2014
8a01064
Enable custom time range selection by drag select for view and host m…
Sep 22, 2014
c7c2b7f
Merge remote branch 'upstream/master'
Sep 22, 2014
49a3080
Added support for specifying "maxrows" as a querystring parameter to …
Sep 25, 2014
7cd6265
Inspect graphs now control how many data points are generated based o…
Sep 25, 2014
b53eadf
Minor cleanup
Sep 25, 2014
0cc7ccc
Fixed an issue in conf_default.php.in that assumed version.php would …
Sep 26, 2014
13cae47
Merge pull request #1 from ganglia/master
Oct 2, 2014
f51f0ac
Don't global unused variables.
Jun 3, 2014
c206ceb
Get rid of global debug call to save time in production.
Jun 3, 2014
52a02b3
Micro-optimize globals inside the XML parsing functions
Jun 3, 2014
c989e6d
Merge pull request #252 from cddude229/microoptimize-xml-2
vvuksan Oct 2, 2014
841121c
Merge remote branch 'upstream/master'
Oct 10, 2014
325b569
Only initiate "zoom" when left mouse button is depressed. This change…
Oct 10, 2014
ef768e4
Switch to koenpunt fork that allows for dynamically adding items to m…
Oct 13, 2014
96efcea
Improvements to the mechanism for selecting metrics in the creation o…
Oct 13, 2014
86cc8c7
Remove jQuery 1.7.1 remnants
vvuksan Nov 4, 2014
3f95aa7
Revert "Remove jQuery 1.7.1 remnants"
vvuksan Nov 4, 2014
07f30e0
Add Inspect button Compare hosts
vvuksan Nov 4, 2014
58a8772
Added support for dashed lines in Inspect graphs
Nov 7, 2014
60804f3
Merge remote branch 'upstream/master'
Nov 7, 2014
27e6f80
Merge branch 'master' of https://github.com/ganglia/ganglia-web
Jul 9, 2016
4bf01a4
Added support for the custom time range in the stacked graph module.
Jul 10, 2016
5c74f00
Further changes to support custom time range for stacked graphs
Jul 11, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 114 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,66 +13,148 @@ GWEB_STATEDIR = /var/lib/ganglia-web
# Gmetad rootdir (parent location of rrd folder)
GMETAD_ROOTDIR = /var/lib/ganglia

APACHE_USER = www-data
#APACHE_USER = www-data
#APACHE_GROUP = www-data
##########################################################

ifndef APACHE_USER
$(info APACHE_USER is not set using www-data)
APACHE_USER = www-data
endif

ifndef APACHE_GROUP
$(info APACHE_GROUP is not set, using $(APACHE_USER))
APACHE_GROUP = $(APACHE_USER)
endif

# Gweb version
GWEB_VERSION = 3.7.2

DIST_NAME = ganglia-web
DIST_DIR = $(DIST_NAME)-$(GWEB_VERSION)
DIST_TARBALL = $(DIST_DIR).tar.gz

TARGETS = conf_default.php ganglia-web.spec version.php apache.conf
# TARGETS: Files that needs to be patched with user chosen variables
TARGETS = conf_default.php conf_redirect.php apache.conf

# DIST_GZIP_TARGETS targets that needs to be patched once before dist-gzip
# basicaly version and default values.
DIST_GZIP_TARGETS = ganglia-web.spec version.php

all: default

default: $(TARGETS)

clean:
rm -rf $(TARGETS) $(DIST_DIR) $(DIST_TARBALL) rpmbuild
@echo -n "Cleaning build files ............................... "
@rm -rf $(TARGETS) $(DIST_DIR) $(DIST_TARBALL) rpmbuild
@echo "DONE."

conf_default.php: conf_default.php.in
sed -e "s|@vargmetadir@|$(GMETAD_ROOTDIR)|" -e "s|@vargwebstatedir@|$(GWEB_STATEDIR)|g" conf_default.php.in > conf_default.php
@echo -n "Generating conf_default.php ........................ "
@sed -e "s|@vargmetadir@|$(GMETAD_ROOTDIR)|" -e "s|@vargwebdir@|$(GWEB_STATEDIR)|g" -e "s|@vargwebroot@|$(GDESTDIR)|g" conf_default.php.in > conf_default.php
@echo "DONE."

conf_redirect.php: conf_redirect.php.in
@echo -n "Generating conf_redirect.php ....................... "
@sed -e "s|@etcdir@|$(GCONFDIR)|" conf_redirect.php.in > conf_redirect.php
@echo "DONE."

ganglia-web.spec: ganglia-web.spec.in
sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ -e "s|@vargwebdir@|$(GWEB_STATEDIR)|" -e "s|@varapacheuser@|$(APACHE_USER)|g" -e "s|@etcdir@|$(GCONFDIR)|g" ganglia-web.spec.in > ganglia-web.spec
@echo -n "Generating ganglia-web.spec ........................ "
@sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ -e "s|@vargwebdir@|$(GWEB_STATEDIR)|" -e "s|@GDESTDIR@|$(GDESTDIR)|g" -e "s|@etcdir@|$(GCONFDIR)|g" ganglia-web.spec.in > ganglia-web.spec
@echo "DONE."

version.php: version.php.in
sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ version.php.in > version.php
@echo -n "Generating version.php ............................. "
@sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ version.php.in > version.php
@echo "DONE."

apache.conf: apache.conf.in
sed -e "s|@GDESTDIR@|$(GDESTDIR)|g" apache.conf.in > apache.conf
@echo -n "Generating apache.conf ............................. "
@sed -e "s|@GDESTDIR@|$(GDESTDIR)|g" apache.conf.in > apache.conf
@echo "DONE."

dist-dir: default
rsync --exclude "rpmbuild" --exclude "*.gz" --exclude "Makefile" --exclude "*debian*" --exclude "$(DIST_DIR)" --exclude ".git*" --exclude "*.in" --exclude "*~" --exclude "#*#" --exclude "ganglia-web.spec" --exclude "apache.conf" -a . $(DIST_DIR)

install: dist-dir
mkdir -p $(DESTDIR)/$(GWEB_STATEDIR)/dwoo/compiled && \
mkdir -p $(DESTDIR)/$(GWEB_STATEDIR)/dwoo/cache && \
mkdir -p $(DESTDIR)/$(GWEB_STATEDIR) && \
rsync -a $(DIST_DIR)/conf $(DESTDIR)/$(GWEB_STATEDIR) && \
mkdir -p $(DESTDIR)/$(GDESTDIR) && \
rsync --exclude "conf" -a $(DIST_DIR)/* $(DESTDIR)/$(GDESTDIR) && \
chown -R $(APACHE_USER):$(APACHE_USER) $(DESTDIR)/$(GWEB_STATEDIR)

dist-gzip: dist-dir
if [ -f $(DIST_TARBALL) ]; then \
rm -rf $(DIST_TARBALL) ;\
fi ;\
tar -czf $(DIST_TARBALL) $(DIST_DIR)/*
@echo -n "Filling dist dir ................................... "
@rsync --exclude "rpmbuild" \
--exclude "debian/ganglia-webfrontend" \
--exclude "*.gz" \
--exclude "$(DIST_DIR)" \
--exclude ".git*" \
--exclude "version.php.in" \
--exclude "ganglia-web.spec.in" \
--exclude "apache.conf" \
--exclude "conf_default.php" \
--exclude "*~" \
--exclude "#*#" \
-a . $(DIST_DIR)
@echo "DONE."

install: install-files
@echo -n "Setting ownership to the sharedstattedir files ..... "
@chown -R $(APACHE_USER):$(APACHE_GROUP) $(DESTDIR)/$(GWEB_STATEDIR)
@echo "DONE."


install-files: dist-dir
@echo -n "Creating dwoo sharedstattedir tree ................. "
@mkdir -p $(DESTDIR)/$(GWEB_STATEDIR)/dwoo/compiled
@mkdir -p $(DESTDIR)/$(GWEB_STATEDIR)/dwoo/cache
@mkdir -p $(DESTDIR)/$(GWEB_STATEDIR)/filters
@echo "DONE."
@echo -n "Installing ganglia-webfrontend low level conf ...... "
@rsync -a $(DIST_DIR)/conf $(DESTDIR)/$(GWEB_STATEDIR)
@echo "DONE."
@echo -n "Installing php files ............................... "
@mkdir -p $(DESTDIR)/$(GDESTDIR)
@rsync --exclude "conf" \
--exclude conf_redirect.php \
--exclude "*.in" \
--exclude "*.spec" \
-a $(DIST_DIR)/* $(DESTDIR)/$(GDESTDIR)
@echo "DONE."
@echo -n "Intalling redirect conf.php ........................ "
@# so it can be seen as a config file under debian packages.
@# Do the same for all distro to avoid specific case for debian.
@cp -f conf_redirect.php $(DESTDIR)/$(GDESTDIR)/conf.php
@echo "DONE."
@echo -n "Installing the generated conf_default.php file ..... "
@cp -f conf_default.php $(DESTDIR)/$(GDESTDIR)/conf_default.php
@echo "DONE."
@echo -n "Creating the etc/ganglia-webfrontend directory ..... "
@mkdir -p $(DESTDIR)/$(GCONFDIR)
@echo "DONE."
@echo -n "Installing apache.conf ............................. "
@cp -f apache.conf $(DESTDIR)/$(GCONFDIR)/
@echo "DONE."
@echo -n "Installing the editable copy of conf_default.php ... "
@cp -f conf_default.php $(DESTDIR)/$(GCONFDIR)/conf.php
@echo "DONE."

dist-gzip: dist-dir $(DIST_GZIP_TARGETS)
@echo -n "Creating tarball ................................... "
@if [ -f $(DIST_TARBALL) ]; then \
rm -rf $(DIST_TARBALL) ;\
fi
@cp -pf $(DIST_GZIP_TARGETS) $(DIST_DIR)
@tar -czf $(DIST_TARBALL) $(DIST_DIR)/*
@echo "DONE."

rpm: dist-gzip ganglia-web.spec apache.conf
rm -rf rpmbuild
mkdir rpmbuild
mkdir rpmbuild/SOURCES
mkdir rpmbuild/BUILD
mkdir rpmbuild/RPMS
mkdir rpmbuild/SRPMS
cp $(DIST_TARBALL) rpmbuild/SOURCES
cp apache.conf rpmbuild/SOURCES
rpmbuild --define '_topdir $(PWD)/rpmbuild' --define 'custom_web_prefixdir $(GDESTDIR)' -bb ganglia-web.spec
@echo -n "Creating binary rpm ................................ "
@rm -rf rpmbuild
@mkdir rpmbuild
@mkdir rpmbuild/SOURCES
@mkdir rpmbuild/BUILD
@mkdir rpmbuild/RPMS
@mkdir rpmbuild/SRPMS
@ln -s ../../$(DIST_TARBALL) rpmbuild/SOURCES/$(DIST_TARBALL)
@rpmbuild --define '_topdir $(PWD)/rpmbuild' --define 'web_prefixdir $(GDESTDIR)' -bb ganglia-web.spec
@echo "DONE."

uninstall:
@echo -n "Uninstalling ganglia-web. (conf files untouched) ... "
rm -rf $(DESTDIR)/$(GDESTDIR) $(DESTDIR)/$(GWEB_STATEDIR)
@echo "DONE."

62 changes: 47 additions & 15 deletions aggregate_graphs.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script>
<script type="text/javascript">
function refreshAggregateGraph() {
$("#aggregate_graph_display img").each(function (index) {
var src = $(this).attr("src");
Expand All @@ -10,7 +10,7 @@ function refreshAggregateGraph() {
}

function createAggregateGraph() {
if ($('#hreg').val() == "" || $('#metric_chooser').val() == "") {
if ($('#hreg').val() == "" || $('#aggregate_graph_metric_chooser').val() == "") {
alert("Host regular expression and metric name can't be blank");
return false;
}
Expand Down Expand Up @@ -95,6 +95,8 @@ function restoreAggregateGraph() {
var hreg = $.cookie("ganglia-aggregate-graph-hreg" + window.name);
if (hreg != null)
$("#hreg").val(hreg);
else
$("#hreg").val(".*");

var gtype = $.cookie("ganglia-aggregate-graph-gtype" + window.name);
if (gtype != null) {
Expand All @@ -112,9 +114,18 @@ function restoreAggregateGraph() {
$("#glhide").click();
}

var metric = $.cookie("ganglia-aggregate-graph-metric" + window.name);
if (metric != null)
$("#metric_chooser").val(metric);
var mreg = $.cookie("ganglia-aggregate-graph-metric" + window.name);
if (mreg != null) {
var metric_chooser = $("#aggregate_graph_metric_chooser");
var metrics = mreg.split("_|_");
// Ensure that all selected options are included in the list
for (var i = 0; i < metrics.length; i++) {
if (metric_chooser.find("option[value='" + metrics[i] + "']").length == 0) {
metric_chooser.append($("<option></option>").attr("value", metrics[i]).text(metrics[i]));
}
}
metric_chooser.val(metrics).trigger("chosen:updated");
}

var title = $.cookie("ganglia-aggregate-graph-title" + window.name);
if (title != null)
Expand All @@ -132,24 +143,31 @@ function restoreAggregateGraph() {
if (lower != null)
$("#n").val(lower);

if (hreg != null && metric != null)
if (mreg != null)
return true;
else
return false;
}

$( "#metric_chooser" ).autocomplete({
source: availablemetrics,
change: function(event, ui) {
$.cookie("ganglia-aggregate-graph-metric" + window.name,
$("#metric_chooser").val());
}
$( "#aggregate_graph_metric_chooser" ).chosen({
create_option: true,
skip_no_results: true,
search_contains: true,
no_results_text: "No metrics matched",
placeholder_text_multiple: "Select and/or define metrics to be plotted",
create_option_text: "Add metric regular expression"
}).
on('change', function(event, params) {
if (event.target == this) {
$.cookie("ganglia-aggregate-graph-metric" + window.name,
$(this).val().join("_|_"));
}
});

if (restoreAggregateGraph())
createAggregateGraph();
});
</script>
</script type="text/javascript">
<div id="aggregate_graph_header">
<h2>Create aggregate graphs</h2>
<form id="aggregate_graph_form">
Expand All @@ -169,8 +187,22 @@ function restoreAggregateGraph() {
<td>Host Regular expression e.g. web-[0,4], web or (web|db):</td>
<td colspan=2><input name="hreg[]" id="hreg" size=60></td>
</tr>
<tr><td>Metric Regular expression (not a report e.g. load_one, bytes_(in|out)):</td>
<td colspan=2><input name="mreg[]" id="metric_chooser" size=60></td>
<tr><td>Metric Regular expression(s):</td>
<td colspan=2><select name="mreg[]" id="aggregate_graph_metric_chooser" multiple style="width:100%;">
<?php
require_once('./eval_conf.php');
require_once('./functions.php');

$available_metrics = array();
retrieve_metrics_cache("metric_list");

asort($index_array['metrics']);
foreach ($index_array['metrics'] as $key => $value) {
print "<option value='" . $value . "'>" . $value . "</option>";
}
unset($available_metrics);
?>
</select></td>
</tr>
<tr>
<td>Graph Type:</td><td>
Expand Down
Loading