wok rev 8331

Add: nagios-nrpe
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Wed Feb 02 01:17:51 2011 +0100 (2011-02-02)
parents b4044080e3a4
children 18ef1a1df017
files nagios-nrpe/receipt nagios-nrpe/stuff/nagios-nrpe-2.12-Makefile.u nagios-nrpe/stuff/nrpe nagios-nrpe/stuff/nrpe.cfg
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nagios-nrpe/receipt	Wed Feb 02 01:17:51 2011 +0100
     1.3 @@ -0,0 +1,78 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="nagios-nrpe"
     1.7 +VERSION="2.12"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="Service and network monitoring program, remote monitoring."
    1.10 +MAINTAINER="erjo@slitaz.org"
    1.11 +SOURCE="nrpe"
    1.12 +TARBALL="$SOURCE-$VERSION.tar.gz"
    1.13 +WEB_SITE="http://www.nagios.org/"
    1.14 +WGET_URL="$SF_MIRROR/nagios/$TARBALL"
    1.15 +BUILD_DEPENDS="libcrypto-dev openssl-dev libwrap-dev"
    1.16 +DEPENDS="nagios-plugins libssl libcrypto"
    1.17 +
    1.18 +# Rules to configure and make the package.
    1.19 +compile_rules()
    1.20 +{
    1.21 +	cd $src
    1.22 +		while read patch_file; do
    1.23 +		if [ ! -f done.$patch_file ]; then
    1.24 +			patch -p1 < ../stuff/$patch_file || exit 1
    1.25 +			touch done.$patch_file
    1.26 +		fi
    1.27 +	done <<EOT
    1.28 +$PACKAGE-$VERSION-Makefile.u
    1.29 +EOT
    1.30 +	./configure --prefix=/usr --infodir=/usr/share/info \
    1.31 +	--localstatedir=/var \
    1.32 +	--datadir=/usr/share/nagios \
    1.33 +	--sysconfdir=/etc/nagios \
    1.34 +	--sbindir=/usr/lib/nagios \
    1.35 +	--bindir=/usr/bin \
    1.36 +	--libexecdir=/usr/lib/nagios/plugins \
    1.37 +	--with-nagios-user=nagios \
    1.38 +	--with-nagios-group=nagios \
    1.39 +	--with-nrpe-user=nagios \
    1.40 +	--with-nrpe-group=nagios \
    1.41 +	--mandir=/usr/share/man $CONFIGURE_ARGS &&
    1.42 +	make all &&
    1.43 +	make DESTDIR=$PWD/_pkg install
    1.44 +}
    1.45 +
    1.46 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.47 +genpkg_rules()
    1.48 +{
    1.49 +	mkdir -p $fs/etc/nagios/objects \
    1.50 +		$fs/etc/init.d \
    1.51 +	 	$fs/var/run/nagios
    1.52 +	
    1.53 +	cp -a $_pkg/usr $fs
    1.54 +	install -m 0644 $src/sample-config/nrpe.cfg $fs/etc/nagios
    1.55 +	sed -i 's|/var/run|/var/run/nagios|' $fs/etc/nagios/nrpe.cfg
    1.56 +	
    1.57 +	# Install config file nd init script
    1.58 +	install -o root -g root -m 644 stuff/nrpe.cfg $fs/etc/nagios/objects
    1.59 +	install -o root -g root -m 755 stuff/nrpe $fs/etc/init.d
    1.60 +}
    1.61 +
    1.62 +post_install()
    1.63 +{
    1.64 +	if ! grep -q nagios $1/etc/passwd; then
    1.65 +		echo -n "Adding user nagios..."
    1.66 +		chroot $1/ adduser -S -D -H nagios
    1.67 +		status
    1.68 +	fi
    1.69 +	
    1.70 +	# Set perms for files and directories
    1.71 +	chroot $1/ chown -R nagios.nagios /usr/lib/nagios/plugins  /var/run/nagios
    1.72 +	chroot $1/ chown  nagios.nagios /etc/nagios/* 
    1.73 +	
    1.74 +	# Add check_nrpe in nagios config file
    1.75 +	echo "cfg_file=/etc/nagios/objects/nrpe.cfg" >> $1/etc/nagios/nagios.cfg
    1.76 +}
    1.77 +
    1.78 +post_remove()
    1.79 +{
    1.80 +	[ -f $1/etc/nagios/nagios.cfg ] && sed -i 's/.*nrpe.cfg//' $1/etc/nagios/nagios.cfg
    1.81 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/nagios-nrpe/stuff/nagios-nrpe-2.12-Makefile.u	Wed Feb 02 01:17:51 2011 +0100
     2.3 @@ -0,0 +1,26 @@
     2.4 +--- nrpe-2.12-ori/Makefile.in	Wed Mar 14 16:30:05 2007
     2.5 ++++ nrpe-2.12/Makefile.in	Tue Jun  8 21:04:32 2010
     2.6 +@@ -20,8 +20,8 @@
     2.7 + SBINDIR=@sbindir@
     2.8 + LIBEXECDIR=@libexecdir@
     2.9 + INSTALL=@INSTALL@
    2.10 +-NAGIOS_INSTALL_OPTS=@NAGIOS_INSTALL_OPTS@
    2.11 +-NRPE_INSTALL_OPTS=@NRPE_INSTALL_OPTS@
    2.12 ++NAGIOS_INSTALL_OPTS=
    2.13 ++NRPE_INSTALL_OPTS=
    2.14 + 
    2.15 + INIT_DIR=@init_dir@
    2.16 + INIT_OPTS=-o root -g root
    2.17 +--- nrpe-2.12-ori/src/Makefile.in	Mon Aug 13 19:10:07 2007
    2.18 ++++ nrpe-2.12/src/Makefile.in	Tue Jun  8 21:16:02 2010
    2.19 +@@ -24,8 +24,8 @@
    2.20 + SBINDIR=@sbindir@
    2.21 + LIBEXECDIR=@libexecdir@
    2.22 + INSTALL=@INSTALL@
    2.23 +-NAGIOS_INSTALL_OPTS=@NAGIOS_INSTALL_OPTS@
    2.24 +-NRPE_INSTALL_OPTS=@NRPE_INSTALL_OPTS@
    2.25 ++NAGIOS_INSTALL_OPTS=
    2.26 ++NRPE_INSTALL_OPTS=
    2.27 + 
    2.28 + # Generated automatically from configure script
    2.29 + SNPRINTF_O=@SNPRINTF_O@
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/nagios-nrpe/stuff/nrpe	Wed Feb 02 01:17:51 2011 +0100
     3.3 @@ -0,0 +1,56 @@
     3.4 +#!/bin/sh
     3.5 +# /etc/init.d/nrpe : Start, stop and restart NRPE Server on SliTaz, at 
     3.6 +# boot time or with the command line.
     3.7 +#
     3.8 +# To start SSH server at boot time, just put nagios in the $RUN_DAEMONS
     3.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    3.10 +#
    3.11 +. /etc/init.d/rc.functions
    3.12 +. /etc/daemons.conf
    3.13 +
    3.14 +NAME=NRPE
    3.15 +DESC="NRPE daemon"
    3.16 +DAEMON=/usr/bin/nrpe
    3.17 +CONFIG_FILE="/etc/nagios/nrpe.cfg"
    3.18 +OPTIONS="-n -c $CONFIG_FILE -d"
    3.19 +PIDFILE=/var/run/nagios/nrpe.pid
    3.20 +
    3.21 +case "$1" in
    3.22 +  start)
    3.23 +    if active_pidfile $PIDFILE nrpe ; then
    3.24 +      echo "$NAME already running."
    3.25 +      exit 1
    3.26 +    fi
    3.27 +    echo -n "Starting $DESC: $NAME... "
    3.28 +	$DAEMON $OPTIONS
    3.29 +    status
    3.30 +    ;;
    3.31 +  stop)
    3.32 +    if ! active_pidfile $PIDFILE nrpe ; then
    3.33 +      echo "$NAME is not running."
    3.34 +      exit 1
    3.35 +    fi
    3.36 +    echo -n "Stopping $DESC: $NAME... "
    3.37 +    kill `cat $PIDFILE`
    3.38 +    status
    3.39 +    ;;
    3.40 +  restart|reload)
    3.41 +    if ! active_pidfile $PIDFILE nrpe ; then
    3.42 +      echo "$NAME is not running."
    3.43 +      exit 1
    3.44 +    fi
    3.45 +    echo -n "Restarting $DESC: $NAME... "
    3.46 +    kill `cat $PIDFILE`
    3.47 +    sleep 2
    3.48 +    $DAEMON $OPTIONS
    3.49 +    status
    3.50 +    ;;
    3.51 +  *)
    3.52 +    echo ""
    3.53 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
    3.54 +    echo ""
    3.55 +    exit 1
    3.56 +    ;;
    3.57 +esac
    3.58 +
    3.59 +exit 0
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/nagios-nrpe/stuff/nrpe.cfg	Wed Feb 02 01:17:51 2011 +0100
     4.3 @@ -0,0 +1,7 @@
     4.4 +####################################"
     4.5 +# NRPE Config
     4.6 +####################################"                                       
     4.7 +define command{                                                              
     4.8 +        command_name    check_nrpe                                             
     4.9 +        command_line    $USER1$/check_nrpe -n -H $HOSTADDRESS$ -c $ARG1$
    4.10 +}