summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Preksavec <mario at slackware dot hr>2015-02-28 09:53:54 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2015-02-28 11:06:36 +0700
commit3254302d0402e557e3ae1d749c7271d0e4de2518 (patch)
tree0e8ae510e4015b38d64d2da10614b283fb82eb9a
parent8aecd9ce372ff9c6abc55dc036a6ea12eab6ca22 (diff)
downloadslackbuilds-3254302d0402e557e3ae1d749c7271d0e4de2518.tar.gz
system/nsca-ng: Added (drop-in replacement for NSCA).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--system/nsca-ng/README8
-rw-r--r--system/nsca-ng/README.SLACKWARE15
-rw-r--r--system/nsca-ng/doinst.sh28
-rw-r--r--system/nsca-ng/nsca-ng.SlackBuild133
-rw-r--r--system/nsca-ng/nsca-ng.info10
-rw-r--r--system/nsca-ng/patches/nsca-ng.cfg.diff10
-rw-r--r--system/nsca-ng/patches/nsca-ng.init.diff11
-rw-r--r--system/nsca-ng/slack-desc19
8 files changed, 234 insertions, 0 deletions
diff --git a/system/nsca-ng/README b/system/nsca-ng/README
new file mode 100644
index 0000000000..87ecfb81f4
--- /dev/null
+++ b/system/nsca-ng/README
@@ -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.
diff --git a/system/nsca-ng/README.SLACKWARE b/system/nsca-ng/README.SLACKWARE
new file mode 100644
index 0000000000..c56f2b5107
--- /dev/null
+++ b/system/nsca-ng/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.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
diff --git a/system/nsca-ng/doinst.sh b/system/nsca-ng/doinst.sh
new file mode 100644
index 0000000000..be979e7f6c
--- /dev/null
+++ b/system/nsca-ng/doinst.sh
@@ -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
diff --git a/system/nsca-ng/nsca-ng.SlackBuild b/system/nsca-ng/nsca-ng.SlackBuild
new file mode 100644
index 0000000000..9e900e0863
--- /dev/null
+++ b/system/nsca-ng/nsca-ng.SlackBuild
@@ -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}
diff --git a/system/nsca-ng/nsca-ng.info b/system/nsca-ng/nsca-ng.info
new file mode 100644
index 0000000000..b7cb1281e9
--- /dev/null
+++ b/system/nsca-ng/nsca-ng.info
@@ -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"
diff --git a/system/nsca-ng/patches/nsca-ng.cfg.diff b/system/nsca-ng/patches/nsca-ng.cfg.diff
new file mode 100644
index 0000000000..418af5a243
--- /dev/null
+++ b/system/nsca-ng/patches/nsca-ng.cfg.diff
@@ -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.
diff --git a/system/nsca-ng/patches/nsca-ng.init.diff b/system/nsca-ng/patches/nsca-ng.init.diff
new file mode 100644
index 0000000000..982d3041b3
--- /dev/null
+++ b/system/nsca-ng/patches/nsca-ng.init.diff
@@ -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()
+ {
diff --git a/system/nsca-ng/slack-desc b/system/nsca-ng/slack-desc
new file mode 100644
index 0000000000..1832069641
--- /dev/null
+++ b/system/nsca-ng/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------------------------------------------------------|
+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: