Code

Initial commit, version 0.6.3
authorSven Velt <sven@velt.de>
Thu, 13 Jan 2011 11:00:00 +0000 (12:00 +0100)
committerSven Velt <sven@velt.de>
Thu, 13 Jan 2011 11:00:00 +0000 (12:00 +0100)
Signed-off-by: Sven Velt <sven@velt.de>
15 files changed:
debian/README.Debian [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/check_commands/check_nrpe.cfg [new file with mode: 0644]
debian/check_commands/check_nrpe_1arg.cfg [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/nagios.cfg [new file with mode: 0644]
debian/pnp4nagios.default [new file with mode: 0644]
debian/pnp4nagios.init [new file with mode: 0644]
debian/postinst [new file with mode: 0644]
debian/postrm [new file with mode: 0644]
debian/rules [new file with mode: 0644]

diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644 (file)
index 0000000..d4d1fd7
--- /dev/null
@@ -0,0 +1,26 @@
+pnp4nagios for Debian
+---------------------
+
+The Debian package of PNP4Nagios uses NPCD for an easy installation *and* fast
+processing of performance data.
+
+Please change the "process_performance_data" statement in
+"/etc/nagios3/nagios.cfg" to "process_performance_data=1".
+
+Add the following line (without quotes) to "/etc/nagios3/nagios.cfg":
+
+"broker_module=/usr/lib/pnp4nagios/npcdmod.o config_file=/etc/pnp4nagios/npcd.cfg"
+
+Finally reload your Nagios server by "/etc/init.d/nagios3 reload". All
+performance date should be processed.
+
+If you want links to PNP4Nagios for your monitored hosts and services in Nagios
+web frontend just add 
+
+- "action_url  /pnp4nagios/graph?host=$HOSTNAME$"
+  to your hosts or host template(s)
+
+- "action_url  /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
+  to your services or service template(s)
+
+ -- Sven Velt <sven@velt.de>  Wed, 30 Sep 2009 13:55:35 +0000
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..43c2923
--- /dev/null
@@ -0,0 +1,6 @@
+pnp4nagios (0.6.3-1) unstable; urgency=low
+
+  * Initial release (Closes: #479031)
+
+ -- Sven Velt <sven@velt.de>  Fri, 27 Nov 2009 21:08:18 +0100
+
diff --git a/debian/check_commands/check_nrpe.cfg b/debian/check_commands/check_nrpe.cfg
new file mode 100644 (file)
index 0000000..bbc0ec5
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Adapt the Template if check_command should not be the PNP Template
+#
+# check_command check_nrpe!check_disk!20%!10%
+# ________0__________|          |      |  |
+# ________1_____________________|      |  |
+# ________2____________________________|  |
+# ________3_______________________________|
+#
+CUSTOM_TEMPLATE = 1
+#
+# Change the RRD Datatype based on the check_command Name.
+# Defaults to GAUGE.
+#
+# DATATYPE = COUNTER
diff --git a/debian/check_commands/check_nrpe_1arg.cfg b/debian/check_commands/check_nrpe_1arg.cfg
new file mode 100644 (file)
index 0000000..bbc0ec5
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# Adapt the Template if check_command should not be the PNP Template
+#
+# check_command check_nrpe!check_disk!20%!10%
+# ________0__________|          |      |  |
+# ________1_____________________|      |  |
+# ________2____________________________|  |
+# ________3_______________________________|
+#
+CUSTOM_TEMPLATE = 1
+#
+# Change the RRD Datatype based on the check_command Name.
+# Defaults to GAUGE.
+#
+# DATATYPE = COUNTER
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7f8f011
--- /dev/null
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..941bac4
--- /dev/null
@@ -0,0 +1,21 @@
+Source: pnp4nagios
+Section: net
+Priority: extra
+Maintainer: Sven Velt <sven@velt.de>
+Build-Depends: debhelper (>= 7), rrdtool, librrds-perl
+Standards-Version: 3.8.0
+Homepage: http://pnp4nagios.org
+
+Package: pnp4nagios
+Architecture: any
+Depends: rrdtool, librrds-perl, libapache2-mod-php5 | php5, php5-gd, libkohana-php, adduser, ${shlibs:Depends}, ${misc:Depends}
+Suggests: 
+Description: Nagios Addon to create graphs out of performance data
+ PNP is a tool that produces graphs from performance data from Nagios
+ plugins.
+ .
+ PNP stores the performance data from each service into Round Robin Databases,
+ this data can displayed as a graph using PHP within your Nagios Monitoring
+ Website.
+ .
+ PNP's goal is to be easily configured and it should work out of the box.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..d9da461
--- /dev/null
@@ -0,0 +1,35 @@
+This package was debianized by Sven Velt <sven@velt.de> on
+Wed, 30 Sep 2009 13:55:35 +0200.
+
+It was downloaded from http://www.pnp4nagios.org
+
+Upstream Author:
+
+    Jörg Line <pitchfork@ederdrom.de>
+
+Copyright:
+
+    Copyright (C) 2006-2009 Jörg Linge
+
+License:
+
+    This package is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This package is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this package; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2009, Sven Velt <sven@velt.de> and
+is licensed under the GPL, see above.
+
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..1e4d277
--- /dev/null
@@ -0,0 +1,2 @@
+usr/sbin
+usr/share/doc/pnp4nagios/examples/
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..e845566
--- /dev/null
@@ -0,0 +1 @@
+README
diff --git a/debian/nagios.cfg b/debian/nagios.cfg
new file mode 100644 (file)
index 0000000..3d7d1e3
--- /dev/null
@@ -0,0 +1,34 @@
+define command {
+       command_name    pnp-synchronous-service
+       command_line    /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl
+}
+
+define command {
+       command_name    pnp-synchronous-host
+       command_line    /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
+}
+
+##############################################################################
+
+define command{
+       command_name    pnp-bulk-service
+       command_line    /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl --bulk=/var/spool/pnp4nagios/nagios/service-perfdata
+}
+
+define command{
+       command_name    pnp-bulk-host
+       command_line    /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl --bulk=/var/spool/pnp4nagios/nagios/host-perfdata
+}
+
+##############################################################################
+
+define command{
+       command_name    pnp-bulknpcd-service
+       command_line    /bin/mv /var/spool/pnp4nagios/nagios/service-perfdata /var/spool/pnp4nagios/npcd/service-perfdata.$TIMET$
+}
+
+define command{
+       command_name    pnp-bulknpcd-host
+       command_line    /bin/mv /var/spool/pnp4nagios/nagios/host-perfdata /var/spool/pnp4nagios/npcd/host-perfdata.$TIMET$
+}
+
diff --git a/debian/pnp4nagios.default b/debian/pnp4nagios.default
new file mode 100644 (file)
index 0000000..16f26e4
--- /dev/null
@@ -0,0 +1,13 @@
+# Defaults for pnp4nagios initscript
+# sourced by /etc/init.d/pnp4nagios
+# installed at /etc/default/pnp4nagios by the maintainer scripts
+
+#
+# This is a POSIX shell fragment
+#
+
+# Should NPCD be started? Only "yes" is valid
+RUN="yes"
+
+# Additional options that are passed to the Daemon.
+DAEMON_OPTS="-d -f /etc/pnp4nagios/npcd.cfg"
diff --git a/debian/pnp4nagios.init b/debian/pnp4nagios.init
new file mode 100644 (file)
index 0000000..0021d0f
--- /dev/null
@@ -0,0 +1,231 @@
+#!/bin/sh
+#
+# init.d script for NPCD of PNP4Nagios
+#
+# Based on a example script of Javier Fernandez-Sanguino
+# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
+# Copyright (c) 2009 Sven Velt <sven@velt.de>
+#
+### BEGIN INIT INFO
+# Provides:          pnp4nagios
+# 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
+### 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
+
+PIDFILE=/var/run/$NAME.pid
+
+test -x $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+# Default options, these can be overriden by the information
+# at /etc/default/$NAME
+DAEMON_OPTS=""
+DIETIME=10
+STARTTIME=2
+LOGFILE=$LOGDIR/$NAME.log
+
+# Include defaults if available
+if [ -f /etc/default/pnp4nagios ] ; then
+       . /etc/default/pnp4nagios
+fi
+
+# Check if RUN is set to "yes" in /etc/defaults/pnp4nagios
+if [ "x$RUN" != "xyes" ] ; then
+#    log_failure_msg "$NAME disabled, please adjust the configuration to your needs "
+#    log_failure_msg "and then set RUN to 'yes' in /etc/default/$NAME to enable it."
+    exit 0
+fi
+
+set -e
+
+running_pid() {
+# Check if a given process pid's cmdline matches a given name
+    pid=$1
+    name=$2
+    [ -z "$pid" ] && return 1
+    [ ! -d /proc/$pid ] &&  return 1
+    cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
+    # Is this the expected server
+    [ "$cmd" != "$name" ] &&  return 1
+    return 0
+}
+
+running() {
+# Check if the process is running looking at /proc
+# (works for all users)
+
+    # No pidfile, probably no daemon present
+    [ ! -f "$PIDFILE" ] && return 1
+    pid=`cat $PIDFILE`
+    running_pid $pid $DAEMON || return 1
+    return 0
+}
+
+start_server() {
+# Start the process using the wrapper
+        start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
+        errcode=$?
+        return $errcode
+}
+
+stop_server() {
+# Stop the process using the wrapper
+        killproc -p $PIDFILE $DAEMON
+        errcode=$?
+       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_stop() {
+# Force the process to die killing it manually
+       [ ! -e "$PIDFILE" ] && return
+       if running ; then
+               kill -15 $pid
+       # Is it really dead?
+               sleep "$DIETIME"s
+               if running ; then
+                       kill -9 $pid
+                       sleep "$DIETIME"s
+                       if running ; then
+                               echo "Cannot kill $NAME (pid=$pid)!"
+                               exit 1
+                       fi
+               fi
+       fi
+       rm -f $PIDFILE
+}
+
+
+case "$1" in
+  start)
+       log_daemon_msg "Starting $DESC " "$NAME"
+        # Check if it's running first
+        if running ;  then
+            log_progress_msg "apparently already running"
+            log_end_msg 0
+            exit 0
+        fi
+        if start_server ; then
+            # NOTE: Some servers might die some time after they start,
+            # this code will detect this issue if STARTTIME is set
+            # to a reasonable value
+            [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time 
+            if  running ;  then
+                # It's ok, the server started and is running
+                log_end_msg 0
+            else
+                # It is not running after we did start
+                log_end_msg 1
+            fi
+        else
+            # Either we could not start it
+            log_end_msg 1
+        fi
+       ;;
+  stop)
+        log_daemon_msg "Stopping $DESC" "$NAME"
+        if running ; then
+            # Only stop the server if we see it running
+                       errcode=0
+            stop_server || errcode=$?
+            log_end_msg $errcode
+        else
+            # If it's not running don't do anything
+            log_progress_msg "apparently not running"
+            log_end_msg 0
+            exit 0
+        fi
+        ;;
+  force-stop)
+        # First try to stop gracefully the program
+        $0 stop
+        if running; then
+            # If it's still running try to kill it more forcefully
+            log_daemon_msg "Stopping (force) $DESC" "$NAME"
+                       errcode=0
+            force_stop || errcode=$?
+            log_end_msg $errcode
+        fi
+       ;;
+  restart|force-reload)
+        log_daemon_msg "Restarting $DESC" "$NAME"
+               errcode=0
+        stop_server || errcode=$?
+        # Wait some sensible amount, some server need this
+        [ -n "$DIETIME" ] && sleep $DIETIME
+        start_server || errcode=$?
+        [ -n "$STARTTIME" ] && sleep $STARTTIME
+        running || errcode=$?
+        log_end_msg $errcode
+       ;;
+  status)
+
+        log_daemon_msg "Checking status of $DESC" "$NAME"
+        if running ;  then
+            log_progress_msg "running"
+            log_end_msg 0
+        else
+            log_progress_msg "apparently not running"
+            log_end_msg 1
+            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)."
+        ;;
+  # And this if it cann
+  #reload)
+          #
+          # If the daemon can reload its config files on the fly
+          # for example by sending it SIGHUP, do it here.
+          #
+          # If the daemon responds to changes in its config file
+          # directly anyway, make this a do-nothing entry.
+          #
+          # log_daemon_msg "Reloading $DESC configuration files" "$NAME"
+          # if running ; then
+          #    reload_server
+          #    if ! running ;  then
+          # Process died after we tried to reload
+          #       log_progress_msg "died on reload"
+          #       log_end_msg 1
+          #       exit 1
+          #    fi
+          # else
+          #    log_progress_msg "server is not running"
+          #    log_end_msg 1
+          #    exit 1
+          # fi
+                                                                                    #;;
+
+  *)
+       N=/etc/init.d/$NAME
+       echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
+       exit 1
+       ;;
+esac
+
+exit 0
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..3ed650d
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/sh
+# postinst script for pnp4nagios
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+setperm() {
+       user="$1"
+       group="$2"
+       mode="$3"
+       file="$4"
+       shift 4
+       # only do something when no setting exists
+       if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
+               chown "$user":"$group" "$file"
+               chmod "$mode" "$file"
+       fi
+}
+
+case "$1" in
+       configure)
+               if ! getent passwd nagios > /dev/null ; then
+                       echo 'Adding system-user for nagios' 1>&2
+                       adduser --system --group --home /var/run/nagios3 --no-create-home \
+                       --disabled-login --force-badname nagios > /dev/null
+               fi
+               setperm nagios www-data 750 /var/lib/pnp4nagios
+               setperm nagios nagios   755 /var/lib/pnp4nagios/perfdata
+               setperm nagios www-data 750 /var/log/pnp4nagios
+               setperm nagios nagios   750 /var/log/pnp4nagios/stats
+               setperm nagios nagios   770 /var/spool/pnp4nagios
+               setperm nagios nagios   770 /var/spool/pnp4nagios/nagios
+               setperm nagios nagios   770 /var/spool/pnp4nagios/npcd
+
+               if [ -d /etc/nagios3/conf.d/ ]; then
+                       if [ ! -e /etc/nagios3/conf.d/pnp4nagios.cfg ]; then
+                               ln -s /etc/pnp4nagios/nagios.cfg /etc/nagios3/conf.d/pnp4nagios.cfg
+                       fi
+               fi
+
+               a2reload="false"
+
+               if [ -d /etc/apache2/conf.d/ ]; then
+                       if [ ! -e /etc/apache2/conf.d/pnp4nagios.conf ]; then
+                               ln -s /etc/pnp4nagios/apache.conf /etc/apache2/conf.d/pnp4nagios.conf
+                               a2reload="true"
+                       fi
+               fi
+
+               if [ -d /etc/apache2/mods-enabled ]; then
+                       if [ ! -e /etc/apache2/mods-enabled/rewrite.load ]; then
+                               a2enmod rewrite
+                               a2reload="true"
+                       fi
+               fi
+
+               if [ "$a2reload" = "true" ]; then
+                       invoke-rc.d apache2 reload
+               fi
+       ;;
+
+       abort-upgrade|abort-remove|abort-deconfigure)
+       ;;
+
+       *)
+               echo "postinst called with unknown argument \`$1'" >&2
+               exit 1
+       ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/postrm b/debian/postrm
new file mode 100644 (file)
index 0000000..d8f0d3e
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh
+# postrm script for pnp4nagios
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+       purge|remove)
+               if [ -d /etc/nagios3/conf.d/ ]; then
+                       if [ -L /etc/nagios3/conf.d/pnp4nagios.cfg ]; then
+                               ls -l /etc/nagios3/conf.d/pnp4nagios.cfg | grep -q /etc/pnp4nagios/nagios.cfg
+                               if [ $? -eq 0 ]; then
+                                       rm -f /etc/nagios3/conf.d/pnp4nagios.cfg
+                               fi
+                       fi
+               fi
+
+               if [ -d /etc/apache2/conf.d/ ]; then
+                       if [ -L /etc/apache2/conf.d/pnp4nagios.cfg ]; then
+                               ls -l /etc/apache2/conf.d/pnp4nagios.cfg | grep -q /etc/pnp4nagios/apache.cfg
+                               if [ $? -eq 0 ]; then
+                                       rm -f /etc/apache2/conf.d/pnp4nagios.cfg
+                               fi
+                       fi
+               fi
+       ;;
+       upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+       ;;
+
+       *)
+               echo "postrm called with unknown argument \`$1'" >&2
+               exit 1
+       ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/rules b/debian/rules
new file mode 100644 (file)
index 0000000..7643f57
--- /dev/null
@@ -0,0 +1,182 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+else
+CROSS= --build $(DEB_BUILD_GNU_TYPE)
+endif
+
+
+
+config.status: configure
+       dh_testdir
+       # Add here commands to configure the package.
+#ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+#      cp -f /usr/share/misc/config.sub config.sub
+#endif
+#ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+#      cp -f /usr/share/misc/config.guess config.guess
+#endif
+       ./configure $(CROSS)    --with-layout=debian \
+                               --prefix=/usr \
+                               --mandir=\$${prefix}/share/man \
+                               --infodir=\$${prefix}/share/info \
+                               --without-kohana \
+                               --with-kohana_system=/usr/share/php/kohana/system \
+                               CFLAGS="$(CFLAGS)"
+
+
+build: build-stamp
+
+build-stamp:  config.status 
+       dh_testdir
+
+       # Add here commands to compile the package.
+       $(MAKE) all
+
+       touch $@
+
+clean: 
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp 
+
+       # Add here commands to clean up after the build process.
+       [ ! -f Makefile ] || $(MAKE) distclean
+#      rm -f config.sub config.guess
+
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_prep
+       dh_installdirs
+
+       # Add here commands to install the package into debian/pnp4nagios.
+       # mkdir -p $(CURDIR)/debian/pnp4nagios/etc/apache2/conf.d/
+       $(MAKE) DESTDIR=$(CURDIR)/debian/pnp4nagios INSTALL_OPTS="-o root -g root" install install-config
+       
+       # Ignore install.php (for future debugging don't delete it)
+       touch $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/install.ignore
+       
+       # Move template config dir to /etc/pnp4nagios/templates
+       mv $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/templates $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/
+#      ln -s ../../../../etc/pnp4nagios/templates $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/templates
+       dh_link /etc/pnp4nagios/templates /usr/share/pnp4nagios/html/templates
+
+       # Move npcd and npcdmod.o to right path
+       mv $(CURDIR)/debian/pnp4nagios/usr/bin/npcd \
+               $(CURDIR)/debian/pnp4nagios/usr/sbin/
+
+       mv $(CURDIR)/debian/pnp4nagios/usr/bin/npcdmod.o \
+               $(CURDIR)/debian/pnp4nagios/usr/lib/pnp4nagios/
+
+       rmdir $(CURDIR)/debian/pnp4nagios/usr/bin
+
+       # Copy, rename and fix sample configs and examples
+       sed -i -e 's#/nagios/cgi-bin#/cgi-bin/nagios3#' $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/config.php
+
+       mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg-sample \
+               $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg
+       sed -i -e 's#/var/spool/pnp4nagios/#&npcd/#' \
+               -e 's#/var/log/pnp4nagios/perfdata.dump#/var/spool/pnp4nagios/nagios/perfdata.dump#' \
+               $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg
+
+       mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg-sample \
+               $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg
+       sed -i -e 's/TIMEOUT = 5/TIMEOUT = 15/' \
+               $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg
+
+       mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg-sample \
+               $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg
+
+       mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/nagios.cfg-sample \
+               $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/nagios.cfg
+
+       mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/misccommands.cfg-sample \
+               $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/misccommands.cfg
+
+       mkdir $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands
+       mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/check_nwstat.cfg-sample \
+               $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands/check_nwstat.cfg
+
+       mkdir $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages
+       mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/pages/web_traffic.cfg-sample \
+               $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages/web_traffic.cfg
+
+       cp -av $(CURDIR)/contrib/ssi $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/
+
+       # Add Debian specific config and placeholder files
+       touch $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/pages/.placeholder
+       cp -av $(CURDIR)/debian/nagios.cfg $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/
+       cp -av $(CURDIR)/debian/check_commands/* $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/
+
+       # Apache config file
+       # FIXME
+       sed -i 's#/usr/local/nagios/etc/htpasswd.users#/etc/nagios3/htpasswd.users#'  $(CURDIR)/sample-config/httpd.conf
+       cp -av $(CURDIR)/sample-config/httpd.conf $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/apache.conf
+
+       # Add subdirs to /var/spool/pnp4nagios/ to prepare for different modes
+       mkdir $(CURDIR)/debian/pnp4nagios/var/spool/pnp4nagios/nagios
+       mkdir $(CURDIR)/debian/pnp4nagios/var/spool/pnp4nagios/npcd
+
+       # Delete not used and empty directories
+       rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/logs/
+       rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/cache/
+       rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/hooks/
+       rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/libraries/
+
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs ChangeLog
+       dh_installdocs
+       dh_installexamples
+#      dh_install
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+       dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+#      dh_perl
+#      dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install