Skip to content

Commit

Permalink
Merge pull request #1 from pcpiela/master
Browse files Browse the repository at this point in the history
Fixed consistency issues between Makefile, conf_default.php.in gweb.spec.in
  • Loading branch information
vvuksan committed Jan 11, 2012
2 parents a04588b + 4f2f8ff commit 0c62726
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 34 deletions.
25 changes: 17 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,42 @@ TARGETS = conf_default.php gweb.spec version.php
default: $(TARGETS)

clean:
rm -rf $(TARGETS) $(DIST_DIR) $(DIST_TARBALL)
rm -rf $(TARGETS) $(DIST_DIR) $(DIST_TARBALL) rpmbuild

conf_default.php: conf_default.php.in
sed -e "s|@varstatedir@|$(GWEB_STATEDIR)|" conf_default.php.in > conf_default.php

gweb.spec: gweb.spec.in
sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ -e "s|@varstatedir@|$(GWEB_STATEDIR)|" gweb.spec.in > gweb.spec
sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ -e "s|@varstatedir@|$(GWEB_STATEDIR)|" -e "s|@varapacheuser@|$(APACHE_USER)|g" gweb.spec.in > gweb.spec

version.php: version.php.in
sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ version.php.in > version.php

dist-dir: default
rsync --exclude "$(DIST_DIR)" --exclude ".git*" --exclude "*~" -a . $(DIST_DIR) && \
cp -a $(TARGETS) $(DIST_DIR)
rsync --exclude "rpmbuild" --exclude "*.gz" --exclude "Makefile" --exclude "$(DIST_DIR)" --exclude ".git*" --exclude "*.in" --exclude "*~" --exclude "#*#" --exclude "gweb.spec" -a . $(DIST_DIR)

