summaryrefslogtreecommitdiff
path: root/pcr/ganglia
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-06-18 01:11:38 -0700
committerroot <root@rshg054.dnsready.net>2013-06-18 01:11:38 -0700
commit614d2fec699c594b1a3a25c973e0b5150302ff0e (patch)
tree7d5b075f309f4004f09e77562975fad441662446 /pcr/ganglia
parent3c8e479bfe9fab72058c833f2909a26232114733 (diff)
Tue Jun 18 01:11:08 PDT 2013
Diffstat (limited to 'pcr/ganglia')
-rw-r--r--pcr/ganglia/PKGBUILD117
-rw-r--r--pcr/ganglia/ganglia.install32
-rw-r--r--pcr/ganglia/gmetad.rc62
-rw-r--r--pcr/ganglia/gmetad.service11
-rw-r--r--pcr/ganglia/gmond.rc62
-rw-r--r--pcr/ganglia/gmond.service9
-rw-r--r--pcr/ganglia/uid.patch33
7 files changed, 262 insertions, 64 deletions
diff --git a/pcr/ganglia/PKGBUILD b/pcr/ganglia/PKGBUILD
index 3a2e54dd8..f5a900b88 100644
--- a/pcr/ganglia/PKGBUILD
+++ b/pcr/ganglia/PKGBUILD
@@ -2,80 +2,69 @@
pkgname=ganglia
pkgver=3.6.0
-pkgrel=1
-pkgdesc='Scalable distributed monitoring system for high-performance computing systems such as clusters and Grids'
-arch=(
- i686
- x86_64
- mips64el
-)
-url=http://$pkgname.sourceforge.net/
-license=BSD
-depends=(
- apr
- confuse
- #php-embed
- python2
- rrdtool
-)
-options=(!libtool)
-optdepends="$pkgname-web: Web frontend"
-backup=(
- etc/gmond.conf
- etc/gmetad.conf
-)
-source=http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
-sha512sums=2a05d37787f1440c0c4aa91cdf0f4f4cb39c840b3b0fdcd6fe58cfb5892a75f81d36f6191c83c17558c37154298268df74fa255d2c940a8b84a7bf3ddb102394
+pkgrel=2
+pkgdesc="A scalable distributed monitoring system for high-performance computing systems such as clusters and Grids."
+arch=('i686' 'x86_64')
+url="http://ganglia.sourceforge.net/"
+license=('BSD')
+depends=('apr' 'confuse' 'expat' 'pcre' 'python2' 'rrdtool')
+options=('!libtool')
+optdepends=('ganglia-web: Web frontend')
+install='ganglia.install'
+backup=('etc/ganglia/gmond.conf'
+ 'etc/ganglia/gmetad.conf')
+source=("http://downloads.sourceforge.net/ganglia/$pkgname-$pkgver.tar.gz"
+ 'gmond.rc'
+ 'gmetad.rc'
+ 'gmond.service'
+ 'gmetad.service'
+ 'ganglia.install'
+ 'uid.patch')
+md5sums=('05926bb18c22af508a3718a90b2e9a2c'
+ '12b2f85361754eaf6fc5129cccec7034'
+ '292b74a5a09a0bd9a4a658823adc034b'
+ '25ebc6cf829089a9f330ad177befdd45'
+ 'd795bca44fb73cdf8a2b550e27c50b6f'
+ 'acad2273520f13f4d0638ca9109ca2d8'
+ 'a0d469dd2b9ec40dbe20377c51ca904c')
prepare() {
- cd $srcdir/$pkgname-$pkgver
- #sed -i 's|sapi/embed/php_embed.h|php/sapi/embed/php_embed.h|' configure
- touch gm{on,eta}d/gm{on,eta}d.service.in
+ cd "$srcdir/$pkgname-$pkgver"
- echo '[Unit]' > gmetad/gmetad.service.in
- echo 'Description=Ganglia Meta Daemon' >> gmetad/gmetad.service.in
- echo 'After=network.target' >> gmetad/gmetad.service.in
- echo '' >> gmetad/gmetad.service.in
- echo '[Service]' >> gmetad/gmetad.service.in
- echo 'Type=forking' >> gmetad/gmetad.service.in
- echo 'PIDFile=/run/gmetad.pid' >> gmetad/gmetad.service.in
- echo 'ExecStart=/usr/sbin/gmetad -p /run/gmetad.pid' >> gmetad/gmetad.service.in
- echo '' >> gmetad/gmetad.service.in
- echo '[Install]' >> gmetad/gmetad.service.in
- echo 'WantedBy=multi-user.target' >> gmetad/gmetad.service.in
+ for patch in $srcdir/*.patch; do
+ msg2 "Applying $(basename $patch)"
+ patch -Np1 -i $patch
+ done
- echo '[Unit]' > gmond/gmond.service.in
- echo 'Description=Ganglia Monitor Daemon' >> gmond/gmond.service.in
- echo 'After=network.target' >> gmond/gmond.service.in
- echo '' >> gmond/gmond.service.in
- echo '[Service]' >> gmond/gmond.service.in
- echo 'ExecStart=/usr/sbin/gmond -f -p /run/gmond.pid' >> gmond/gmond.service.in
- echo '' >> gmond/gmond.service.in
- echo '[Install]' >> gmond/gmond.service.in
- echo 'WantedBy=multi-user.target' >> gmond/gmond.service.in
+ # FIXME: Hopefully this will soon no longer be required?
+ msg2 "Copying systemd units into source as workaround for bug"
+ cp "$srcdir/gmond.service" "$srcdir/$pkgname-$pkgver/gmond/gmond.service.in"
+ cp "$srcdir/gmetad.service" "$srcdir/$pkgname-$pkgver/gmetad/gmetad.service.in"
}
build() {
- cd $srcdir/$pkgname-$pkgver
- setarch $CARCH ./configure --prefix=/usr\
- --enable-gexec\
- --enable-perl\
- --enable-status\
- --disable-static\
- --libdir=/usr/lib\
- --with-gmetad\
- --with-python=/usr/bin/python2\
- --sysconfdir=/etc
-# --enable-php\
- setarch $CARCH make
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure --prefix=/usr --libdir=/usr/lib --sysconfdir=/etc/ganglia \
+ --with-gmetad --enable-gexec --enable-status \
+ --with-python=/usr/bin/python2
+ make
}
package() {
- cd $srcdir/$pkgname-$pkgver
- setarch $CARCH make DESTDIR=$pkgdir install
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+
+ # Move sbin to bin
+ mv "$pkgdir/usr/sbin"/* "$pkgdir/usr/bin/"
+ rmdir "$pkgdir/usr/sbin"
- mkdir $pkgdir/usr/lib/$pkgname/python_modules
+ mkdir -p "$pkgdir/usr/lib/ganglia/python_modules"
- msg2 'Generating default gmond.conf'
- ./gmond/gmond --default_config > $pkgdir/etc/gmond.conf
+ msg2 "Generating default gmond.conf"
+ ./gmond/gmond --default_config > "$pkgdir/etc/ganglia/gmond.conf"
+
+ # Uncomment these lines to install the rc files
+ #install -m 755 -D "$srcdir/gmond.rc" "$pkgdir/etc/rc.d/gmond"
+ #install -m 755 -D "$srcdir/gmetad.rc" "$pkgdir/etc/rc.d/gmetad"
}
diff --git a/pcr/ganglia/ganglia.install b/pcr/ganglia/ganglia.install
new file mode 100644
index 000000000..60b7f102d
--- /dev/null
+++ b/pcr/ganglia/ganglia.install
@@ -0,0 +1,32 @@
+# arg 1: the new package version
+post_install() {
+ post_upgrade
+}
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ if [ "`vercmp $2 3.4.0`" -lt 0 ]; then
+ echo "WARNING: The ganglia package has been split. If you use the" \
+ "web frontend, you'll need to install the ganglia-web package as well."
+ fi
+ id ganglia >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "Adding ganglia system group and user..."
+ groupadd -r ganglia
+ useradd -r -d /var/lib/ganglia -g ganglia -s /bin/false ganglia
+ # Lock the account to prevent logging in
+ passwd -l ganglia &> /dev/null
+ fi
+ install -d -o ganglia -g ganglia /var/lib/ganglia
+ install -d -o ganglia -g ganglia /var/lib/ganglia/rrds
+}
+
+# arg 1: the old package version
+post_remove() {
+ echo "Removing ganglia system group and user..."
+ userdel ganglia
+ echo "NOTE: Please remove /var/lib/ganglia manually if it is no longer required."
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/pcr/ganglia/gmetad.rc b/pcr/ganglia/gmetad.rc
new file mode 100644
index 000000000..823062fac
--- /dev/null
+++ b/pcr/ganglia/gmetad.rc
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ PID=`pidof -o %PPID /usr/sbin/gmetad`
+}
+get_pid
+
+case "$1" in
+ start)
+ stat_busy "Starting Ganglia gmetad"
+ [ -z "$PID" ] && /usr/sbin/gmetad
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ sleep 1
+ get_pid
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $PID > /var/run/gmetad.pid
+ add_daemon gmetad
+ stat_done
+ fi
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping Ganglia gmetad"
+ [ ! -z "$PID" ] && kill $PID > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ sleep 1
+ get_pid
+ if [ $? -gt 0 ]; then
+ rm /var/run/gmetad.pid
+ rm_daemon gmetad
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ exit 1
+
+esac
diff --git a/pcr/ganglia/gmetad.service b/pcr/ganglia/gmetad.service
new file mode 100644
index 000000000..a721c2b4c
--- /dev/null
+++ b/pcr/ganglia/gmetad.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Ganglia Meta Daemon
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/run/gmetad.pid
+ExecStart=/usr/bin/gmetad -p /run/gmetad.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/pcr/ganglia/gmond.rc b/pcr/ganglia/gmond.rc
new file mode 100644
index 000000000..c465c4dbf
--- /dev/null
+++ b/pcr/ganglia/gmond.rc
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ PID=`pidof -o %PPID /usr/sbin/gmond`
+}
+get_pid
+
+case "$1" in
+ start)
+ stat_busy "Starting Ganglia gmond"
+ [ -z "$PID" ] && /usr/sbin/gmond
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ sleep 1
+ get_pid
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $PID > /var/run/gmond.pid
+ add_daemon gmond
+ stat_done
+ fi
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping Ganglia gmond"
+ [ ! -z "$PID" ] && kill $PID > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ sleep 1
+ get_pid
+ if [ $? -gt 0 ]; then
+ rm /var/run/gmond.pid
+ rm_daemon gmond
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ exit 1
+
+esac
diff --git a/pcr/ganglia/gmond.service b/pcr/ganglia/gmond.service
new file mode 100644
index 000000000..5cbd31629
--- /dev/null
+++ b/pcr/ganglia/gmond.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Ganglia Monitor Daemon
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/gmond -f -p /run/gmond.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/pcr/ganglia/uid.patch b/pcr/ganglia/uid.patch
new file mode 100644
index 000000000..165549033
--- /dev/null
+++ b/pcr/ganglia/uid.patch
@@ -0,0 +1,33 @@
+--- a/configure
++++ b/configure
+@@ -1588,7 +1588,7 @@ Optional Features:
+
+ --enable-debug turn on debugging output and compile options
+ --enable-gexec turn on gexec support (platform-specific)
+- --enable-setuid=USER turn on setuid support (default setuid=nobody)
++ --enable-setuid=USER turn on setuid support (default setuid=ganglia)
+ --enable-setgid=GROUP turn on setgid support (default setgid=no)
+ --enable-pedantic turn on pedantic mode during compile
+ --enable-memcheck turn on memory checking during compile
+@@ -11152,7 +11152,7 @@ $as_echo "#define SUPPORT_GEXEC 0" >>confdefs.h
+ fi
+
+
+-setuid_user=nobody
++setuid_user=ganglia
+ # Check whether --enable-setuid was given.
+ if test "${enable_setuid+set}" = set; then :
+ enableval=$enable_setuid; if test x"$enableval" != xno; then no_setuid=0; setuid_user=$enableval ; fi
+--- a/gmetad/gmetad.conf.in
++++ b/gmetad/gmetad.conf.in
+@@ -99,8 +99,8 @@ data_source "my cluster" localhost
+ #-------------------------------------------------------------------------------
+ # User gmetad will setuid to (defaults to "nobody")
+ # default: "nobody"
+-# setuid_username "nobody"
+-#
++setuid_username "ganglia"
++
+ #-------------------------------------------------------------------------------
+ # Umask to apply to created rrd files and grid directory structure
+ # default: 0 (files are public)