diff --git a/conf.php b/conf.php new file mode 100644 index 0000000..d6f87a5 --- /dev/null +++ b/conf.php @@ -0,0 +1,11 @@ + diff --git a/ganglia-3.7.2-apache.patch b/ganglia-3.7.2-apache.patch new file mode 100644 index 0000000..2f11ee4 --- /dev/null +++ b/ganglia-3.7.2-apache.patch @@ -0,0 +1,11 @@ +--- gmond/python_modules/apache_status/apache_status.py.orig 2015-08-19 09:34:42.310000000 +1200 ++++ gmond/python_modules/apache_status/apache_status.py 2015-08-19 09:35:33.989000000 +1200 +@@ -86,6 +86,8 @@ + for sck in split_line[1]: + metrics[ Scoreboard_bykey[sck] ] += 1 + else: ++ if len(split_line) == 1: ++ continue + if long_metric_name in Metric_Map: + metric_name = Metric_Map[long_metric_name] + else: diff --git a/ganglia-3.7.2-sflow.patch b/ganglia-3.7.2-sflow.patch new file mode 100644 index 0000000..bb8132f --- /dev/null +++ b/ganglia-3.7.2-sflow.patch @@ -0,0 +1,13 @@ +--- gmond/sflow.c.orig 2016-12-02 09:56:38.744353600 +0000 ++++ gmond/sflow.c 2016-12-02 09:47:45.666353600 +0000 +@@ -303,7 +303,8 @@ + char mtitle_buf[SFLOW_MAX_METRIC_NAME_LEN]; + if(ok || sflowCFG.submit_null_str) { + set_metric_name_and_title(&mname, &mtitle, mname_buf, mtitle_buf, metric_prefix, tag); +- fmsg.id = vmsg.id = gmetric_uint; ++ //fmsg.id = vmsg.id = gmetric_uint; ++ fmsg.id = vmsg.id = gmetric_string; + fmsg.Ganglia_metadata_msg_u.gfull.metric.type = "string"; + vmsg.Ganglia_value_msg_u.gstr.metric_id.name = mname; + vmsg.Ganglia_value_msg_u.gstr.str = (ok ? (char *)val : sflowCFG.null_str); + diff --git a/ganglia-3.7.2-tirpc-hack.patch b/ganglia-3.7.2-tirpc-hack.patch new file mode 100644 index 0000000..6f6ebf1 --- /dev/null +++ b/ganglia-3.7.2-tirpc-hack.patch @@ -0,0 +1,232 @@ +diff --git a/Makefile.am b/Makefile.am +index 95d0807..a918f57 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -9,7 +9,7 @@ GMETAD_SUBDIR = + endif + + EXTRA_SUBDIRS = "gmetad-python contrib solaris" +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ + + AUTOMAKE_OPTIONS = dist-bzip2 dist-tarZ dist-zip + ACLOCAL_AMFLAGS = -I m4 +diff --git a/configure.ac b/configure.ac +index fe7983b..d98460a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -180,6 +180,10 @@ AC_ARG_WITH( libapr, + [ --with-libapr=PATH Specify location for libapr-1 or full path to apr-1-config], + [if test x"$withval" != xno; then libapr="yes"; libaprpath="$withval"; fi]) + ++AC_ARG_WITH( libtirpc, ++[ --with-libtirpc=PATH Specify location for libtirpc], ++[if test x"$withval" != xno; then libtirpc="yes"; libtirpcpath="$withval"; fi]) ++ + AC_ARG_WITH( libexpat, + [ --with-libexpat=DIR Specify location for libexpat], + [if test x"$withval" != xno; then libexpat="yes"; libexpatpath="$withval"; fi]) +@@ -426,6 +430,35 @@ else + fi + + echo ++echo Checking for tirpc ++if test x"$libtiprcpath" != x && test x"$libtirpcpath" != xyes; then ++ if test -f "$libtirpcpath" ; then ++ LIBTIRPC_INCLUDES=`$libtirpcpath --includes` ++ AC_SUBST(LIBTIRPC_INCLUDES) ++ LIBTIRPC_LIBPATH=`$libtirpcpath --link-ld` ++ LDFLAGS="$LDFLAGS -L`expr "x$LIBTIRPC_LIBPATH" : '.*-L\(.*\) '`" ++ AC_CHECK_LIB(tirpc, xdr_string,,,[`$libtirpcpath --libs`]) ++ else ++ CFLAGS="$CFLAGS -I$libtirpcpath/include/tirpc" ++ LDFLAGS="$LDFLAGS -L$libtirpcpath/${LIB_SUFFIX}" ++ echo "Added -I$libtirpcpath/include to CFLAGS" ++ echo "Added -L$libtirpcpath/${LIB_SUFFIX} to LDFLAGS" ++ AC_CHECK_LIB(tirpc, xdr_string) ++ fi ++ ++ if test x"$ac_cv_lib_tirpc_xdr_string" = xyes; then ++ echo "Found a suitable tirpc library" ++ else ++ echo "libtirpc not found" ++ exit 1; ++ fi ++else ++ PKG_CHECK_MODULES([LIBTIRPC],[libtirpc]) ++ LDFLAGS="$LDFLAGS $LIBS $LIBTIRPC_LIBS" ++ LIBTIRPC_INCLUDES="$LIBTIRPC_CFLAGS" ++fi ++ ++echo + echo Checking for libmemcached + AC_ARG_WITH( memcached, + [ --with-memcached enable memcached metrics publishing], +@@ -567,7 +600,6 @@ echo "Found a suitable zlib" + echo + + +-AC_CHECK_LIB(rpc, xdr_string) + AC_CHECK_LIB(socket, socket) + AC_CHECK_LIB(nsl, inet_addr) + AC_CHECK_LIB(nsl, gethostbyaddr_r) +@@ -606,14 +638,6 @@ AC_CHECK_HEADER([sys/mount.h], [], [], + #endif + ]) + +-AC_CHECK_HEADERS(rpc/types.h) +-AC_CHECK_HEADER([rpc/xdr.h], [], +- [AC_MSG_ERROR([your system is missing the Sun RPC (ONC/RPC) libraries])], +-[#ifdef HAVE_RPC_TYPES_H +-# include +-#endif +-]) +- + dnl ################################################################## + dnl Checks for typedefs. + dnl +diff --git a/gmetad/Makefile.am b/gmetad/Makefile.am +index 0a4e360..9eac377 100644 +--- a/gmetad/Makefile.am ++++ b/gmetad/Makefile.am +@@ -11,7 +11,7 @@ GLDADD = + GLDFLAGS = + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ + AM_CFLAGS = -I$(top_builddir)/lib -I$(top_builddir)/gmond -I$(top_builddir)/libmetrics -I$(top_builddir)/include $(GCFLAGS) @PROTOBUF_C_CFLAGS@ + + sbin_PROGRAMS = gmetad +diff --git a/gmetric/Makefile.am b/gmetric/Makefile.am +index bc7807c..4aa9542 100644 +--- a/gmetric/Makefile.am ++++ b/gmetric/Makefile.am +@@ -10,7 +10,7 @@ GLDADD = + GLDFLAGS = + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ + + AM_CFLAGS = -I../lib -I../include $(GCFLAGS) + +diff --git a/gmond/Makefile.am b/gmond/Makefile.am +index 256fee3..c9ab899 100644 +--- a/gmond/Makefile.am ++++ b/gmond/Makefile.am +@@ -44,7 +44,7 @@ if BUILD_SFLOW + GCFLAGS += -DSFLOW + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ + AM_CFLAGS = -I$(top_builddir)/lib -I$(top_builddir)/include/ -I$(top_builddir)/libmetrics $(GCFLAGS) + + sbin_PROGRAMS = gmond +diff --git a/gmond/modules/cpu/Makefile.am b/gmond/modules/cpu/Makefile.am +index fd7457e..2c2b7ab 100644 +--- a/gmond/modules/cpu/Makefile.am ++++ b/gmond/modules/cpu/Makefile.am +@@ -25,4 +25,4 @@ modload_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la + + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ +diff --git a/gmond/modules/disk/Makefile.am b/gmond/modules/disk/Makefile.am +index 0c78689..ce62aa5 100644 +--- a/gmond/modules/disk/Makefile.am ++++ b/gmond/modules/disk/Makefile.am +@@ -11,4 +11,4 @@ moddisk_la_LDFLAGS = -module -avoid-version + moddisk_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ +diff --git a/gmond/modules/example/Makefile.am b/gmond/modules/example/Makefile.am +index e3bff6a..765b85d 100644 +--- a/gmond/modules/example/Makefile.am ++++ b/gmond/modules/example/Makefile.am +@@ -11,7 +11,7 @@ modexample_la_LDFLAGS = -module -avoid-version + EXTRA_DIST = ../conf.d/example.conf + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ + + install: + @echo +diff --git a/gmond/modules/memory/Makefile.am b/gmond/modules/memory/Makefile.am +index 82336db..f606830 100644 +--- a/gmond/modules/memory/Makefile.am ++++ b/gmond/modules/memory/Makefile.am +@@ -12,4 +12,4 @@ modmem_la_LDFLAGS = -module -avoid-version + modmem_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ +diff --git a/gmond/modules/network/Makefile.am b/gmond/modules/network/Makefile.am +index 72a4faf..4f12e91 100644 +--- a/gmond/modules/network/Makefile.am ++++ b/gmond/modules/network/Makefile.am +@@ -12,4 +12,4 @@ modnet_la_LDFLAGS = -module -avoid-version + modnet_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ +diff --git a/gmond/modules/perl/Makefile.am b/gmond/modules/perl/Makefile.am +index b7b095c..c6d0cce 100644 +--- a/gmond/modules/perl/Makefile.am ++++ b/gmond/modules/perl/Makefile.am +@@ -28,4 +28,4 @@ install-exec-hook: ../conf.d/modperl.conf README + mkdir -p $(DESTDIR)$(sysconfdir)/conf.d && \ + $(INSTALL_DATA) ../conf.d/modperl.conf $(DESTDIR)$(sysconfdir)/conf.d/modperl.conf + +-INCLUDES = @APR_INCLUDES@ @PERL_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ @PERL_INCLUDES@ +diff --git a/gmond/modules/python/Makefile.am b/gmond/modules/python/Makefile.am +index f535b07..4b130a1 100644 +--- a/gmond/modules/python/Makefile.am ++++ b/gmond/modules/python/Makefile.am +@@ -27,4 +27,4 @@ install-exec-hook: ../conf.d/modpython.conf README + mkdir -p $(DESTDIR)$(sysconfdir)/conf.d && \ + $(INSTALL_DATA) ../conf.d/modpython.conf $(DESTDIR)$(sysconfdir)/conf.d/modpython.conf + +-INCLUDES = @APR_INCLUDES@ @PYTHON_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ @PYTHON_INCLUDES@ +diff --git a/gmond/modules/status/Makefile.am b/gmond/modules/status/Makefile.am +index cd84069..6ce9188 100644 +--- a/gmond/modules/status/Makefile.am ++++ b/gmond/modules/status/Makefile.am +@@ -11,4 +11,4 @@ modgstatus_la_LDFLAGS = -module -avoid-version + EXTRA_DIST = ../conf.d/modgstatus.conf + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ +diff --git a/gmond/modules/system/Makefile.am b/gmond/modules/system/Makefile.am +index 5fc7fb3..f83a380 100644 +--- a/gmond/modules/system/Makefile.am ++++ b/gmond/modules/system/Makefile.am +@@ -16,4 +16,4 @@ modsys_la_LDFLAGS = -module -avoid-version + modsys_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ +diff --git a/lib/Makefile.am b/lib/Makefile.am +index 935c514..e2ec77b 100644 +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -14,7 +14,7 @@ if BUILD_SFLOW + GCFLAGS += -DSFLOW + endif + +-INCLUDES = @APR_INCLUDES@ ++INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ + AM_CFLAGS = -I.. -I. -I$(top_builddir)/include/ $(GCFLAGS) -DSYSCONFDIR='"$(sysconfdir)"' + + include_HEADERS = gm_protocol.h diff --git a/ganglia-3.7.2.tar.gz b/ganglia-3.7.2.tar.gz new file mode 100644 index 0000000..b987e18 Binary files /dev/null and b/ganglia-3.7.2.tar.gz differ diff --git a/ganglia-httpd.conf.d b/ganglia-httpd.conf.d new file mode 100644 index 0000000..80d385e --- /dev/null +++ b/ganglia-httpd.conf.d @@ -0,0 +1,13 @@ +# +# Ganglia monitoring system php web frontend +# + +Alias /ganglia /usr/share/ganglia + + + Order deny,allow + Deny from all + Allow from 127.0.0.1 + Allow from ::1 + # Allow from .example.com + diff --git a/ganglia-httpd24.conf.d b/ganglia-httpd24.conf.d new file mode 100644 index 0000000..bc3b564 --- /dev/null +++ b/ganglia-httpd24.conf.d @@ -0,0 +1,11 @@ +# +# Ganglia monitoring system php web frontend +# + +Alias /ganglia /usr/share/ganglia + + + Require local + # Require ip 10.1.2.3 + # Require host example.org + diff --git a/ganglia-web-3.7.2-path.patch b/ganglia-web-3.7.2-path.patch new file mode 100644 index 0000000..34f3f55 --- /dev/null +++ b/ganglia-web-3.7.2-path.patch @@ -0,0 +1,39 @@ +From 7ab35273917c5e6a9fa3d528053d146e32013def Mon Sep 17 00:00:00 2001 +From: Terje Rosten +Date: Sun, 2 Feb 2020 09:58:43 +0100 +Subject: [PATCH] Fix paths + +--- + Makefile | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index 2d04cd9..7a6d5fd 100644 +--- a/Makefile ++++ b/Makefile +@@ -2,10 +2,10 @@ + # User configurables: + ########################################################## + # Location where gweb should be installed to (excluding conf, dwoo dirs). +-GDESTDIR = /usr/share/ganglia-webfrontend ++GDESTDIR = /usr/share/ganglia + + # Location where default apache configuration should be installed to. +-GCONFDIR = /etc/ganglia-web ++GCONFDIR = /etc/ganglia + + # Gweb statedir (where conf dir and Dwoo templates dir are stored) + GWEB_STATEDIR = /var/lib/ganglia-web +@@ -86,8 +86,7 @@ install: dist-dir + 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_GROUP) $(DESTDIR)/$(GWEB_STATEDIR) ++ rsync --exclude "conf" -a $(DIST_DIR)/* $(DESTDIR)/$(GDESTDIR) + + dist-gzip: dist-dir + if [ -f $(DIST_TARBALL) ]; then \ +-- +2.24.1 + diff --git a/ganglia-web-3.7.5.tar.gz b/ganglia-web-3.7.5.tar.gz new file mode 100644 index 0000000..9fde405 Binary files /dev/null and b/ganglia-web-3.7.5.tar.gz differ diff --git a/ganglia-web-5ee6b7.patch b/ganglia-web-5ee6b7.patch new file mode 100644 index 0000000..09ef455 --- /dev/null +++ b/ganglia-web-5ee6b7.patch @@ -0,0 +1,132 @@ +diff --git a/conf_default.php.in b/conf_default.php.in +index 9efa9ef..f7602cd 100644 +--- a/conf_default.php.in ++++ b/conf_default.php.in +@@ -135,6 +135,7 @@ $conf['cpu_gnice_color'] = "fff261"; + # Colors for the MEMORY report graph + # + $conf['mem_used_color'] = "5555cc"; ++$conf['mem_available_color'] = "2030F4"; + $conf['mem_shared_color'] = "0000aa"; + $conf['mem_cached_color'] = "33cc33"; + $conf['mem_slab_color'] = "66e533"; +diff --git a/functions.php b/functions.php +index be9fa4a..afbb586 100644 +--- a/functions.php ++++ b/functions.php +@@ -1121,8 +1121,8 @@ function build_aggregate_graph_config ($graph_type, + $line_width, + $hreg, + $mreg, +- $glegend, +- $exclude_host_from_legend_label, ++ $glegend = NULL, ++ $exclude_host_from_legend_label = false, + $sortit = true) { + + global $conf, $index_array, $hosts, $grid, $clusters, $debug, $metrics; +diff --git a/graph.d/mem_report.php b/graph.d/mem_report.php +index d443965..58d167d 100644 +--- a/graph.d/mem_report.php ++++ b/graph.d/mem_report.php +@@ -48,6 +48,8 @@ function graph_mem_report ( &$rrdtool_graph ) { + $bmem_slab_defs = ''; + $bmem_buffers_defs = ''; + $bmem_used_cdef = "CDEF:'bmem_used'='bmem_total','bmem_free',-,'bmem_cached',-"; ++ $bmem_available_defs = ''; ++ $bmem_realused_cdef = ''; + + if (file_exists("$rrd_dir/mem_shared.rrd")) { + $bmem_used_cdef .= ",'bmem_shared',UN,0,'bmem_shared',IF,-"; +@@ -67,6 +69,12 @@ function graph_mem_report ( &$rrdtool_graph ) { + ."CDEF:'bmem_buffers'=mem_buffers,1024,* "; + } + ++ if (file_exists("$rrd_dir/mem_available.rrd")) { ++ $bmem_realused_cdef = "CDEF:'bmem_realused'='bmem_total','bmem_available',- "; ++ $bmem_available_defs = "DEF:'mem_available'='${rrd_dir}/mem_available.rrd':'sum':AVERAGE " ++ ."CDEF:'bmem_available'=mem_available,1024,* "; ++ } ++ + $series = "DEF:'mem_total'='${rrd_dir}/mem_total.rrd':'sum':AVERAGE " + ."CDEF:'bmem_total'=mem_total,1024,* " + .$bmem_shared_defs +@@ -76,6 +84,8 @@ function graph_mem_report ( &$rrdtool_graph ) { + ."CDEF:'bmem_cached'=mem_cached,1024,* " + .$bmem_slab_defs + .$bmem_buffers_defs ++ .$bmem_available_defs ++ .$bmem_realused_cdef + ."$bmem_used_cdef " + ."AREA:'bmem_used'#${conf['mem_used_color']}:'Use${rmspace}' "; + +@@ -188,6 +198,22 @@ function graph_mem_report ( &$rrdtool_graph ) { + } + } + ++ if (file_exists("$rrd_dir/mem_available.rrd")) { ++ $series .= "LINE2:'bmem_realused'#${conf['mem_available_color']}:'Avail${rmspace}' "; ++ ++ if ( $conf['graphreport_stats'] ) { ++ $series .= "CDEF:available_pos=bmem_available,0,INF,LIMIT " ++ . "VDEF:available_last=available_pos,LAST " ++ . "VDEF:available_min=available_pos,MINIMUM " ++ . "VDEF:available_avg=available_pos,AVERAGE " ++ . "VDEF:available_max=available_pos,MAXIMUM " ++ . "GPRINT:'available_last':' ${space1}Now\:%6.1lf%s' " ++ . "GPRINT:'available_min':'${space1}Min\:%6.1lf%s${eol1}' " ++ . "GPRINT:'available_avg':'${space2}Avg\:%6.1lf%s' " ++ . "GPRINT:'available_max':'${space1}Max\:%6.1lf%s\\l' "; ++ } ++ } ++ + $series .= "LINE2:'bmem_total'#${conf['cpu_num_color']}:'Total${rmspace}' "; + + if ( $conf['graphreport_stats'] ) { +diff --git a/header.php b/header.php +index 91af0a2..729fe27 100644 +--- a/header.php ++++ b/header.php +@@ -263,7 +263,7 @@ if ($initgrid or $gridwalk) + # Use cookie so we dont have to pass gridstack around within this site. + # Cookie values are automatically urlencoded. Expires in a day. + if ( !isset($_COOKIE["gs"]) or $_COOKIE["gs"] != $gridstack_str ) +- setcookie("gs", $gridstack_str, time() + 86400); ++ setcookie("gs", $gridstack_str, time() + 86400, NULL, NULL, true, true); + } + + # Invariant: back pointer is second-to-last element of gridstack. Grid stack +diff --git a/lib/GangliaAuth.php b/lib/GangliaAuth.php +index 4a4d1da..01ca10d 100644 +--- a/lib/GangliaAuth.php ++++ b/lib/GangliaAuth.php +@@ -82,14 +82,14 @@ class GangliaAuth { + + // this is how a user 'logs in'. + public function setAuthCookie($user, $group=null) { +- setcookie('ganglia_auth', json_encode( array('user'=>$user, 'group'=>$group, 'token'=>$this->getAuthToken($user)) ) ); ++ setcookie('ganglia_auth', json_encode( array('user'=>$user, 'group'=>$group, 'token'=>$this->getAuthToken($user)) ), NULL, NULL, NULL, true, true ); + $this->user = $user; + $this->group = $group; + $this->tokenIsValid = true; + } + + public function destroyAuthCookie() { +- setcookie('ganglia_auth', '', time()); ++ setcookie('ganglia_auth', '', time(), NULL, NULL, true, true); + self::$auth = null; + } + +diff --git a/templates/default/cluster_host_metric_graphs.tpl b/templates/default/cluster_host_metric_graphs.tpl +index dbd80ab..95bc8aa 100644 +--- a/templates/default/cluster_host_metric_graphs.tpl ++++ b/templates/default/cluster_host_metric_graphs.tpl +@@ -42,7 +42,7 @@ + {/foreach} + {/if} + {/if} +- {if $index % $hostcols == 0} ++ {if $index % max(1, $hostcols) == 0} + + {/if} + {math "$index + 1" assign="index"} diff --git a/ganglia.spec b/ganglia.spec new file mode 100644 index 0000000..cf342de --- /dev/null +++ b/ganglia.spec @@ -0,0 +1,320 @@ +%global gangver 3.7.2 +%global webver 3.7.5 +%global systemd 1 +%global _hardened_build 1 +%global py2 0 +Summary: Distributed Monitoring System +Name: ganglia +Version: %{gangver} +Release: 1 +License: BSD +URL: http://ganglia.sourceforge.net/ +Source0: http://downloads.sourceforge.net/sourceforge/ganglia/ganglia-%{version}.tar.gz +Source1: https://github.com/ganglia/ganglia-web/archive/%{webver}/ganglia-web-%{webver}.tar.gz +Source2: gmond.service +Source3: gmetad.service +Source4: ganglia-httpd24.conf.d +Source5: ganglia-httpd.conf.d +Source6: conf.php +Patch0: ganglia-web-3.7.2-path.patch +Patch1: ganglia-3.7.2-apache.patch +Patch2: ganglia-3.7.2-sflow.patch +Patch3: ganglia-3.7.2-tirpc-hack.patch +Patch4: ganglia-web-5ee6b7.patch +%if 0%{?systemd} +BuildRequires: systemd +%endif +BuildRequires: rpcgen libtirpc-devel autoconf automake libtool +BuildRequires: apr-devel >= 1 expat-devel freetype-devel gcc libart_lgpl-devel +BuildRequires: libconfuse-devel libmemcached-devel libpng-devel pcre-devel +%if 0%{?py2} +BuildRequires: python2-devel} +%endif +BuildRequires: rrdtool-devel rsync /usr/bin/pod2man /usr/bin/pod2html make +BuildRequires: php php-gd +%description +Ganglia is a scalable, real-time monitoring and execution environment +with all execution requests and statistics expressed in an open +well-defined XML format. + +%package web +Summary: Ganglia Web Frontend +Version: %{webver} +Requires: rrdtool php php-gd %{name}-gmetad = %{gangver}-%{release} +%description web +This package provides a web frontend to display the XML tree published +by ganglia, and to provide historical graphs of collected +metrics. This website is written in the PHP. + +%package gmetad +Summary: Ganglia Metadata collection daemon +Requires: %{name} = %{gangver}-%{release} +%if 0%{?systemd} +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%else +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(preun): /sbin/service +%endif +%description gmetad +Ganglia is a scalable, real-time monitoring and execution environment +with all execution requests and statistics expressed in an open +well-defined XML format. +This gmetad daemon aggregates monitoring data from several clusters to +form a monitoring grid. It also keeps metric history using rrdtool. + +%package gmond +Summary: Ganglia Monitoring daemon +Requires: %{name} = %{gangver}-%{release} +%if 0%{?systemd} +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%else +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(preun): /sbin/service +%endif + +%description gmond +Ganglia is a scalable, real-time monitoring and execution environment +with all execution requests and statistics expressed in an open +well-defined XML format. +This gmond daemon provides the ganglia service within a single cluster +or Multicast domain. + +%if 0%{?py2} +%package -n python2-ganglia-gmond +Summary: Ganglia Monitor daemon python DSO and metric modules +Requires: ganglia-gmond python2 +%{?python_provide:%python_provide python2-ganglia-gmond} +Provides: ganglia-gmond-python = %{version}-%{release} +%description -n python2-ganglia-gmond +Ganglia is a scalable, real-time monitoring and execution environment +with all execution requests and statistics expressed in an open +well-defined XML format. +This package provides the gmond python DSO and python gmond modules, +which can be loaded via the DSO at gmond daemon start time. +%endif + +%package devel +Summary: Ganglia Library +Requires: %{name} = %{gangver}-%{release} apr-devel libconfuse-devel +%description devel +The Ganglia Monitoring Core library provides a set of functions that +programmers can use to build scalable cluster or grid applications + +%prep +%setup -q +install -m 0644 %{SOURCE2} gmond/gmond.service.in +install -m 0644 %{SOURCE3} gmetad/gmetad.service.in +%patch1 -p0 +%patch2 -p0 +%patch3 -p1 +%setup -q -T -D -a 1 +mv ganglia-web-%{webver} web +pushd web +%patch0 -p1 +%patch4 -p1 +popd + +%build +touch Makefile.am +aclocal -I m4 +autoheader +automake --add-missing --copy --foreign 2>/dev/null +libtoolize --automake --copy +automake --add-missing --copy --foreign +autoconf -f || exit 1 +export CFLAGS="%{optflags} -fcommon" +%configure \ + --enable-setuid=ganglia \ + --enable-setgid=ganglia \ + --with-gmetad \ + --with-memcached \ + --disable-static \ + --enable-shared \ +%if 0%{?py2} + --with-python=%{__python2} \ +%else + --disable-python \ +%endif + --sysconfdir=%{_sysconfdir}/ganglia +%{__sed} -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +%{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +%{__perl} -pi.orig -e 's|nobody|ganglia|g' \ + gmond/gmond.conf.html ganglia.html gmond/conf.pod +%{__perl} -pi.orig -e 's|.*setuid_username.*|setuid_username ganglia|' \ + gmetad/gmetad.conf.in +%{__perl} -pi.orig -e 's|2345|-|g' gmond/gmond.init gmetad/gmetad.init +make %{?_smp_mflags} + +%install +make install DESTDIR=%{buildroot} +%if 0%{?py2} +mkdir -p %{buildroot}%{_libdir}/ganglia/python_modules} +%endif +mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/rrds +%if 0%{?systemd} +install -Dp -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/gmond.service +install -Dp -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/gmetad.service +%else +install -Dp -m 0755 gmond/gmond.init %{buildroot}%{_sysconfdir}/init.d/gmond +install -Dp -m 0755 gmetad/gmetad.init %{buildroot}%{_sysconfdir}/init.d/gmetad +%endif +LD_LIBRARY_PATH=lib/.libs gmond/gmond -t | %{__perl} -pe 's|nobody|ganglia|g' \ + > %{buildroot}%{_sysconfdir}/ganglia/gmond.conf +%if 0%{?py2} +cp -p gmond/python_modules/conf.d/*.pyconf %{buildroot}%{_sysconfdir}/ganglia/conf.d/ +cp -p gmond/modules/conf.d/*.conf %{buildroot}%{_sysconfdir}/ganglia/conf.d/ +cp -p gmond/python_modules/*/*.py %{buildroot}%{_libdir}/ganglia/python_modules/ +%endif +pushd web +make install DESTDIR=%{buildroot} +install -p -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/ganglia/conf.php +ln -s ../../..%{_sysconfdir}/%{name}/conf.php \ + %{buildroot}%{_datadir}/%{name}/conf.php +popd +install -Dp -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf +rm -f %{buildroot}%{_sysconfdir}/ganglia/conf.d/{modgstatus,example}.conf +rm -rf %{buildroot}%{_datadir}/%{name}/{Makefile*,debian,ganglia-web.spec*,ganglia-web} +rm -rf %{buildroot}%{_datadir}/%{name}/{conf_default.php.in,version.php.in} +rm -rf %{buildroot}%{_localstatedir}/lib/%{name}-web/conf/sql +rm -rf %{buildroot}%{_datadir}/%{name}/{README,TODO,AUTHORS,COPYING} +rm -f %{buildroot}%{_libdir}/*.la +chmod 0644 %{buildroot}%{_datadir}/%{name}/header.php +%if 0%{?py2} +chmod 0644 %{buildroot}%{_libdir}/%{name}/python_modules/*.py} +%endif +chmod 0644 %{buildroot}%{_datadir}/%{name}/css/smoothness/jquery-ui-1.10.2.custom.css +chmod 0644 %{buildroot}%{_datadir}/%{name}/css/smoothness/jquery-ui-1.10.2.custom.min.css +%if 0%{?py2} +sed -i '1{\@^#!@d}' %{buildroot}%{_libdir}/%{name}/python_modules/*.py} +%endif + +%pre +/usr/sbin/useradd -c "Ganglia Monitoring System" \ + -s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} ganglia 2> /dev/null || : +%if 0%{?systemd} + +%post gmond +%systemd_post gmond.service + +%preun gmond +%systemd_preun gmond.service + +%postun gmond +%systemd_postun_with_restart gmond.service + +%post gmetad +%systemd_post gmetad.service + +%preun gmetad +%systemd_preun gmetad.service + +%postun gmetad +%systemd_postun_with_restart gmetad.service +%else + +%post gmond +/sbin/chkconfig --add gmond + +%post gmetad +/sbin/chkconfig --add gmetad + +%preun gmetad +if [ "$1" = 0 ]; then + /sbin/service gmetad stop >/dev/null 2>&1 || : + /sbin/chkconfig --del gmetad +fi + +%preun gmond +if [ "$1" = 0 ]; then + /sbin/service gmond stop >/dev/null 2>&1 || : + /sbin/chkconfig --del gmond +fi +%endif + +%pretrans web -p +path = "/usr/share/ganglia/lib/Zend" +st = posix.stat(path) +if st and st.type == "link" then + os.remove(path) +end + +%files +%license COPYING +%doc AUTHORS NEWS README ChangeLog +%{_libdir}/libganglia*.so.* +%dir %{_libdir}/ganglia +%{_libdir}/ganglia/*.so +%{?py2:%exclude %{_libdir}/ganglia/modpython.so} + +%files gmetad +%dir %{_localstatedir}/lib/%{name} +%attr(0755,ganglia,ganglia) %{_localstatedir}/lib/%{name}/rrds +%{_sbindir}/gmetad +%if 0%{?systemd} +%{_unitdir}/gmetad.service +%else +%{_sysconfdir}/init.d/gmetad +%endif +%{_mandir}/man1/gmetad.1* +%{_mandir}/man1/gmetad.py.1* +%dir %{_sysconfdir}/ganglia +%config(noreplace) %{_sysconfdir}/ganglia/gmetad.conf + +%files gmond +%{_bindir}/gmetric +%{_bindir}/gstat +%{_sbindir}/gmond +%if 0%{?systemd} +%{_unitdir}/gmond.service +%else +%{_sysconfdir}/init.d/gmond +%endif +%{_mandir}/man5/gmond.conf.5* +%{_mandir}/man1/gmond.1* +%{_mandir}/man1/gstat.1* +%{_mandir}/man1/gmetric.1* +%dir %{_sysconfdir}/ganglia +%if 0%{?py2} +%dir %{_sysconfdir}/ganglia/conf.d} +%endif +%config(noreplace) %{_sysconfdir}/ganglia/gmond.conf +%if 0%{?py2} +%config(noreplace) %{_sysconfdir}/ganglia/conf.d/*.conf} +%exclude %{_sysconfdir}/ganglia/conf.d/modpython.conf} +%endif + +%if 0%{?py2} +%files -n python2-ganglia-gmond +%dir %{_libdir}/ganglia/python_modules/ +%{_libdir}/ganglia/python_modules/*.py* +%{_libdir}/ganglia/modpython.so* +%config(noreplace) %{_sysconfdir}/ganglia/conf.d/*.pyconf* +%config(noreplace) %{_sysconfdir}/ganglia/conf.d/modpython.conf +%endif + +%files devel +%{_bindir}/ganglia-config +%{_includedir}/*.h +%{_libdir}/libganglia*.so + +%files web +%license web/COPYING +%doc web/AUTHORS web/README web/TODO +%config(noreplace) %{_sysconfdir}/%{name}/conf.php +%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf +%{_datadir}/%{name} +%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/conf +%config(noreplace) %attr(0644,apache,apache) %{_localstatedir}/lib/%{name}-web/conf/*.json +%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/dwoo +%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/dwoo/cache +%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/dwoo/compiled + +%changelog +* Wed Apr 14 2021 chengzihan - 3.7.2-1 +- package init diff --git a/gmetad.service b/gmetad.service new file mode 100644 index 0000000..a9184a0 --- /dev/null +++ b/gmetad.service @@ -0,0 +1,10 @@ +[Unit] +Description=Ganglia Meta Daemon +After=network.target + +[Service] +ExecStart=/usr/sbin/gmetad -d 1 + +[Install] +WantedBy=multi-user.target + diff --git a/gmond.service b/gmond.service new file mode 100644 index 0000000..e88411a --- /dev/null +++ b/gmond.service @@ -0,0 +1,15 @@ +[Unit] +Description=Ganglia Meta Daemon +After=multi-user.target +After=network.target + +[Service] +Type=forking +ExecStart=/usr/sbin/gmond + +[Install] +WantedBy=multi-user.target + + + +