[Pkg-nagios-changes] [pkg-nsca-ng] 04/04: Add systemd support
Alexander Wirt
formorer at debian.org
Fri Oct 17 12:47:27 UTC 2014
This is an automated email from the git hooks/post-receive script.
formorer pushed a commit to branch master
in repository pkg-nsca-ng.
commit af0c838f5602d5c07f6132e650b5f17841bf349f
Author: Alexander Wirt <formorer at debian.org>
Date: Fri Oct 17 14:47:16 2014 +0200
Add systemd support
---
debian/control | 5 ++++-
debian/nsca-ng-server.default | 7 ------
debian/nsca-ng-server.service | 16 +++++++++++++
debian/nsca-ng-server.socket | 10 +++++++++
debian/patches/fix_systemd_support | 46 ++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
debian/rules | 2 +-
etc/nsca-ng.cfg | 24 +++++++++++++++++++-
8 files changed, 101 insertions(+), 10 deletions(-)
diff --git a/debian/control b/debian/control
index 239c47a..81ae8ce 100644
--- a/debian/control
+++ b/debian/control
@@ -4,10 +4,13 @@ Priority: extra
Maintainer: Alexander Wirt <formorer at debian.org>
Build-Depends: autotools-dev,
debhelper (>= 9),
+ dh-autoreconf,
+ dh-systemd,
libconfuse-dev,
libev-dev,
libbsd-dev,
- libssl-dev
+ libssl-dev,
+ libsystemd-dev
Standards-Version: 3.9.3
Homepage: http://www.nsca-ng.org/
diff --git a/debian/nsca-ng-server.default b/debian/nsca-ng-server.default
deleted file mode 100644
index 479d056..0000000
--- a/debian/nsca-ng-server.default
+++ /dev/null
@@ -1,7 +0,0 @@
-# /etc/default/nsca-ng
-
-# Please read /usr/share/doc/nsca-ng-server/README.Debian for information
-# how to get nsca-ng working
-
-# start nsca-ng daemon (no/yes)
-NSCA_NG=no
diff --git a/debian/nsca-ng-server.service b/debian/nsca-ng-server.service
new file mode 100644
index 0000000..e21d2dc
--- /dev/null
+++ b/debian/nsca-ng-server.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Monitoring Command Acceptor
+Documentation=man:nsca-ng(8) man:nsca-ng.cfg(5)
+Requires=nsca-ng-server.socket
+
+[Service]
+ExecStart=/usr/sbin/nsca-ng -c /etc/nsca-ng/nsca-ng.cfg
+Type=notify
+StandardError=syslog
+NonBlocking=true
+Restart=on-failure
+# Don't use this with systemd < 207 (see Red Hat bug #982379):
+WatchdogSec=30
+
+[Install]
+Also=nsca-ng-server.socket
diff --git a/debian/nsca-ng-server.socket b/debian/nsca-ng-server.socket
new file mode 100644
index 0000000..937e153
--- /dev/null
+++ b/debian/nsca-ng-server.socket
@@ -0,0 +1,10 @@
+[Unit]
+Description=NSCA-ng Socket
+Documentation=man:nsca-ng(8) man:nsca-ng.cfg(5)
+
+[Socket]
+ListenStream=5668
+BindIPv6Only=both
+
+[Install]
+WantedBy=sockets.target
diff --git a/debian/patches/fix_systemd_support b/debian/patches/fix_systemd_support
new file mode 100644
index 0000000..7ed46e2
--- /dev/null
+++ b/debian/patches/fix_systemd_support
@@ -0,0 +1,46 @@
+From 7466e0772cafdc7fc6f4fc062b45f1f116b429a5 Mon Sep 17 00:00:00 2001
+From: Holger Weiß <holger at weiss.in-berlin.de>
+Date: Fri, 17 Oct 2014 08:15:16 +0100
+Subject: Use libsystemd instead of libsystemd-daemon
+
+With systemd(1) version 210, libsystemd-daemon has been merged into
+libsystemd.
+---
+diff --git a/m4/systemd.m4 b/m4/systemd.m4
+index 019a37b..bc251c0 100644
+--- a/m4/systemd.m4
++++ b/m4/systemd.m4
+@@ -24,11 +24,11 @@
+
+ # NSCA_LIB_SYSTEMD
+ # ----------------
+-# Check the availability of systemd. If the systemd-daemon library is found, we
+-# define HAVE_SYSTEMD_SD_DAEMON_H to 1. We then also set the output variables
+-# SYSTEMDCPPFLAGS, SYSTEMDLDFLAGS, and SYSTEMDLIBS to appropriate values. (Why
+-# are there no underscores in these variable names? Because Automake treats
+-# names like "foo_CPPFLAGS" specially.)
++# Check the availability of systemd. If the systemd (or the old systemd-daemon)
++# library is found, we define HAVE_SYSTEMD_SD_DAEMON_H to 1. We then also set
++# the output variables SYSTEMDCPPFLAGS, SYSTEMDLDFLAGS, and SYSTEMDLIBS to
++# appropriate values. (Why are there no underscores in these variable names?
++# Because Automake treats names like "foo_CPPFLAGS" specially.)
+ AC_DEFUN([NSCA_LIB_SYSTEMD],
+ [
+ nsca_save_CPPFLAGS=$CPPFLAGS
+@@ -71,9 +71,11 @@ AC_DEFUN([NSCA_LIB_SYSTEMD],
+ LDFLAGS="$SYSTEMDLDFLAGS $LDFLAGS"])
+ AC_CHECK_HEADERS([systemd/sd-daemon.h], [],
+ [AC_MSG_ERROR([systemd header file not found])])
+- AC_CHECK_LIB([systemd-daemon], [sd_notify],
+- [SYSTEMDLIBS='-lsystemd-daemon'],
+- [AC_MSG_FAILURE([cannot link with systemd-daemon library])])])
++ AC_CHECK_LIB([systemd], [sd_notify],
++ [SYSTEMDLIBS='-lsystemd'],
++ [AC_CHECK_LIB([systemd-daemon], [sd_notify],
++ [SYSTEMDLIBS='-lsystemd-daemon'],
++ [AC_MSG_FAILURE([cannot link with systemd-daemon library])])])])
+ AC_SUBST([SYSTEMDCPPFLAGS])
+ AC_SUBST([SYSTEMDLDFLAGS])
+ AC_SUBST([SYSTEMDLIBS])
+--
+cgit v0.9.1-5-gbcb6
diff --git a/debian/patches/series b/debian/patches/series
index dd208f1..018dd4f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
nsca-ng.cfg_debian_config
+fix_systemd_support
diff --git a/debian/rules b/debian/rules
index 27483c8..78ed640 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,7 +10,7 @@
#export DH_VERBOSE=1
%:
- dh $@ --with autotools-dev
+ dh $@ --with autotools-dev,autoreconf,systemd
override_dh_auto_clean:
-rm config.log
diff --git a/etc/nsca-ng.cfg b/etc/nsca-ng.cfg
index 95239ad..8460d6f 100644
--- a/etc/nsca-ng.cfg
+++ b/etc/nsca-ng.cfg
@@ -8,9 +8,28 @@
#
# Most probably, you'll have to specify the path to the Nagios command file.
#
-command_file = "/usr/local/nagios/var/rw/nagios.cmd"
+
+# command_file for nagios3
+command_file = "/var/lib/nagios3/rw/nagios.cmd"
+
+# command_file for icinga
+#command_file= "/var/lib/icinga/rw/icinga.cmd"
+
+# Debian specific settings
+listen = "localhost:5668" # only listen on localhost. If you use systemd this
+ # this option is overriden by the
+ # nsca-ng-server.socket file.
+
+user = "nagios" # run as user nagios
+pid_file = "/var/run/nsca-ng/nsca-ng.pid" # pid file for nsca-ng
#
+# local configuration:
+# if you'd prefer, you can instead place directives here
+include(/etc/nsca-ng/nsca-ng.local.cfg)
+
+#
+#
# These configuration settings are optional.
#
# listen = "monitoring.example.com:5668" # Default: "*".
@@ -105,6 +124,9 @@ command_file = "/usr/local/nagios/var/rw/nagios.cmd"
# commands), at least one "commands", "hosts", and/or "services" expression must
# be specified.
#
+# This authorization line only allows pinging of the server, but you probably
+# want to change the password if you go into production
+
authorize "*" {
password = "change-me"
#
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nsca-ng.git
More information about the Pkg-nagios-changes
mailing list