install: dist-dir
mkdir -p $(DESTDIR)/$(GWEB_DWOO) && \
rsync --exclude debian -a $(DIST_DIR)/conf/ $(DESTDIR)/$(GANGLIA_STATEDIR)/conf && \
cp -a $(DIST_DIR)/* $(DESTDIR) && \
chown -R $(APACHE_USER):$(APACHE_USER) $(DESTDIR)/$(GWEB_DWOO) $(DESTDIR)/$(GANGLIA_STATEDIR)/conf
mkdir -p $(GWEB_DWOO) && \
rsync -a $(DIST_DIR)/conf/ $(GANGLIA_STATEDIR)/conf && \
rsync --exclude "conf" -a $(DIST_DIR)/* $(DESTDIR) && \
chown -R $(APACHE_USER):$(APACHE_USER) $(GWEB_DWOO) $(GANGLIA_STATEDIR)/conf

dist-gzip: dist-dir
if [ -f $(DIST_TARBALL) ]; then \
rm -rf $(DIST_TARBALL) ;\
fi ;\
tar -czf $(DIST_TARBALL) $(DIST_DIR)/*

rpm: dist-gzip gweb.spec
rm -rf rpmbuild
mkdir rpmbuild
mkdir rpmbuild/SOURCES
mkdir rpmbuild/BUILD
mkdir rpmbuild/RPMS
mkdir rpmbuild/SRPMS
cp $(DIST_TARBALL) rpmbuild/SOURCES
rpmbuild --define '_topdir $(PWD)/rpmbuild' -bb gweb.spec

uninstall:
rm -rf $(DESTDIR) $(GWEB_DWOO) $(GANGLIA_STATEDIR)/conf

12 changes: 7 additions & 5 deletions conf_default.php.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ $conf['gmetad_root'] = "@varstatedir@/ganglia";
$conf['rrds'] = "${conf['gmetad_root']}/rrds";

# Where Dwoo (PHP templating engine) store compiled templates
$conf['dwoo_compiled_dir'] = "${conf['gweb_root']}/lib/dwoo/compiled";
$conf['dwoo_cache_dir'] = "${conf['gweb_root']}/lib/dwoo/cache";
$conf['dwoo_compiled_dir'] = "${conf['gmetad_root']}/dwoo/compiled";
$conf['dwoo_cache_dir'] = "${conf['gmetad_root']}/dwoo/cache";

# Where to store web-based configuration
$conf['views_dir'] = $conf['gmetad_root'] . '/conf';
Expand Down Expand Up @@ -316,14 +316,16 @@ $conf['overlay_events_line_type'] = "dashed";
$conf['overlay_events_provider'] = "json";
# Where is the Overlay events file stored
$conf['overlay_events_file'] = $conf['conf_dir'] . "/events.json";
$conf['overlay_events_color_map_file'] = $conf['conf_dir'] . "/event_color.json";

# If using MDB2, connection string:
$conf['overlay_events_dsn'] = "mysql://dbuser:dbpasword@localhost/ganglia";
$conf['overlay_events_dsn'] = "mysql://dbuser:dbpassword@localhost/ganglia";

$conf['overlay_events_color_map_file'] = $conf['conf_dir'] . "/event_color.json";

# For event shading. Value in hex, 'FF' = 100% opaque.
# the _shade_ value should be less than _tick_
$conf['overlay_events_tick_alpha'] = '30';
$conf['overlay_events_shade_alpha'] = '50';
$conf['overlay_events_shade_alpha'] = '20';

# Colors to use e.g. in graph_colors
$conf['graph_colors'] = array("0000A3", "FF3300", "FFCC33", "00CC66", "B88A00", "33FFCC", "809900", "FF3366", "FF33CC", "CC33FF", "CCFF33", "FFFF66", "33CCFF");
Expand Down
9 changes: 7 additions & 2 deletions graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
sanitize($_GET["l"]) : NULL;
$summary = isset($_GET["su"]) ? 1 : 0;
$debug = isset($_GET['debug']) ? clean_number(sanitize($_GET["debug"])) : 0;
$showEvents = isset($_GET["event"]) ? sanitize ($_GET["event"]) : "show";

$command = '';
$graphite_url = '';
Expand Down Expand Up @@ -625,7 +626,8 @@
// Nagios event integration support
//////////////////////////////////////////////////////////////////////////////
$nagios_events = array();
if ( $conf['overlay_nagios_events'] &&
if ( $showEvents == "show" &&
$conf['overlay_nagios_events'] &&
! in_array($range, $conf['overlay_events_exclude_ranges']) ) {
$nagios_pull_url =
$conf['overlay_nagios_base_url'] .
Expand All @@ -652,7 +654,10 @@
//////////////////////////////////////////////////////////////////////////////
// Check whether user wants to overlay events on graphs
//////////////////////////////////////////////////////////////////////////////
if ( $conf['overlay_events'] && $conf['graph_engine'] == "rrdtool" && ! in_array($range, $conf['overlay_events_exclude_ranges']) ) {
if ( $showEvents == "show" &&
$conf['overlay_events'] &&
$conf['graph_engine'] == "rrdtool" &&
! in_array($range, $conf['overlay_events_exclude_ranges']) ) {

$color_count = sizeof($conf['graph_colors']);
$counter = 0;
Expand Down
23 changes: 21 additions & 2 deletions graph_all_periods.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,30 @@
<script type="text/javascript" src="js/jquery.gangZoom.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="js/jquery.ba-bbq.min.js"></script>
<link type="text/css" href="css/smoothness/jquery-ui-1.8.14.custom.css" rel="stylesheet" />
<div id="metric-actions-dialog" style="display: none" title="Metric Actions">
<div id="metric-actions-dialog-content">
Available Metric actions.
</div>
</div>
<script>
function showEvents(graphId, showEvents) {
var graph = $("#" + graphId);
var src = graph.attr("src");
if (src.indexOf("graph.php") != 0)
return;
var paramStr = "&event=";
paramStr += showEvents ? "hide" : "show";
var d = new Date();
paramStr += "&_=" + d.getTime();
src = jQuery.param.querystring(src, paramStr);
graph.attr("src", src);
}

$(function() {
$( "#inspect-graph-dialog" ).dialog({ autoOpen: false, minWidth: 850 });
$(":checkbox").each(function() {$(this).button();});
});
</script>
<?php
Expand Down Expand Up @@ -161,7 +176,11 @@
print ' <button title="Decompose aggregate graph" class="shiny-blue" onClick="openDecompose(\'?r=' . $key . $query_string . '&dg=1\');return false;">Decompose</button>';
}

print ' <button title="Inspect Graph" onClick="inspectGraph(\'r=' . $key . $query_string . '\'); return false;" class="shiny-blue">Inspect</button>' .
print ' <button title="Inspect Graph" onClick="inspectGraph(\'r=' . $key . $query_string . '\'); return false;" class="shiny-blue">Inspect</button>';

$graphId = 'graph_img_' . $key;

print ' <input title="Show Events" type="checkbox" id="show_events_' . $key . '" onclick="showEvents(\'' . $graphId . '\', this.checked)"/><label class="show_event_text" for="show_events_' . $key . '">Show Events</label>' .
'<br />';

// If we are using flot we need to use a div instead of an image reference
Expand All @@ -172,7 +191,7 @@

} else {

print '<a href="./graph.php?r=' . $key . '&z=' . $xlargesize . $query_string . '"><img class="noborder" style="margin-top:5px;" title="Last ' . $key . '" src="graph.php?r=' . $key . '&z=' . $largesize . $query_string . '"></a>';
print '<a href="./graph.php?r=' . $key . '&z=' . $xlargesize . $query_string . '"><img class="noborder" id="' . $graphId . '" style="margin-top:5px;" title="Last ' . $key . '" src="graph.php?r=' . $key . '&z=' . $largesize . $query_string . '"></a>';

}

Expand Down
25 changes: 8 additions & 17 deletions gweb.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Buildroot: %{_tmppath}/%{name}-%{version}-buildroot
Obsoletes: ganglia-webfrontend
Requires: php >= 5, php-gd
%if 0%{?suse_version}
%define web_prefixdir /srv/www/htdocs/ganglia
%define web_prefixdir /srv/www/htdocs/gweb
%else
%define web_prefixdir /var/www/html/ganglia
%define web_prefixdir /var/www/html/gweb
%endif
Prefix: %{web_prefixdir}
BuildArchitectures: noarch
Expand All @@ -37,29 +37,20 @@ written in the PHP5 language and uses the Dwoo templating engine.

%__mkdir -p $RPM_BUILD_ROOT/%{web_prefixdir}
%__cp -rf * $RPM_BUILD_ROOT/%{web_prefixdir}
%__rm -f $RPM_BUILD_ROOT/%{web_prefixdir}/bootstrap
%__rm -f $RPM_BUILD_ROOT/%{web_prefixdir}/Makefile*
%__rm -f $RPM_BUILD_ROOT/%{web_prefixdir}/*.in
%__rm -rf $RPM_BUILD_ROOT/%{web_prefixdir}/conf
%__install -d -m 0755 $RPM_BUILD_ROOT@varstatedir@/ganglia/filters
%__install -d -m 0755 $RPM_BUILD_ROOT@varstatedir@/ganglia/conf
%__cp -rf conf/* $RPM_BUILD_ROOT@varstatedir@/ganglia/conf
%__install -d -m 0755 $RPM_BUILD_ROOT@varstatedir@/ganglia/dwoo

%files
%defattr(-,root,root)
%attr(0755,nobody,nobody)@varstatedir@/ganglia/filters
%attr(0755,apache,apache)@varstatedir@/ganglia/dwoo
%dir %{web_prefixdir}/
#%dir %{web_prefixdir}/conf
#%dir %{web_prefixdir}/css
#%dir %{web_prefixdir}/dwoo
#%dir %{web_prefixdir}/img
#%dir %{web_prefixdir}/js
%attr(0755,@varapacheuser@,@varapacheuser@)@varstatedir@/ganglia/conf
%attr(0755,@varapacheuser@,@varapacheuser@)@varstatedir@/ganglia/dwoo
%{web_prefixdir}/*
/var/lib/ganglia/conf/*
%config(noreplace) %{web_prefixdir}/conf_default.php
#%{web_prefixdir}/conf/*
#%{web_prefixdir}/css/*
#%{web_prefixdir}/dwoo/*
#%{web_prefixdir}/img/*
#%{web_prefixdir}/js/*

%clean
%__rm -rf $RPM_BUILD_ROOT
Expand Down
18 changes: 18 additions & 0 deletions js/jquery.ba-bbq.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,18 @@ button.shiny-blue {
.ui-timepicker-div dl dt{ height: 25px; }
.ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }

label[class~="show_event_text"] span.ui-button-text {
border-top: 1px solid;
border-right: 1px solid;
border-bottom: 1px solid;
border-left: 1px solid;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
font: 8px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
padding: 1px 2px 1px 2px;
display:inline;
}

0 comments on commit 0c62726

Please sign in to comment.