From 8e345cefbe19d133e041bd99e469ce3d044ea7dc Mon Sep 17 00:00:00 2001 From: Mario Preksavec Date: Fri, 6 Feb 2015 20:32:58 +0700 Subject: network/graphite-carbon: Added (Backend data caching). Signed-off-by: Willy Sudiarto Raharjo --- network/graphite-carbon/README | 8 ++ network/graphite-carbon/README.SLACKWARE | 15 +++ network/graphite-carbon/doinst.sh | 27 +++++ network/graphite-carbon/graphite-carbon.SlackBuild | 134 +++++++++++++++++++++ network/graphite-carbon/graphite-carbon.info | 10 ++ network/graphite-carbon/graphite-carbon.logrotate | 13 ++ network/graphite-carbon/man1/carbon-aggregator.1 | 56 +++++++++ network/graphite-carbon/man1/carbon-cache.1 | 50 ++++++++ network/graphite-carbon/man1/carbon-client.1 | 43 +++++++ network/graphite-carbon/man1/carbon-relay.1 | 51 ++++++++ .../man1/validate-storage-schemas.1 | 17 +++ .../patches/carbon.conf.example.diff | 41 +++++++ network/graphite-carbon/patches/setup.cfg.diff | 12 ++ .../patches/validate-storage-schemas.py.diff | 11 ++ network/graphite-carbon/rc.carbon-cache | 57 +++++++++ network/graphite-carbon/slack-desc | 19 +++ 16 files changed, 564 insertions(+) create mode 100644 network/graphite-carbon/README create mode 100644 network/graphite-carbon/README.SLACKWARE create mode 100644 network/graphite-carbon/doinst.sh create mode 100644 network/graphite-carbon/graphite-carbon.SlackBuild create mode 100644 network/graphite-carbon/graphite-carbon.info create mode 100644 network/graphite-carbon/graphite-carbon.logrotate create mode 100644 network/graphite-carbon/man1/carbon-aggregator.1 create mode 100644 network/graphite-carbon/man1/carbon-cache.1 create mode 100644 network/graphite-carbon/man1/carbon-client.1 create mode 100644 network/graphite-carbon/man1/carbon-relay.1 create mode 100644 network/graphite-carbon/man1/validate-storage-schemas.1 create mode 100644 network/graphite-carbon/patches/carbon.conf.example.diff create mode 100644 network/graphite-carbon/patches/setup.cfg.diff create mode 100644 network/graphite-carbon/patches/validate-storage-schemas.py.diff create mode 100644 network/graphite-carbon/rc.carbon-cache create mode 100644 network/graphite-carbon/slack-desc (limited to 'network/graphite-carbon') diff --git a/network/graphite-carbon/README b/network/graphite-carbon/README new file mode 100644 index 0000000000..adac9f0ee4 --- /dev/null +++ b/network/graphite-carbon/README @@ -0,0 +1,8 @@ +graphite-carbon (Backend data caching and persistence daemon for Graphite) + +Graphite is a web application using the Twisted framework to provide real-time +visualization and storage of numeric time-series data. The Carbon daemon +processes the incoming time-series data and saves it as Whisper database files. + +See README.SLACKWARE (which is also installed with the package docs) for +setup, configuration, and usage hints. diff --git a/network/graphite-carbon/README.SLACKWARE b/network/graphite-carbon/README.SLACKWARE new file mode 100644 index 0000000000..0f97aacb9f --- /dev/null +++ b/network/graphite-carbon/README.SLACKWARE @@ -0,0 +1,15 @@ +You may wish to add these lines to /etc/rc.d/rc.local to start the service: + +if [ -x /etc/rc.d/rc.carbon-cache ]; then + /etc/rc.d/rc.carbon-cache start +fi + +You may also add these lines to /etc/rc.d/rc.local_shutdown: + +if [ -x /etc/rc.d/rc.carbon-cache ]; then + /etc/rc.d/rc.carbon-cache stop +fi + +Remember to give executable permission to /etc/rc.d/rc.local_shutdown: + + chmod 0755 /etc/rc.d/rc.local_shutdown diff --git a/network/graphite-carbon/doinst.sh b/network/graphite-carbon/doinst.sh new file mode 100644 index 0000000000..c521772f82 --- /dev/null +++ b/network/graphite-carbon/doinst.sh @@ -0,0 +1,27 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.carbon-cache.new +config etc/logrotate.d/graphite-carbon.new +for i in etc/carbon/*.new ; do config $i ; done diff --git a/network/graphite-carbon/graphite-carbon.SlackBuild b/network/graphite-carbon/graphite-carbon.SlackBuild new file mode 100644 index 0000000000..ecf248df23 --- /dev/null +++ b/network/graphite-carbon/graphite-carbon.SlackBuild @@ -0,0 +1,134 @@ +#!/bin/sh + +# Slackware build script for carbon + +# Copyright 2015 Mario Preksavec, Zagreb, HR +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=graphite-carbon +SRCNAM=carbon +SRCVER=0.9.13-pre1 +VERSION=${VERSION:-0.9.13pre1} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +# Bail if user or group isn't valid on your system +if ! grep ^graphite: /etc/passwd 2>&1 > /dev/null; then + +cat << EOF + + You must have graphite user and a group to run this script + + # groupadd -g 299 graphite + # useradd -u 299 -d /var/lib/graphite -s /bin/false -g graphite graphite + +EOF + + exit +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $SRCNAM-$SRCVER +tar xvf $CWD/$SRCVER.tar.gz +cd $SRCNAM-$SRCVER +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Set some sane defaults +patch -p1 <$CWD/patches/carbon.conf.example.diff +# We don't have a RedHat system +patch -p1 <$CWD/patches/setup.cfg.diff +# Look for config file in /etc/carbon +patch -p1 <$CWD/patches/validate-storage-schemas.py.diff + +python setup.py install --root=$PKG + +# Need some dirs +mkdir -p $PKG/etc/{rc.d,logrotate.d} $PKG/var/{lib/graphite/whisper,log/carbon} +chown -R graphite:graphite $PKG/var/lib/graphite $PKG/var/log/carbon + +# Install rc script +install -D -m0644 -oroot -groot $CWD/rc.carbon-cache \ + $PKG/etc/rc.d/rc.carbon-cache.new + +# Logrotate script +install -D -m0644 -oroot -groot $CWD/graphite-carbon.logrotate \ + $PKG/etc/logrotate.d/graphite-carbon.new + +# Configuration goes into /etc/carbon +mv $PKG/usr/conf $PKG/etc/carbon +for i in $PKG/etc/carbon/*.example ; do mv $i ${i/.example/.new} ; done + +# Do we really want .py suffix in /usr/bin +for i in $PKG/usr/bin/*.py ; do mv $i ${i/.py/} ; done + +# Cruft removal +rm -rf $PKG/usr/storage + +# Manpages thanks to Debian folks! +mkdir -p $PKG/usr/man +cp -a $CWD/man1 $PKG/usr/man +find $PKG/usr/man -type f -exec gzip -9 {} \; + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/graphite-carbon/graphite-carbon.info b/network/graphite-carbon/graphite-carbon.info new file mode 100644 index 0000000000..ea91a33566 --- /dev/null +++ b/network/graphite-carbon/graphite-carbon.info @@ -0,0 +1,10 @@ +PRGNAM="graphite-carbon" +VERSION="0.9.13pre1" +HOMEPAGE="https://github.com/graphite-project/" +DOWNLOAD="https://github.com/graphite-project/carbon/archive/0.9.13-pre1.tar.gz" +MD5SUM="1c87be1d874ad74dd7f148b18c158fe2" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="python-whisper python-twisted" +MAINTAINER="Mario Preksavec" +EMAIL="mario at slackware dot hr" diff --git a/network/graphite-carbon/graphite-carbon.logrotate b/network/graphite-carbon/graphite-carbon.logrotate new file mode 100644 index 0000000000..7b769425a8 --- /dev/null +++ b/network/graphite-carbon/graphite-carbon.logrotate @@ -0,0 +1,13 @@ +/var/log/carbon/*.log { + weekly + missingok + rotate 7 + compress + delaycompress + notifempty + create 644 graphite graphite + sharedscripts + postrotate + /etc/rc.d/rc.carbon-cache restart > /dev/null + endscript +} diff --git a/network/graphite-carbon/man1/carbon-aggregator.1 b/network/graphite-carbon/man1/carbon-aggregator.1 new file mode 100644 index 0000000000..a8ab95294d --- /dev/null +++ b/network/graphite-carbon/man1/carbon-aggregator.1 @@ -0,0 +1,56 @@ +.TH CARBON-AGGREGATOR 1 +.SH NAME +carbon-aggregator \- buffer metrics over time before reporting to carbon-cache +.SH SYNOPSYS +.nf +.fam C +\fbcarbon-aggregator\fP [options] start +.fam T +.fi +.SH DESCRIPTION +carbon-aggregator can be run in front of carbon-cache to buffer metrics over +time before reporting them into whisper. +.PP +The options are described below. +.SH OPTIONS +.TP +.B +\-h, \-\-help +Show the embedded help. +.TP +.B +\-\-debug +Run in the foreground, log to stdout +.TP +.B +\-\-profile=PROFILE +Record performance profile data to the given file +.TP +.B +\-\-pidfile=PIDFILE +Write pid to the given file +.TP +.B +\-\-config=CONFIG +Use the given config file +.TP +.B +\-\-logdir=LOGDIR +Write logs in the given directory +.TP +.B +\-\-instance=INSTANCE +Manage a specific carbon instance +.TP +.B +\-\-rules=RULES +Use the given aggregation rules file. +.TP +.B +\-\-rewrite-rules=REWRITE_RULES +Use the given rewrite rules file. +.SH AUTHOR +\fBcarbon-aggregator\fP, created by Chris Davis. +.PP +This manual page was written by Jonas Genannt + +BIN_FILE=/usr/bin/carbon-cache +PID_FILE=/var/run/carbon-cache.pid +CONF_FILE=/etc/carbon/carbon.conf + +rc_start() { + if [ -x $BIN_FILE ] && [ -f $CONF_FILE ]; then + if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2>/dev/null; then + echo "carbon-cache daemon already running" + else + echo "Starting carbon-cache daemon: $BIN" + $BIN_FILE --config=$CONF_FILE --pidfile=$PID_FILE start + fi + fi +} + +rc_stop() { + if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2>/dev/null; then + echo "Stopping carbon-cache daemon: $BIN" + $BIN_FILE --config=$CONF_FILE --pidfile=$PID_FILE stop \ + && rm -f $PID_FILE + fi +} + +rc_status() { + if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2>/dev/null; then + $BIN_FILE --config=$CONF_FILE --pidfile=$PID_FILE status + fi +} + +rc_restart() { + rc_stop + sleep 1 + rc_start +} + +case "$1" in + 'start') + rc_start + ;; + 'stop') + rc_stop + ;; + 'restart') + rc_restart + ;; + 'status') + rc_status + ;; + *) + echo "usage $0 start|stop|restart|status" + ;; +esac diff --git a/network/graphite-carbon/slack-desc b/network/graphite-carbon/slack-desc new file mode 100644 index 0000000000..4136bf704b --- /dev/null +++ b/network/graphite-carbon/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +graphite-carbon: graphite-carbon (Backend data caching and daemon for Graphite) +graphite-carbon: +graphite-carbon: Graphite is a web application using the Twisted framework to provide +graphite-carbon: real-time visualization and storage of numeric time-series data. +graphite-carbon: The Carbon daemon processes the incoming time-series data and saves +graphite-carbon: it as Whisper database files. +graphite-carbon: +graphite-carbon: Homepage: https://github.com/graphite-project/ +graphite-carbon: +graphite-carbon: +graphite-carbon: -- cgit v1.2.3-65-gdbad