summaryrefslogtreecommitdiff
path: root/network/nrpe
diff options
context:
space:
mode:
authorZordrak <slackbuilds@tpa.me.uk>2010-05-12 23:32:36 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-12 23:32:36 +0200
commit34a7452794f960f3323607605ef839493d9d98a2 (patch)
tree8f84d45fba6e35b556c665929c5f04b9f95b5302 /network/nrpe
parentda1bc7177dad31a279db8c401493d2e44c2448e1 (diff)
downloadslackbuilds-34a7452794f960f3323607605ef839493d9d98a2.tar.gz
network/nrpe: Added to 12.2 repository
Diffstat (limited to 'network/nrpe')
-rw-r--r--network/nrpe/README8
-rw-r--r--network/nrpe/doinst.sh23
-rw-r--r--network/nrpe/nrpe.SlackBuild101
-rw-r--r--network/nrpe/nrpe.info8
-rw-r--r--network/nrpe/rc.nrpe79
-rw-r--r--network/nrpe/slack-desc19
6 files changed, 238 insertions, 0 deletions
diff --git a/network/nrpe/README b/network/nrpe/README
new file mode 100644
index 0000000000..06c1426952
--- /dev/null
+++ b/network/nrpe/README
@@ -0,0 +1,8 @@
+nrpe (Nagios Remote Plugin Executor)
+
+The NRPE addon is designed to allow you to execute Nagios plugins on
+remote Linux/Unix machines. The main reason for doing this is to allow
+Nagios to monitor "local" resources (like CPU load, memory usage,
+etc.) remote machines. Since these public resources are not usually
+exposed to external machines, an agent like NRPE must be installed on
+the remote Linux/Unix machines.
diff --git a/network/nrpe/doinst.sh b/network/nrpe/doinst.sh
new file mode 100644
index 0000000000..f9994024fe
--- /dev/null
+++ b/network/nrpe/doinst.sh
@@ -0,0 +1,23 @@
+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...
+}
+
+# Keep same perms on rc.nrpe.new:
+if [ -e etc/rc.d/rc.nrpe ]; then
+ cp -a etc/rc.d/rc.nrpe etc/rc.d/rc.nrpe.new.incoming
+ cat etc/rc.d/rc.nrpe.new > etc/rc.d/rc.nrpe.new.incoming
+ mv etc/rc.d/rc.nrpe.new.incoming etc/rc.d/rc.nrpe.new
+fi
+
+config etc/rc.d/rc.nrpe.new
+config etc/nagios/nrpe.cfg.new
+
diff --git a/network/nrpe/nrpe.SlackBuild b/network/nrpe/nrpe.SlackBuild
new file mode 100644
index 0000000000..a40e19672e
--- /dev/null
+++ b/network/nrpe/nrpe.SlackBuild
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+# Slackware build script for nrpe
+
+# Written by Zordrak <slackbuilds@tpa.me.uk>
+
+PRGNAM=nrpe
+VERSION=${VERSION:-2.12}
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+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"
+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 ! grep ^nagios: /etc/group 2>&1 > /dev/null; then
+ echo " You must have a \"nagios\" group to run this script."
+ echo " # groupadd -g 213 nagios"
+ exit 1
+elif ! grep ^nagios: /etc/passwd 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 \
+ --mandir=/usr/man \
+ --with-nrpe-user=nagios \
+ --with-nrpe-group=nagios \
+ --with-nrpe-port=5666 \
+ --with-nagios-user=nagios \
+ --with-nagios-group=nagios \
+ --build=$ARCH-slackware-linux
+
+make
+make install-plugin DESTDIR=$PKG
+make install-daemon DESTDIR=$PKG
+
+( cd $PKG
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null || true
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null
+)
+
+mkdir -p $PKG/etc/nagios
+cat sample-config/nrpe.cfg > $PKG/etc/nagios/nrpe.cfg.new
+
+mkdir -p $PKG/etc/rc.d
+cat $CWD/rc.nrpe > $PKG/etc/rc.d/rc.nrpe.new
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ README README.SSL SECURITY LEGAL Changelog docs contrib 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.tgz
diff --git a/network/nrpe/nrpe.info b/network/nrpe/nrpe.info
new file mode 100644
index 0000000000..e211b1a14b
--- /dev/null
+++ b/network/nrpe/nrpe.info
@@ -0,0 +1,8 @@
+PRGNAM="nrpe"
+VERSION="2.12"
+HOMEPAGE="http://www.nagios.org"
+DOWNLOAD="http://downloads.sourceforge.net/nagios/nrpe-2.12.tar.gz"
+MD5SUM="b2d75e2962f1e3151ef58794d60c9e97"
+MAINTAINER="Zordrak"
+EMAIL="slackbuilds@tpa.me.uk"
+APPROVED="rworkman"
diff --git a/network/nrpe/rc.nrpe b/network/nrpe/rc.nrpe
new file mode 100644
index 0000000000..4cfa94bdad
--- /dev/null
+++ b/network/nrpe/rc.nrpe
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# nrpe daemon control script.
+#
+# This is an init script for the nrpe daemon.
+# To use nrpe, 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/nrpe
+CFGFILE=/etc/nagios/nrpe.cfg
+PIDFILE=/var/run/nrpe.pid
+LOCKFILE=/var/lock/nrpe
+
+printstatus()
+{
+ if [ -e $PIDFILE ]; then
+ echo "nrpe (pid $PID) is running..."
+ else
+ echo "nrpe 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 nrpe bin file exists.
+if [ ! -f $BIN ]; then
+ echo "Executable file $BIN not found. Exiting."
+ exit 1
+fi
+
+# Check whether nrpe config exists.
+if [ ! -f $CFGFILE ]; then
+ echo "Configuration file $CFGFILE not found. Exiting."
+ exit 1
+fi
+
+# Controls
+case "$1" in
+ start)
+ echo -n "Starting nrpe:"
+ $BIN -c $CFGFILE -d
+ touch $LOCKFILE
+ echo " done."
+ ;;
+ stop)
+ echo -n "Stopping nrpe:"
+ getpid
+ killproc nrpe
+ rm -f $LOCKFILE
+ echo " done."
+ ;;
+ status)
+ getpid
+ printstatus nrpe
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: nrpe {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
diff --git a/network/nrpe/slack-desc b/network/nrpe/slack-desc
new file mode 100644
index 0000000000..16c28989af
--- /dev/null
+++ b/network/nrpe/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 ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+nrpe: nrpe (Nagios Remote Plugin Executor)
+nrpe:
+nrpe: The NRPE addon is designed to allow you to execute Nagios plugins on
+nrpe: remote Linux/Unix machines. The main reason for doing this is to allow
+nrpe: Nagios to monitor "local" resources (like CPU load, memory usage,
+nrpe: etc.) remote machines. Since these public resources are not usually
+nrpe: exposed to external machines, an agent like NRPE must be installed on
+nrpe: the remote Linux/Unix machines.
+nrpe:
+nrpe: http://www.nagios.org/
+nrpe: