Permalink
Browse files

*** empty log message ***

  • Loading branch information...
1 parent 5bf83e0 commit b1156add7ea7cc3a20e92a4c34e71bd1b7c3caa2 massie committed Dec 10, 2004
Showing with 122 additions and 32 deletions.
  1. +17 −4 monitor-core/configure.in
  2. +92 −22 monitor-core/ganglia.spec.in
  3. +13 −6 monitor-core/lib/apr_net.c
View
@@ -68,7 +68,7 @@ else
GANGLIA_VERSION=$GANGLIA_MAJOR_VERSION.$GANGLIA_MINOR_VERSION.$GANGLIA_MICRO_VERSION.$GANGLIA_SNAPSHOT_DATE
fi
-AM_INIT_AUTOMAKE(ganglia-monitor-core, $GANGLIA_VERSION)
+AM_INIT_AUTOMAKE(ganglia, $GANGLIA_VERSION)
AC_SUBST(GANGLIA_MAJOR_VERSION)
AC_SUBST(GANGLIA_MINOR_VERSION)
@@ -99,8 +99,6 @@ AC_SUBST(LT_AGE)
AC_DEFINE_UNQUOTED(GANGLIA_MAJOR_VERSION, $GANGLIA_MAJOR_VERSION, GANGLIA_MAJOR_VERSION)
AC_DEFINE_UNQUOTED(GANGLIA_MINOR_VERSION, $GANGLIA_MINOR_VERSION, GANGLIA_MINOR_VERSION)
AC_DEFINE_UNQUOTED(GANGLIA_MICRO_VERSION, $GANGLIA_MICRO_VERSION, GANGLIA_MICRO_VERSION)
-#AC_DEFINE_UNQUOTED(GANGLIA_INTERFACE_AGE, $GANGLIA_INTERFACE_AGE, GANGLIA_INTERFACE_AGE)
-#AC_DEFINE_UNQUOTED(GANGLIA_BINARY_AGE, $GANGLIA_BINARY_AGE, GANGLIA_BINARY_AGE)
########################
@@ -314,6 +312,10 @@ dnl Some system-specific stuff ...
dnl Some operating systems require additional flags in order to get all
dnl the definitions that we're looking for in some system headers.
+dnl default VARSTATEDIR to /var/lib since that's the traditional location.
+dnl
+varstatedir="/var/lib"
+
case "$host" in
*linux*)
CFLAGS="$CFLAGS -D_REENTRANT"
@@ -362,12 +364,23 @@ dnl
AC_DEFINE(SOLARIS,1,SOLARIS);;
*freebsd*) CFLAGS="-pthread $CFLAGS -D_REENTRANT"
AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_GEXEC)
+ varstatedir="/var/db"
+ osreldate=`awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $3 }' /usr/include/osreldate.h`
+ if test $osreldate -lt 502102; then
+ CFLAGS="-pthread $CFLAGS -D_REENTRANT"
+ fi
AC_DEFINE(FREEBSD, 1, FREEBSD);;
*cygwin*) LDFLAGS="-liphlpapi"
AC_DEFINE(CYGWIN,1,CYGWIN)
esac
-AC_OUTPUT(Makefile srclib/Makefile tests/Makefile ganglia.spec gmetad/Makefile lib/Makefile gmond/Makefile gmond/gstat/Makefile gmetric/Makefile web/conf.php)
+dnl Define VARSTATEDIR in config.h
+dnl
+AC_SUBST(varstatedir)
+AC_DEFINE_UNQUOTED(VARSTATEDIR, "$varstatedir", VARSTATEDIR)
+
+
+AC_OUTPUT(Makefile srclib/Makefile tests/Makefile ganglia.spec gmetad/Makefile lib/Makefile gmond/Makefile gmond/gstat/Makefile gmetric/Makefile web/version.php)
echo ""
@@ -3,11 +3,19 @@
#
# @configure_input@
#
-Summary: Ganglia Cluster Toolkit http://ganglia.sourceforge.net/
+# IMPORTANT NOTE:
+# This spec file has a noarch section. RPM is braindead in that it cannot
+# build mixed architecture packages. As a workaround, you must build
+# the RPMs using the following commandline
+#
+# % rpmbuild -ta --target noarch,i386 ganglia-@VERSION@.tar.gz
+#
+Summary: Ganglia Distributed Monitoring System
Name: @PACKAGE@
Version: @VERSION@
+URL: http://ganglia.info/
Release: 1
-Copyright: BSD
+License: BSD
Vendor: Ganglia Development Team <ganglia-developers@lists.sourceforge.net>
Group: System Environment/Base
Source: %{name}-%{version}.tar.gz
@@ -16,28 +24,48 @@ Prefix: /usr
%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.
+######################################################################
+################## noarch section ####################################
+######################################################################
+%ifarch noarch
+%package web
+Summary: Ganglia Web Frontend
+Group: System Environment/Base
+Obsoletes: ganglia-webfrontend
+Provides: ganglia-webfrontend
+# We should put rrdtool as a Requires too but rrdtool rpm support is very weak
+# so most people install from source
+#Requires: ganglia-gmetad >= @VERSION@
+%define web_prefixdir /var/www/html/ganglia
+Prefix: %{web_prefixdir}
+
+%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 PHP4 language.
+
+#######################################################################
+#######################################################################
+%else
%package gmetad
Summary: Ganglia Meta daemon http://ganglia.sourceforge.net/
Group: System Environment/Base
-Obsoletes: ganglia-monitor-core
+Obsoletes: ganglia-monitor-core-gmetad ganglia-monitor-core
%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 can aggregate monitoring data from several clusters
-to form a monitoring grid. It also keeps metric history using the RRD tool.
-
+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 Monitor daemon http://ganglia.sourceforge.net/
Group: System Environment/Base
-Obsoletes: ganglia-monitor-core
+Obsoletes: ganglia-monitor-core-gmond ganglia-monitor-core
%description gmond
Ganglia is a scalable, real-time monitoring and execution environment
@@ -47,15 +75,17 @@ well-defined XML format.
This gmond daemon provides the ganglia service within a single cluster or
Multicast domain.
-
-%package lib
-Summary: Ganglia Toolkit Library http://ganglia.sourceforge.net/
+%package devel
+Summary: Ganglia Library http://ganglia.sourceforge.net/
Group: System Environment/Base
+Obsoletes: ganglia-monitor-core-lib
-%description lib
+%description devel
The Ganglia Monitoring Core library provides a set of functions that programmers
can use to build scalable cluster or grid applications
+%endif
+
##
## PREP
##
@@ -67,25 +97,26 @@ can use to build scalable cluster or grid applications
## BUILD
##
%build
-./configure --with-gmetad --prefix=/usr
+./configure --prefix=/usr --with-gmetad
make
##
## PRE
##
%pre
+%ifnarch noarch
##
## POST GMETA
##
%post gmetad
/sbin/chkconfig --add gmetad
if [ "$1" == "1" ]; then
- # Installing new package - start gmond
+ # Installing new package - start gmetad
/etc/rc.d/init.d/gmetad start
elif [ "$1" > "1" ]; then
- # Upgrading ganglia package - restart gmond
+ # Upgrading ganglia package - restart gmetad
/etc/rc.d/init.d/gmetad restart
fi
@@ -104,7 +135,6 @@ elif [ "$1" > "1" ]; then
/etc/rc.d/init.d/gmond restart
fi
-
##
## PREUN GMETA
##
@@ -125,24 +155,44 @@ then
/sbin/chkconfig --del gmond
fi
+#ifnarch noarch
+%endif
+
##
## INSTALL
##
%install
+## Flush any old RPM build root
+%__rm -rf $RPM_BUILD_ROOT
+
+%ifarch noarch
+
+%__mkdir -p $RPM_BUILD_ROOT/%{web_prefixdir}
+%__cp -rf %{_builddir}/%{name}-%{version}/web/* $RPM_BUILD_ROOT/%{web_prefixdir}
+
+%else
+
+## Create the directory structure
%__mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
-%__mkdir -p $RPM_BUILD_ROOT/var/lib/ganglia/rrds
+%__mkdir -p $RPM_BUILD_ROOT@varstatedir@/ganglia/rrds
+
+## Move the files into the structure
%__cp -f %{_builddir}/%{name}-%{version}/gmond/gmond.init $RPM_BUILD_ROOT/etc/rc.d/init.d/gmond
%__cp -f %{_builddir}/%{name}-%{version}/gmetad/gmetad.init $RPM_BUILD_ROOT/etc/rc.d/init.d/gmetad
%__cp -f %{_builddir}/%{name}-%{version}/gmond/gmond.conf $RPM_BUILD_ROOT/etc/gmond.conf
%__cp -f %{_builddir}/%{name}-%{version}/gmetad/gmetad.conf $RPM_BUILD_ROOT/etc/gmetad.conf
%__make install prefix=$RPM_BUILD_ROOT/usr
+%endif
+
+%ifnarch noarch
##
## FILES GMETA
##
+
%files gmetad
%defattr(-,root,root)
-%attr(0755,nobody,nobody)/var/lib/ganglia/rrds
+%attr(0755,nobody,nobody)@varstatedir@/ganglia/rrds
/usr/sbin/gmetad
/etc/rc.d/init.d/gmetad
%config(noreplace) /etc/gmetad.conf
@@ -158,10 +208,25 @@ fi
/etc/rc.d/init.d/gmond
%config(noreplace) /etc/gmond.conf
-%files lib
+##
+## FILES DEVEL
+##
+%files devel
/usr/include/ganglia.h
/usr/lib/libganglia*
+%else
+
+##
+## FILES WEB
+##
+%files web
+%defattr(-,root,root)
+%config(noreplace) %{web_prefixdir}/conf.php
+%{web_prefixdir}
+
+%endif
+
##
## CLEAN
##
@@ -172,8 +237,13 @@ fi
## CHANGELOG
##
%changelog
-* Thu Nov 18 2004 Matt Massie <massie@cs.berkeley.edu>
-- Updated the lib section for ganglia v2.5.8
+* Fri Dec 10 2004 Matt Massie <massie@cs.berkeley.edu>
+- Updated the spec file for 2.6.0 release
+* Tue Apr 13 2004 Brooks Davis <brooks@one-eyed-alien.net>
+- Use the autoconf variable varstatedir instead of /var/lib for consistancy.
+* Thu Feb 19 2004 Matt Massie <massie@cs.berkeley.edu>
+- Removed the /usr/include/ganglia directory from the lib rpm and
+ changed the deprecated Copyright to License
* Mon Oct 14 2002 Federico Sacerdoti <fds@sdsc.edu>
- Split package into -gmetad and -gmond subpackages for clarity,
and separation of purpose/functionality.
View
@@ -19,11 +19,11 @@
APR_DECLARE(apr_status_t) apr_sockaddr_ip_buffer_get(char *addr, int len,
apr_sockaddr_t *sockaddr)
{
- if(len< sockaddr->addr_str_len)
+ if(!sockaddr || !addr || len < sockaddr->addr_str_len)
{
return APR_EINVAL;
}
- /*
+ /* this function doesn't malloc memory from the sockaddr pool...
*addr = apr_palloc(sockaddr->pool, sockaddr->addr_str_len);
*/
apr_inet_ntop(sockaddr->family,
@@ -37,7 +37,8 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_buffer_get(char *addr, int len,
* part of the address string so we're left with the familiar
* IPv4 format.
*/
- /* strlen("::ffff:") == 7 */
+
+ /* use memmove since the memory areas overlap */
memmove( addr, addr+7, strlen(addr+7));
/*
*addr += strlen("::ffff:");
@@ -80,8 +81,8 @@ create_udp_client(apr_pool_t *context, char *ipaddr, apr_port_t port)
return sock;
}
-apr_socket_t *
-create_udp_server(apr_pool_t *context, apr_port_t port, char *bind)
+static apr_socket_t *
+create_net_server(apr_pool_t *context, int type, apr_port_t port, char *bind)
{
apr_sockaddr_t *localsa = NULL;
apr_socket_t *sock = NULL;
@@ -97,7 +98,7 @@ create_udp_server(apr_pool_t *context, apr_port_t port, char *bind)
family = localsa->sa.sin.sin_family;
}
- stat = apr_socket_create(&sock, family, SOCK_DGRAM, context);
+ stat = apr_socket_create(&sock, family, type, context);
if( stat != APR_SUCCESS )
return NULL;
@@ -135,6 +136,12 @@ create_udp_server(apr_pool_t *context, apr_port_t port, char *bind)
return sock;
}
+apr_socket_t *
+create_udp_server(apr_pool_t *context, apr_port_t port, char *bind)
+{
+ return create_net_server(context, SOCK_DGRAM, port, bind);
+}
+
#if 0
apr_socket_t *
create_mcast_server_socket( apr_pool_t *context, char *mcastaddr, apr_port_t port, char *interface_name, apr_sockaddr_t **sa)

0 comments on commit b1156ad

Please sign in to comment.