[Pkg-nagios-changes] [SCM] debian packaging of PNP4Nagios branch, master, updated. v_0_6_11-2-12-g4935556

Sebastian Harl sh at tokkee.org
Wed Apr 27 07:37:19 UTC 2011


The following commit has been merged in the master branch:
commit 5b34e8552e6fce5288ef4721af50f334be2eec9d
Author: Sebastian Harl <sh at tokkee.org>
Date:   Wed Apr 27 09:08:49 2011 +0200

    -bin.pnp_gearman_worker.{default,init}: Init script for Gearman worker.
    
    The daemon is disabled by default.

diff --git a/debian/changelog b/debian/changelog
index ea12c32..90e8d5b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,8 +17,12 @@ pnp4nagios (0.6.12-1) unstable; urgency=low
   * debian/rules, debian/pnp4nagios-bin.install:
     - Do not install npcd.8 using dh_installman; this is done by the upstream
       Makefile now.
+  * debian/pnp4nagios-bin.pnp_gearman_worker.default,
+    pnp4nagios-bin.pnp_gearman_worker.init:
+    - Added init script for the PNP4Nagios Gearman worker daemon.
+    - The daemon is disabled by default.
 
- -- Sebastian Harl <tokkee at debian.org>  Tue, 26 Apr 2011 14:46:18 +0200
+ -- Sebastian Harl <tokkee at debian.org>  Wed, 27 Apr 2011 09:05:48 +0200
 
 pnp4nagios (0.6.11-2) unstable; urgency=low
 
diff --git a/debian/control b/debian/control
index eddedc8..962bd80 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Package: pnp4nagios-bin
 Architecture: any
 Depends: librrds-perl, adduser, ${shlibs:Depends}, ${misc:Depends}
 Recommends: pnp4nagios-web, nagios3 | icinga
-Suggests: rrdcached
+Suggests: rrdcached, perl, libgearman-client-perl, libcrypt-rijndael-perl
 Description: Nagios addon to create graphs from performance data (binaries)
  PNP is a graphing tool for Nagios that analyzes performance data provided by
  plugins and stores them automatically into Round Robin Databases (RRD). It
diff --git a/debian/copyright b/debian/copyright
index 2e27ac9..20c9e79 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -176,13 +176,20 @@ Copyright:
 License: BSD-2-clause
 
 Files:
- debian/pnp4nagios-bin.init
+ debian/pnp4nagios-bin.npcd.init
 Copyright:
  2007 Javier Fernandez-Sanguino <jfs at debian.org>
  2009 Sven Velt <sven at velt.de>
 License: BSD-2-clause
 
 Files:
+ debian/pnp4nagios-bin.pnp_gearman_worker.init
+Copyright:
+ 2007, Javier Fernandez-Sanguino <jfs at debian.org>
+ 2011, Sebastian Harl <tokkee at debian.org>
+License: BSD-2-clause
+
+Files:
  debian/po/de.po
 Copyright:
  2011, Sebastian Harl <tokkee at debian.org>
diff --git a/debian/pnp4nagios-bin.pnp_gearman_worker.default b/debian/pnp4nagios-bin.pnp_gearman_worker.default
new file mode 100644
index 0000000..f36af0d
--- /dev/null
+++ b/debian/pnp4nagios-bin.pnp_gearman_worker.default
@@ -0,0 +1,11 @@
+# Default settings for the pnp_gearman_worker init script.
+
+# Should the gearman worker daemon be started? ("yes" to enable)
+RUN="no"
+
+# Additional options that are passed to the daemon.
+DAEMON_OPTS="--config=/etc/pnp4nagios/process_perfdata.cfg"
+
+# Change to this user before starting the daemon.
+# Note: the daemon refuses to start as root.
+USER=nagios
diff --git a/debian/pnp4nagios-bin.npcd.init b/debian/pnp4nagios-bin.pnp_gearman_worker.init
similarity index 69%
copy from debian/pnp4nagios-bin.npcd.init
copy to debian/pnp4nagios-bin.pnp_gearman_worker.init
index d4d247a..e45120b 100644
--- a/debian/pnp4nagios-bin.npcd.init
+++ b/debian/pnp4nagios-bin.pnp_gearman_worker.init
@@ -1,31 +1,30 @@
 #!/bin/sh
 #
-# init.d script for NPCD of PNP4Nagios
+# init.d script for the Gearman worker daemon of PNP4Nagios
 #
-# Based on a example script of Javier Fernandez-Sanguino
+# Based on an example script for NPCD of Javier Fernandez-Sanguino
 # Copyright (c) 2007 Javier Fernandez-Sanguino <jfs at debian.org>
-# Copyright (c) 2009 Sven Velt <sven at velt.de>
+# Copyright (c) 2011 Sebastian Harl <tokkee at debian.org>
 #
 ### BEGIN INIT INFO
