mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
system/nsca-ng: Added (drop-in replacement for NSCA).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
8aecd9ce37
commit
3254302d04
8 changed files with 234 additions and 0 deletions
8
system/nsca-ng/README
Normal file
8
system/nsca-ng/README
Normal file
|
@ -0,0 +1,8 @@
|
|||
nsca-ng (NSCA-ng is a drop-in replacement for NSCA)
|
||||
|
||||
NSCA-ng provides a client-server pair which makes the command pipe accessible
|
||||
to remote systems. This allows for submitting passive check results, downtimes
|
||||
and many other commands to Nagios or Icinga.
|
||||
|
||||
See README.SLACKWARE (which is also installed with the package docs) for
|
||||
setup, configuration, and usage hints.
|
15
system/nsca-ng/README.SLACKWARE
Normal file
15
system/nsca-ng/README.SLACKWARE
Normal file
|
@ -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.nsca-ng ]; then
|
||||
/etc/rc.d/rc.nsca-ng start
|
||||
fi
|
||||
|
||||
You may also add these lines to /etc/rc.d/rc.local_shutdown:
|
||||
|
||||
if [ -x /etc/rc.d/rc.nsca-ng ]; then
|
||||
/etc/rc.d/rc.nsca-ng stop
|
||||
fi
|
||||
|
||||
Remember to give executable permission to /etc/rc.d/rc.local_shutdown:
|
||||
|
||||
chmod 0755 /etc/rc.d/rc.local_shutdown
|
28
system/nsca-ng/doinst.sh
Normal file
28
system/nsca-ng/doinst.sh
Normal file
|
@ -0,0 +1,28 @@
|
|||
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.nsca-ng.new
|
||||
|
||||
find etc/nsca-ng -type f -name '*.new' \
|
||||
| while read new ; do config $new ; done
|
133
system/nsca-ng/nsca-ng.SlackBuild
Normal file
133
system/nsca-ng/nsca-ng.SlackBuild
Normal file
|
@ -0,0 +1,133 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Slackware build script for nsca-ng
|
||||
|
||||
# Copyright 2015 Mario Preksavec, Zagreb, Croatia
|
||||
# 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=nsca-ng
|
||||
VERSION=${VERSION:-1.4}
|
||||
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 ^nsca: /etc/passwd 2>&1 > /dev/null; then
|
||||
|
||||
cat << EOF
|
||||
|
||||
You must have nsca user and a group to run this script
|
||||
|
||||
# groupadd -g 302 nsca
|
||||
# useradd -u 302 -d /dev/null -s /bin/false -g nsca nsca
|
||||
|
||||
EOF
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $PRGNAM-$VERSION
|
||||
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
||||
cd $PRGNAM-$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 {} \;
|
||||
|
||||
# Fix some things
|
||||
patch -p1 <$CWD/patches/nsca-ng.cfg.diff
|
||||
patch -p1 <$CWD/patches/nsca-ng.init.diff
|
||||
|
||||
CFLAGS="$SLKCFLAGS" \
|
||||
CXXFLAGS="$SLKCFLAGS" \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
||||
--sysconfdir=/etc/nsca-ng \
|
||||
--localstatedir=/var \
|
||||
--mandir=/usr/man \
|
||||
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
||||
--enable-server \
|
||||
--build=$ARCH-slackware-linux
|
||||
|
||||
make
|
||||
make install DESTDIR=$PKG
|
||||
|
||||
# Append .new to configs
|
||||
for i in $PKG/etc/nsca-ng/*.cfg ; do mv $i $i.new ; done
|
||||
|
||||
# Install rc script
|
||||
mkdir $PKG/etc/rc.d
|
||||
cp contrib/nsca-ng.init $PKG/etc/rc.d/rc.nsca-ng.new
|
||||
|
||||
# Pid file
|
||||
mkdir -p -m 775 $PKG/var/run/nsca-ng
|
||||
chown nsca:nsca $PKG/var/run/nsca-ng
|
||||
|
||||
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
|
||||
|
||||
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
||||
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a AUTHORS COPYING ChangeLog INSTALL NEWS PROTOCOL README THANKS TODO \
|
||||
$CWD/README.SLACKWARE $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}
|
10
system/nsca-ng/nsca-ng.info
Normal file
10
system/nsca-ng/nsca-ng.info
Normal file
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="nsca-ng"
|
||||
VERSION="1.4"
|
||||
HOMEPAGE="http://www.nsca-ng.org/"
|
||||
DOWNLOAD="http://www.nsca-ng.org/download/nsca-ng-1.4.tar.gz"
|
||||
MD5SUM="5193cd5e20b938d149a638ba12395f3c"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES="confuse"
|
||||
MAINTAINER="Mario Preksavec"
|
||||
EMAIL="mario at slackware dot hr"
|
10
system/nsca-ng/patches/nsca-ng.cfg.diff
Normal file
10
system/nsca-ng/patches/nsca-ng.cfg.diff
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- nsca-ng-1.4/etc/nsca-ng.cfg.orig 2014-10-14 23:16:01.000000000 +0200
|
||||
+++ nsca-ng-1.4/etc/nsca-ng.cfg 2015-02-12 17:06:00.252698991 +0100
|
||||
@@ -9,6 +9,7 @@
|
||||
# Most probably, you'll have to specify the path to the Nagios command file.
|
||||
#
|
||||
command_file = "/usr/local/nagios/var/rw/nagios.cmd"
|
||||
+user = "nsca"
|
||||
|
||||
#
|
||||
# These configuration settings are optional.
|
11
system/nsca-ng/patches/nsca-ng.init.diff
Normal file
11
system/nsca-ng/patches/nsca-ng.init.diff
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- nsca-ng-1.4/contrib/nsca-ng.init.orig 2013-03-05 21:58:00.000000000 +0100
|
||||
+++ nsca-ng-1.4/contrib/nsca-ng.init 2015-02-12 17:07:38.490109689 +0100
|
||||
@@ -15,7 +15,7 @@
|
||||
export PATH
|
||||
|
||||
name='NSCA-ng'
|
||||
-pid_file="$HOME/.nsca-ng.pid"
|
||||
+pid_file="/var/run/nsca-ng/nsca-ng.pid"
|
||||
|
||||
get_pid()
|
||||
{
|
19
system/nsca-ng/slack-desc
Normal file
19
system/nsca-ng/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------------------------------------------------------|
|
||||
nsca-ng: nsca-ng (drop-in replacement for NSCA)
|
||||
nsca-ng:
|
||||
nsca-ng: NSCA-ng provides a client-server pair which makes the command pipe
|
||||
nsca-ng: accessible to remote systems. This allows for submitting passive
|
||||
nsca-ng: check results, downtimes and many other commands to Nagios or Icinga.
|
||||
nsca-ng:
|
||||
nsca-ng:
|
||||
nsca-ng: Homepage: http://www.nsca-ng.org/
|
||||
nsca-ng:
|
||||
nsca-ng:
|
||||
nsca-ng:
|
Loading…
Reference in a new issue