[Pkg-nagios-devel] Bug#639523: "/etc/init.d/nagios-nrpe-server stop" unintentionally kills NRPE daemon running inside LXC containers

Dirk Weinhardt report01 at weinhardt.biz
Sat Aug 27 19:34:42 UTC 2011


Package: nagios-nrpe-server
Version: 2.12-4
Severity: minor

On a server that hosts virtual servers running inside LXC containers I found the following issue:
Executing "/etc/init.d/nagios-nrpe-server stop" on the underlying host stops all NRPE daemons, the one
of the underlying host as well as all NRPE daemons running inside LXC containers.

I would expect "/etc/init.d/nagios-nrpe-server stop" to not stop NRPE daemons running inside LXC
containers but to only stop the underlying host's NRPE daemon.

"ps aux | grep nrpe" output of the underlying host:
nagios    1447  0.0  0.0  24740  1144 ?        Ss   20:39   0:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
101      16768  0.0  0.0  24740  1108 ?        Ss   17:49   0:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d

PID 1447 is the host's NRPE daemon, 16768 is an LXC container's NRPE daemon. 101 is the uid of the nagios
user inside this LXC container.

Running "/etc/init.d/nagios-nrpe-server stop" seems to kill both these NRPE daemons due to --exec being
used. I have substituted --pidfile $PIDDIR/nrpe.pid for --exec $DAEMON and moved deletion of the pid
file to the start) section as a work-around. Works for me but is not thoroughly tested. There may be
side effects I am not aware of.

Here is how I patched the init script:

--- nagios-nrpe-server.orig     2011-08-27 18:11:24.000000000 +0200
+++ nagios-nrpe-server  2011-08-27 20:56:28.000000000 +0200
@@ -46,8 +46,6 @@
        chown nagios "$PIDDIR"
 fi

-test -e $PIDDIR/nrpe.pid && rm $PIDDIR/nrpe.pid
-
 set -e

 case "$1" in
@@ -55,18 +53,19 @@
        if [ "$INETD" = 1 ]; then
                exit 1
        fi
+       test -e $PIDDIR/nrpe.pid && rm $PIDDIR/nrpe.pid
        log_daemon_msg "Starting $DESC" "$NAME"
        start_daemon $NICENESS $DAEMON -c $CONFIG -d $DAEMON_OPTS
        log_end_msg $?
        ;;
   stop)
        log_daemon_msg "Stopping $DESC" "$NAME"
-       start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
+       start-stop-daemon --stop --quiet --oknodo --pidfile $PIDDIR/nrpe.pid
        log_end_msg $?
        ;;
   reload|force-reload)
        log_daemon_msg "Reloading $DESC configuration files" "$NAME"
-       start-stop-daemon --stop --signal HUP --quiet --exec $DAEMON
+       start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDDIR/nrpe.pid
        log_end_msg $?
        ;;
   restart)



-- System Information:
Debian Release: 6.0.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.39-bpo.2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages nagios-nrpe-server depends on:
ii  adduser                 3.112+nmu2       add and remove users and groups
ii  libc6                   2.11.2-10        Embedded GNU C Library: Shared lib
ii  libssl0.9.8             0.9.8o-4squeeze1 SSL shared libraries
ii  libwrap0                7.6.q-19         Wietse Venema's TCP wrappers libra
ii  lsb-base                3.2-23.2squeeze1 Linux Standard Base 3.2 init scrip

Versions of packages nagios-nrpe-server recommends:
ii  nagios-plugins          1.4.15-3squeeze1 Plugins for the nagios network mon
ii  nagios-plugins-basic    1.4.15-3squeeze1 Plugins for the nagios network mon

nagios-nrpe-server suggests no packages.

-- Configuration Files:
/etc/init.d/nagios-nrpe-server changed [not included]
/etc/nagios/nrpe.cfg changed [not included]
/etc/nagios/nrpe_local.cfg changed [not included]

-- no debconf information





More information about the Pkg-nagios-devel mailing list