Index: head/sysutils/ganglia-monitor-core/Makefile =================================================================== --- head/sysutils/ganglia-monitor-core/Makefile (revision 134271) +++ head/sysutils/ganglia-monitor-core/Makefile (revision 134272) @@ -1,130 +1,131 @@ # Ports collection makefile for: ganglia-monitor-core # Date created: Wed Jan 23, 2003 # Whom: Brooks Davis # # $FreeBSD$ # PORTNAME= monitor-core PORTVERSION= 3.0.1 -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= sysutils net parallel .if !defined(PORTDEV) MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} .else MASTER_SITES= http://matt-massie.com/%SUBDIR%/ .endif MASTER_SITE_SUBDIR= ganglia PKGNAMEPREFIX= ganglia- .if defined(CLUSTER) PKGNAMESUFFIX= -${CLUSTER} .endif DISTNAME= ganglia-${PORTVERSION} MAINTAINER= brooks@FreeBSD.org COMMENT= Ganglia cluster monitor, monitoring daemon PKGINSTALL= ${WRKSRC}/pkg-install OPTIONS+= GMETAD "include gmetad" on \ LIBGANGLIA "include libganglia" off GNU_CONFIGURE= yes CONFIGURE_ENV= CFLAGS="${_CFLAGS}" LDFLAGS="${_LDFLAGS}" _CFLAGS= ${CFLAGS} -I${LOCALBASE}/include ${PTHREAD_CFLAGS} _LDFLAGS= ${LDFLAGS} -L${LOCALBASE}/lib USE_REINPLACE= yes USE_BZIP2= yes USE_RC_SUBR= ganglia.sh SUB_FILES= pkg-install .if defined (GMETAD_CONF) .if !exists (${GMETAD_CONF}) IGNORE= "GMETAD_CONF must point to an existing file when defined" .endif .else GMETAD_CONF= ${WRKSRC}/gmetad/gmetad.conf .endif .if defined (GMOND_CONF) .if !exists (${GMOND_CONF}) IGNORE= "GMOND_CONF must point to an existing file when defined" .endif .else GMOND_CONF= ${WRKDIR}/gmond.conf .endif .include .if defined (WITH_GMETAD) LIB_DEPENDS= rrd.0:${PORTSDIR}/net/rrdtool CONFIGURE_ARGS+= --with-gmetad PLIST_SUB+= GMETAD= SUB_LIST+= GMETAD= .else PLIST_SUB+= GMETAD="@comment " SUB_LIST+= GMETAD="\#" .endif .if defined (WITH_LIBGANGLIA) INSTALLS_SHLIB= yes PLIST_SUB+= LIBGANGLIA= .else PLIST_SUB+= LIBGANGLIA="@comment " .endif MAN1= gmetric.1 gmond.1 gstat.1 .if defined (WITH_GMETAD) MAN1+= gmetad.1 .endif MAN5= gmond.conf.5 CONF_DIR= ${PREFIX}/etc FIX_CONF_FILES= ganglia.pod \ mans/gmetad.1 \ mans/gmond.1 \ gmetad/cmdline.c \ gmetad/cmdline.h \ gmond/g25_config.h \ gmetric/cmdline.c \ gmetric/cmdline.h \ gmond/cmdline.c \ gmond/cmdline.h FIX_DB_FILES= ganglia.pod \ gmetad/conf.c \ gmetad/gmetad.conf post-patch: ${REINPLACE_CMD} -e "s|/etc/\(gm[a-z]*d.conf\)|${PREFIX}/etc/\1|g" \ ${FIX_CONF_FILES:S|^|${WRKSRC}/|} ${REINPLACE_CMD} -e "s|/var/lib/ganglia|/var/db/ganglia|g" \ ${FIX_DB_FILES:S|^|${WRKSRC}/|} post-build: ${WRKSRC}/gmond/gmond -t > ${WRKDIR}/gmond.conf do-install: .if defined (WITH_GMETAD) cd ${WRKSRC}/gmetad && make install + ${INSTALL_SCRIPT} ${FILESDIR}/gmetasnap.sh ${PREFIX}/sbin/gmetasnap ${INSTALL_MAN} ${WRKSRC}/mans/gmetad.1 ${MANPREFIX}/man/man1 ${INSTALL_DATA} ${GMETAD_CONF} ${PREFIX}/etc/gmetad.conf.sample .endif cd ${WRKSRC}/gmetric && make install ${INSTALL_MAN} ${WRKSRC}/mans/gmetric.1 ${MANPREFIX}/man/man1 cd ${WRKSRC}/gmond && make install ${INSTALL_MAN} ${WRKSRC}/mans/gmond.1 ${MANPREFIX}/man/man1 ${INSTALL_MAN} ${WRKSRC}/gmond/gmond.conf.5 ${MANPREFIX}/man/man5 ${INSTALL_MAN} ${WRKSRC}/mans/gstat.1 ${MANPREFIX}/man/man1 ${INSTALL_DATA} ${GMOND_CONF} ${PREFIX}/etc/gmond.conf.sample .if defined (WITH_LIBGANGLIA) cd ${WRKSRC}/lib && make install ${INSTALL_SCRIPT} ${WRKSRC}/ganglia-config ${PREFIX}/bin .endif post-install: ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL .include Property changes on: head/sysutils/ganglia-monitor-core/Makefile ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.13 \ No newline at end of property +1.14 \ No newline at end of property Index: head/sysutils/ganglia-monitor-core/files/ganglia.sh.in =================================================================== --- head/sysutils/ganglia-monitor-core/files/ganglia.sh.in (revision 134271) +++ head/sysutils/ganglia-monitor-core/files/ganglia.sh.in (revision 134272) @@ -1,40 +1,85 @@ #!/bin/sh # $FreeBSD$ # PROVIDE: ganglia # REQIORE: DAEMON # KEYWORD: FreeBSD shutdown +# XXX: This should really be two seperate scripts with rcorder +# dependencies, but we can't do that at the moment and gmetad doesn't +# work without a running gmond. + gmond_enable="NO" gmond_conf="%%PREFIX%%/etc/gmond.conf" + gmetad_enable="NO" gmetad_conf="%%PREFIX%%/etc/gmetad.conf" +gmetasnap_enable="NO" +gmetasnap_rrddir="/var/db/ganglia/rrds" +gmetasnap_snapdir="/var/db/ganglia/snaps" +gmetasnap_snapname="snap" +gmetasnap_flags="" +gmetasnap_command="%%PREFIX%%/sbin/gmetasnap" +### gmond ### + . %%RC_SUBR%% name=gmond rcvar=`set_rcvar` command="%%PREFIX%%/sbin/${name}" load_rc_config ganglia load_rc_config $name command_args="-c ${gmond_conf}" required_files=${gmond_conf} run_rc_command $* +### gmetad ### + # Don't continue if we didn't run gmond if ! checkyesno ${rcvar}; then return 0 fi name=gmetad rcvar=`set_rcvar` command="%%PREFIX%%/sbin/${name}" +start_precmd="gmetad_prestart" +stop_postcmd="gmetad_poststop" + +gmetad_prestart() +{ + if [ ! -d ${gmetasnap_rrddir} ]; then + mkdir -p ${gmetasnap_rrddir} + fi + chown ganglia:ganglia ${gmetasnap_rrddir} + if checkyesno gmetasnap_enable; then + if [ ! -d ${gmetasnap_snapdir} ]; then + mkdir -p ${gmetasnap_snapdir} + chown ganglia:ganglia ${gmetasnap_snapdir} + fi + if [ `ls ${gmetasnap_rrddir} | egrep -v ^.snap | wc -l` -eq 0 ]; then + ${gmetasnap_command} -r ${gmetasnap_rrddir} \ + -s ${gmetasnap_snapdir} ${gmetasnap_flags} \ + restore ${gmetasnap_snapname} + fi + fi +} + +gmetad_poststop() +{ + if checkyesno gmetasnap_enable; then + ${gmetasnap_command} -r ${gmetasnap_rrddir} \ + -s ${gmetasnap_snapdir} ${gmetasnap_flags} \ + save ${gmetasnap_snapname} + fi +} load_rc_config $name command_args="-c ${gmetad_conf}" required_files=${gmetad_conf} run_rc_command $* Property changes on: head/sysutils/ganglia-monitor-core/files/ganglia.sh.in ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.1 \ No newline at end of property +1.2 \ No newline at end of property Index: head/sysutils/ganglia-monitor-core/files/gmetasnap.sh =================================================================== --- head/sysutils/ganglia-monitor-core/files/gmetasnap.sh (nonexistent) +++ head/sysutils/ganglia-monitor-core/files/gmetasnap.sh (revision 134272) @@ -0,0 +1,195 @@ +#!/bin/sh +# +# gmetasnapshot - Ganglia gmetad snapshot manager +# +# $FreeBSD$ + +command=`basename $0` + +def_rrddir=/var/db/ganglia/rrds +def_snapdir=/var/db/ganglia/snaps +def_snapname=snap +def_comp=gzip + +rrddir=$def_rrddir +snapdir=$def_snapdir +snapname=$def_snapname +comp=$def_comp +delete_old=0 + +usage() +{ + exitcode=$1 + shift + if [ -n "$*" ]; then + warn $* + fi + cat <] save [] + ${command} [] restore [] + +options: + -D Delete .old file after creating snapshot. + -h Display this message + -r Set the rrddir [default: ${def_rrddir}] + -s Set the snapdir [default: ${def_snapdir}] + -z Set the compression type. Valid values are + gzip, bzip2, and none. [default: ${def_comp}] + +notes: + - The default snapname is: ${def_snapname} + - ${command} will not create rrddir or snapdir. +EOU + exit $1 +} + +err() +{ + exitcode=$1 + shift + echo ${command} $* >&2 + exit $exitcode +} + +warn() +{ + echo ${command} $* >&2 +} + +compsuffix() +{ + case "$1" in + gzip) + echo ".gz" + ;; + bzip2) + echo ".bz2" + ;; + none) + echo "" + ;; + *) + echo "Unsupposed compression type ignored: $1" >&2 + echo "" + ;; + esac +} + +compflag() +{ + case "$1" in + gzip) + echo "z" + ;; + bzip2) + echo "y" + ;; + none) + echo "" + ;; + *) + echo "Unsupposed compression type ignored: $1" >&2 + echo "" + ;; + esac +} + +while [ -n "$1" ]; do + case "$1" in + -D) + shift; + delete_old=1 + ;; + -h) + shift; + usage 0 + ;; + -r) + shift; + if [ -z "$1" ]; then + usage 1 "-r requires an argument" + fi + rrddir=$1 + shift + ;; + -s) + shift; + if [ -z "$1" ]; then + usage 1 "-s requires an argument" + fi + snapdir=$1 + shift + ;; + -z) + shift; + if [ -z "$1" ]; then + usage 1 "-z requires an argument" + fi + rrddir=$1 + shift + ;; + -*) + usage 1 "unknown argument $1" + ;; + *) + break + esac +done + +if [ -n "$2" ]; then + snapname=$2 +fi + +basefile=${snapdir}/${snapname}.tar`compsuffix ${comp}` +tarcmd="tar `compflag ${comp}`" + +case "$1" in +save) + if [ ! -d ${rrddir} ]; then + err 2 "rrddir ${rrddir} does not exist" + fi + if [ ! -d ${snapdir} ]; then + err 2 "snapdir ${snapdir} does not exist" + fi + echo "saving ${rrddir} to ${basefile}" + cd ${rrddir} + if ! ${tarcmd}cf ${basefile}.new .; then + err 2 "Failed to create ${basefile}.new" + fi + if [ -e ${basefile} ]; then + mv ${basefile} ${basefile}.old + sync + fi + mv ${basefile}.new ${basefile} + sync + if [ $delete_old -ne 0 ]; then + rm ${basefile}.old + fi + sync + ;; +restore) + for file in ${basefile} ${basefile}.new ${basefile}.old; do + if [ -e ${file} ]; then + if ${tarcmd}tf ${file} >/dev/null 2>&1 ; then + sourcefile=${file} + break + else + warn "${file} exists but is not a valid tarball. Ignoring." + fi + fi + done + if [ -z "$sourcefile" ]; then + err 1 "no snapshot found in ${snapdir}." + fi + echo "restoring ${rrddir} from ${sourcefile}" + if [ ! -d "${rrddir}" ]; then + err 1 "${rrddir} does not exist" + fi + cd ${rrddir} + ${tarcmd}xpf ${sourcefile} + ;; +*) + usage 1 "unknown command: $1" + ;; +esac Property changes on: head/sysutils/ganglia-monitor-core/files/gmetasnap.sh ___________________________________________________________________ Added: cvs2svn:cvs-rev ## -0,0 +1 ## +1.1 \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/sysutils/ganglia-monitor-core/pkg-plist =================================================================== --- head/sysutils/ganglia-monitor-core/pkg-plist (revision 134271) +++ head/sysutils/ganglia-monitor-core/pkg-plist (revision 134272) @@ -1,18 +1,19 @@ @comment $FreeBSD$ %%LIBGANGLIA%%bin/ganglia-config bin/gstat bin/gmetric @unexec if cmp -s %D/etc/gmond.conf %D/etc/gmond.conf.sample; then rm -f %D/etc/gmond.conf; fi etc/gmond.conf.sample %%GMETAD%%@unexec if cmp -s %D/etc/gmetad.conf %D/etc/gmetad.conf.sample; then rm -f %D/etc/gmetad.conf; fi %%GMETAD%%etc/gmetad.conf.sample %%LIBGANGLIA%%include/ganglia.h %%LIBGANGLIA%%lib/libganglia-3.0.0.so.0 %%LIBGANGLIA%%lib/libganglia-3.0.0.so %%LIBGANGLIA%%lib/libganglia.so %%LIBGANGLIA%%lib/libganglia.la %%LIBGANGLIA%%lib/libganglia.a %%GMETAD%%sbin/gmetad +%%GMETAD%%sbin/gmetasnap sbin/gmond @unexec rmdir %D/var/db/ganglia/rrds 2>/dev/null || true @unexec rmdir %D/var/db/ganglia 2>/dev/null || true Property changes on: head/sysutils/ganglia-monitor-core/pkg-plist ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.7 \ No newline at end of property +1.8 \ No newline at end of property