-# Provides:          npcd
+# Provides:          pnp_gearman_worker
 # Required-Start:    $network $local_fs $remote_fs
 # Required-Stop:     $network $local_fs $remote_fs
 # Should-Start:
 # Should-Stop:
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
-# Short-Description: Nagios Performance C Daemon
-# Description:       Speed up processing of Nagios' performance data
+# Short-Description: PNP4Nagios Gearman worker daemon
+# Description:       Processing of Nagios' perf data in distributed setups
 ### END INIT INFO
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
-DAEMON=/usr/sbin/npcd
-NAME=npcd
-DESC="Nagios Performance C Daemon (PNP4Nagios)"
-LOGDIR=/var/log/pnp4nagios
+DAEMON=/usr/lib/pnp4nagios/libexec/process_perfdata.pl
+NAME=pnp_gearman_worker
+DESC="PNP4Nagios Gearman worker daemon"
 
-PIDFILE=/var/run/$NAME.pid
+PIDFILE=/var/run/pnp4nagios/$NAME.pid
 
 test -x $DAEMON || exit 0
 
@@ -36,16 +35,14 @@ test -x $DAEMON || exit 0
 DAEMON_OPTS=""
 DIETIME=10
 STARTTIME=2
-LOGFILE=$LOGDIR/$NAME.log
+USER=nagios
 
-# Include defaults if available
-if [ -f /etc/default/npcd ] ; then
-	. /etc/default/npcd
+if [ -f /etc/default/pnp_gearman_worker ] ; then
+	. /etc/default/pnp_gearman_worker
 fi
 
-# Check if RUN is set to "yes" in /etc/defaults/npcd
 if [ "x$RUN" != "xyes" ] ; then
-	echo "$NAME has been disabled in /etc/default/npcd."
+	echo "$NAME has been disabled in /etc/default/pnp_gearman_worker."
 	exit 0
 fi
 
@@ -69,13 +66,36 @@ running() {
 	# No pidfile, probably no daemon present
 	[ ! -f "$PIDFILE" ] && return 1
 	pid=`cat $PIDFILE`
-	running_pid $pid $DAEMON || return 1
+	running_pid "$pid" $DAEMON \
+		|| running_pid "$pid" "/usr/bin/perl" || return 1
 	return 0
 }
 
 # Start the process using the wrapper
 start_server() {
-	start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
+	if ! perl -MGearman::Worker -e '1;' > /dev/null 2>&1 \
+			|| ! perl -MMIME::Base64 -e '1;' > /dev/null 2>&1 \
+			|| ! perl -MCrypt::Rijndael -e '1;' > /dev/null 2>&1; then
+		echo "$NAME requires the Gearman::Worker, MIME::Base64 and" >&2
+		echo "Crypt::Rijndael Perl modules. Make sure that the packages" >&2
+		echo "perl, libgearman-client-perl and libcrypt-rijndael-perl" >&2
+		echo "are installed." >&2
+		exit 1
+	fi
+
+	if [ -d /var/run/pnp4nagios ]; then
+		chmod 755 /var/run/pnp4nagios
+		chown nagios.nagios /var/run/pnp4nagios
+	else
+		install -d -m 755 -o nagios -g nagios /var/run/pnp4nagios
+	fi
+
+	start_opts="--start --quiet --oknodo --pidfile $PIDFILE"
+	if [ -n "$USER" ]; then
+		start_opts="$start_opts --chuid $USER"
+	fi
+	start-stop-daemon $start_opts --exec $DAEMON -- \
+		--pidfile=$PIDFILE --gearman --daemon $DAEMON_OPTS
 	errcode=$?
 	return $errcode
 }
@@ -87,14 +107,6 @@ stop_server() {
 	return $errcode
 }
 
-reload_server() {
-	[ ! -f "$PIDFILE" ] && return 1
-	pid=pidofproc $PIDFILE # This is the daemon's pid
-	# Send a SIGHUP
-	kill -1 $pid
-	return $?
-}
-
 # Force the process to die killing it manually
 force_stop() {
 	[ ! -e "$PIDFILE" ] && return
@@ -188,12 +200,6 @@ case "$1" in
 			exit 1
 		fi
 		;;
-		# Use this if the daemon cannot reload
-		reload)
-		log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
-		log_warning_msg "cannot re-read the config file (use restart)."
-		exit 1
-		;;
 	*)
 		N=/etc/init.d/$NAME
 		echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
diff --git a/debian/rules b/debian/rules
index 18526be..9f9611a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -182,6 +182,7 @@ binary-arch: build install
 	dh_installexamples -a
 	dh_installdebconf -a
 	dh_installinit -ppnp4nagios-bin --name=npcd
+	dh_installinit -ppnp4nagios-bin --name=pnp_gearman_worker
 	dh_installman -a
 	dh_link -a
 	dh_strip -a

-- 
debian packaging of PNP4Nagios



More information about the Pkg-nagios-changes mailing list