mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-26 22:06:35 +01:00
system/graylog-sidecar: Added (configuration management system).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
cc0c902d50
commit
b575e23436
6 changed files with 213 additions and 0 deletions
20
system/graylog-sidecar/README
Normal file
20
system/graylog-sidecar/README
Normal file
|
@ -0,0 +1,20 @@
|
|||
graylog-sidecar (is a lightweight configuration management system)
|
||||
|
||||
Graylog Sidecar is a lightweight configuration management system for
|
||||
different log collectors, also called Backends. The Graylog node(s)
|
||||
acts as a centralized hub containing the configurations of log
|
||||
collectors. On supported message-producing devices/hosts, Sidecar
|
||||
can run as a service (Windows host) or daemon (Linux host).
|
||||
|
||||
https://go2docs.graylog.org/5-0/getting_in_log_data/graylog_sidecar.html
|
||||
|
||||
Add this to /etc/rc.d/rc.local:
|
||||
if [ -x /etc/rc.d/rc.graylog-sidecar ]; then
|
||||
/etc/rc.d/rc.graylog-sidecar start
|
||||
fi
|
||||
|
||||
Add this to /etc/rc.d/rc.local_shutdown
|
||||
if [ -x /etc/rc.d/rc.graylog-sidecar ]; then
|
||||
/etc/rc.d/rc.graylog-sidecar stop
|
||||
fi
|
||||
|
24
system/graylog-sidecar/doinst.sh
Normal file
24
system/graylog-sidecar/doinst.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
config() {
|
||||
NEW="$1"
|
||||
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
||||
if [ ! -r $OLD ]; then
|
||||
mv $NEW $OLD
|
||||
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
|
||||
rm $NEW
|
||||
fi
|
||||
}
|
||||
|
||||
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.graylog-sidecar.new
|
||||
preserve_perms etc/graylog/sidecar/sidecar.yml.new
|
||||
|
90
system/graylog-sidecar/graylog-sidecar.SlackBuild
Normal file
90
system/graylog-sidecar/graylog-sidecar.SlackBuild
Normal file
|
@ -0,0 +1,90 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Slackware build script for graylog-sidecar
|
||||
|
||||
# Copyright 2023 André Geraldo Vieira <andre.geraldo@gmail.com>
|
||||
# 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.
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=graylog-sidecar
|
||||
SRCNAM=collector-sidecar
|
||||
VERSION=${VERSION:-1.4.0}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) ARCH=i586 ;;
|
||||
arm*) ARCH=arm ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $SRCNAM-$VERSION
|
||||
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
|
||||
cd $SRCNAM-$VERSION
|
||||
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 {} \;
|
||||
|
||||
make
|
||||
|
||||
mkdir -p $PKG/etc/{graylog/sidecar/,rc.d}
|
||||
mkdir -p $PKG/usr/bin
|
||||
mkdir -p $PKG/var/{lib/graylog-sidecar/generated,log/graylog-sidecar,run/graylog-sidecar}
|
||||
|
||||
cp sidecar-example.yml $PKG/etc/graylog/sidecar/sidecar.yml.new
|
||||
cp $CWD/rc.graylog-sidecar $PKG/etc/rc.d/rc.graylog-sidecar.new
|
||||
cp graylog-sidecar $PKG/usr/bin
|
||||
|
||||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a \
|
||||
README.md CODE_OF_CONDUCT.md 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
|
10
system/graylog-sidecar/graylog-sidecar.info
Normal file
10
system/graylog-sidecar/graylog-sidecar.info
Normal file
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="graylog-sidecar"
|
||||
VERSION="1.4.0"
|
||||
HOMEPAGE="https://go2docs.graylog.org/5-0/getting_in_log_data/graylog_sidecar.html"
|
||||
DOWNLOAD="https://github.com/Graylog2/collector-sidecar/archive/refs/tags/1.4.0/collector-sidecar-1.4.0.tar.gz"
|
||||
MD5SUM="a1f862c650f369ea9af68e64316fa6d1"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
MAINTAINER="André Geraldo Vieira"
|
||||
EMAIL="andre.geraldo@gmail.com"
|
50
system/graylog-sidecar/rc.graylog-sidecar
Normal file
50
system/graylog-sidecar/rc.graylog-sidecar
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
PIDOF_CMD=/sbin/pidof
|
||||
ECHO_CMD=/usr/bin/echo
|
||||
SLEEP_CMD=/usr/bin/sleep
|
||||
KILL_CMD=/bin/kill
|
||||
|
||||
NAME=graylog-sidecar
|
||||
GRAYLOG_CMD=${GRAYLOG_CMD-/usr/bin/${NAME}}
|
||||
|
||||
graylog_sidecar_start() {
|
||||
if [ -n "$($PIDOF_CMD graylog-sidecar)" ]; then
|
||||
$ECHO_CMD "Graylog Sidecar seems to be already running."
|
||||
return
|
||||
fi
|
||||
|
||||
$ECHO_CMD "Starting Graylog Sidecar."
|
||||
$GRAYLOG_CMD &
|
||||
}
|
||||
|
||||
graylog_sidecar_stop() {
|
||||
if [ -z "$($PIDOF_CMD graylog-sidecar)" ]; then
|
||||
$ECHO_CMD "Graylog Sidecar does not seem to be running."
|
||||
return
|
||||
fi
|
||||
|
||||
$ECHO_CMD "Stopping Graylog Sidecar."
|
||||
$KILL_CMD $($PIDOF_CMD graylog-sidecar)
|
||||
}
|
||||
|
||||
graylog_sidecar_restart() {
|
||||
$ECHO_CMD "Restarting Graylog Sidecar."
|
||||
graylog_sidecar_stop
|
||||
$SLEEP_CMD 5
|
||||
graylog_sidecar_start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'start')
|
||||
graylog_sidecar_start
|
||||
;;
|
||||
'stop')
|
||||
graylog_sidecar_stop
|
||||
;;
|
||||
'restart')
|
||||
graylog_sidecar_restart
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 start|stop|restart"
|
||||
esac
|
19
system/graylog-sidecar/slack-desc
Normal file
19
system/graylog-sidecar/slack-desc
Normal file
|
@ -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------------------------------------------------------|
|
||||
graylog-sidecar: graylog-sidecar (lightweight configuration management system)
|
||||
graylog-sidecar:
|
||||
graylog-sidecar: Graylog Sidecar is a lightweight configuration management system for
|
||||
graylog-sidecar: different log collectors, also called Backends. The Graylog node(s)
|
||||
graylog-sidecar: acts as a centralized hub containing the configurations of log
|
||||
graylog-sidecar: collectors. On supported message-producing devices/hosts, Sidecar
|
||||
graylog-sidecar: can run as a service (Windows host) or daemon (Linux host).
|
||||
graylog-sidecar:
|
||||
graylog-sidecar: https://go2docs.graylog.org/5-0/getting_in_log_data/graylog_sidecar
|
||||
graylog-sidecar: .html
|
||||
graylog-sidecar:
|
Loading…
Reference in a new issue