diff options
author | Bas Couwenberg <sebastic@xs4all.nl> | 2010-12-28 14:28:48 -0600 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-12-29 01:08:49 -0600 |
commit | 317811518be63939f7637b715ee95adcb28f7e2c (patch) | |
tree | 2b5c78b5352e7ce663799e666348655172a73f2b | |
parent | 2cca181910818e6af4fa9c1e71cb9ae1718af3f7 (diff) |
network/nsca: Added (Nagios Service Check Acceptor)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
-rw-r--r-- | network/nsca/README | 5 | ||||
-rw-r--r-- | network/nsca/doinst.sh | 28 | ||||
-rw-r--r-- | network/nsca/nsca.SlackBuild | 112 | ||||
-rw-r--r-- | network/nsca/nsca.info | 10 | ||||
-rw-r--r-- | network/nsca/rc.nsca | 79 | ||||
-rw-r--r-- | network/nsca/slack-desc | 19 |
6 files changed, 253 insertions, 0 deletions
diff --git a/network/nsca/README b/network/nsca/README new file mode 100644 index 000000000000..74cfdc7a42ea --- /dev/null +++ b/network/nsca/README @@ -0,0 +1,5 @@ +nsca (Nagios Service Check Acceptor) + +NSCA is a Linux/Unix daemon allows you to integrate passive alerts and +checks from remote machines and applications with Nagios. Useful for +processing security alerts, as well as redundant Nagios setups. diff --git a/network/nsca/doinst.sh b/network/nsca/doinst.sh new file mode 100644 index 000000000000..ecaa1a5ad02d --- /dev/null +++ b/network/nsca/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.new +config etc/nagios/nsca.cfg.new +config etc/nagios/send_nsca.cfg.new + diff --git a/network/nsca/nsca.SlackBuild b/network/nsca/nsca.SlackBuild new file mode 100644 index 000000000000..b5fdf6533010 --- /dev/null +++ b/network/nsca/nsca.SlackBuild @@ -0,0 +1,112 @@ +#!/bin/sh + +# Slackware build script for nsca +# Written by Bas Couwenberg <sebastic@xs4all.nl> + +PRGNAM=nsca +VERSION=${VERSION:-2.7.2} +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 + +set -e + +# Bail out if user or group isn't valid on your system +# For slackbuilds.org, assigned nagios uid/gid are 213/213 +# See http://slackbuilds.org/uid_gid.txt +if ! getent group nagios 2>&1 > /dev/null; then + echo " You must have a \"nagios\" group to run this script." + echo " # groupadd -g 213 nagios" + exit 1 +elif ! getent passwd nagios 2>&1 > /dev/null; then + echo " You must have a \"nagios\" user to run this script." + echo " # useradd -u 213 -g nagios -d /usr/nagios -s /bin/false nagios" + exit 1 +fi + +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 . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --libexecdir=/usr/libexec/nagios \ + --sysconfdir=/etc/nagios \ + --localstatedir=/var/nagios \ + --mandir=/usr/man \ + --with-nsca-user=nagios \ + --with-nsca-group=nagios \ + --with-nsca-port=5667 \ + --with-nagios-user=nagios \ + --with-nagios-group=nagios \ + --build=$ARCH-slackware-linux + +make all +# make install does nothing, manual installation is required +mkdir -p $PKG/usr/sbin +cp -a src/send_nsca $PKG/usr/sbin +cp -a src/nsca $PKG/usr/sbin + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/etc/nagios +# nsca.cfg should contain the following configuration to match the nagios SlackBuild defaults: +# command_file=/var/nagios/rw/nagios.cmd +# alternate_dump_file=/var/nagios/rw/nsca.dump +cat sample-config/nsca.cfg > $PKG/etc/nagios/nsca.cfg.new +cat sample-config/send_nsca.cfg > $PKG/etc/nagios/send_nsca.cfg.new + +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.nsca > $PKG/etc/rc.d/rc.nsca.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + README SECURITY LEGAL Changelog sample-config \ + $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/nsca/nsca.info b/network/nsca/nsca.info new file mode 100644 index 000000000000..e0753167b0bc --- /dev/null +++ b/network/nsca/nsca.info @@ -0,0 +1,10 @@ +PRGNAM="nsca" +VERSION="2.7.2" +HOMEPAGE="http://www.nagios.org" +DOWNLOAD="http://downloads.sourceforge.net/nagios/nsca-2.7.2.tar.gz" +MD5SUM="33a98e7975f633a9489d7a8938ed6131" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Bas Couwenberg" +EMAIL="sebastic@xs4all.nl" +APPROVED="rworkman" diff --git a/network/nsca/rc.nsca b/network/nsca/rc.nsca new file mode 100644 index 000000000000..25812bcb596d --- /dev/null +++ b/network/nsca/rc.nsca @@ -0,0 +1,79 @@ +#!/bin/sh +# +# nsca daemon control script. +# +# This is an init script for the nsca daemon. +# To use nsca, you must first set up the config file(s). +# +# Written for Slackware Linux by Cherife li <cherife@dotimes.com> +# Modified for SBo by Zordrak <slackbuilds@tpa.me.uk> + +BIN=/usr/bin/nsca +CFGFILE=/etc/nagios/nsca.cfg +PIDFILE=/var/run/nsca.pid +LOCKFILE=/var/lock/nsca + +printstatus() +{ + if [ -e $PIDFILE ]; then + echo "nsca (pid $PID) is running..." + else + echo "nsca is not running" + fi +} + +killproc() +{ + kill $2 $PID +} + +getpid() +{ + if test ! -f $PIDFILE; then + echo "Pid file $PIDFILE not found." + exit 1 + else + PID=`head -n 1 $PIDFILE` + fi +} + +# Check whether nsca bin file exists. +if [ ! -f $BIN ]; then + echo "Executable file $BIN not found. Exiting." + exit 1 +fi + +# Check whether nsca config exists. +if [ ! -f $CFGFILE ]; then + echo "Configuration file $CFGFILE not found. Exiting." + exit 1 +fi + +# Controls +case "$1" in + start) + echo -n "Starting nsca:" + $BIN -c $CFGFILE -d + touch $LOCKFILE + echo " done." + ;; + stop) + echo -n "Stopping nsca:" + getpid + killproc nsca + rm -f $LOCKFILE + echo " done." + ;; + status) + getpid + printstatus nsca + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: nsca {start|stop|restart|status}" + exit 1 + ;; +esac diff --git a/network/nsca/slack-desc b/network/nsca/slack-desc new file mode 100644 index 000000000000..8d036eb3767a --- /dev/null +++ b/network/nsca/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 blank lines. + + |-----handy-ruler------------------------------------------------------| +nsca: nsca (Nagios Service Check Acceptor) +nsca: +nsca: NSCA is a Linux/Unix daemon allows you to integrate passive alerts +nsca: and checks from remote machines and applications with Nagios. Useful +nsca: for processing security alerts, as well as redundant Nagios setups. +nsca: +nsca: http://www.nagios.org/ +nsca: +nsca: +nsca: +nsca: |