[Pkg-net-snmp-devel] Bug#815142: snmpd: dose not start snmpd when LXC containers (running snmpd process inside it) exists
Genta IHA
genta at ate-mahoroba.jp
Fri Feb 19 10:19:03 UTC 2016
Package: snmpd
Version: 5.7.2.1+dfsg-1
Severity: normal
Tags: patch
Dear Maintainer,
We are managing a Debian box running some LXC containers.
These LXC containers have a running snmpd process.
These snmp process in LXC containers are visible from the host.
Example:
---- cut here ----
lxc-host:~$ sudo lxc-ls --running
debian8
('init' of the container "debian8" is running PID 27570)
lxc-host:~$ sudo ps xa|grep ini[t]
1 ? Ss 0:04 /sbin/init
27570 ? Ss 0:03 init [3]
(one snmpd process running in the LXC container (PPID: 27570))
lxc-host:~$ sudo ps xaj|grep snmp[d]
27570 28867 28865 28865 ? -1 S 103 4:57 /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I -smux mteTrigger mteTriggerConf -p /run/snmpd.pid
---- cut here ----
In such a situation, I've tried "service snmpd start" on the host,
but it doesen't work. Because the "start-stop-daemon" in the file
/etc/init.d/snmpd don't have "--pid-file" option, then it beleve that
snmpd already running. But the snmp process is LXC containers' one,
not for the host.
I attached a patch to fix this problem.
-- System Information:
Debian Release: 8.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.16.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages snmpd depends on:
ii adduser 3.113+nmu3
ii debconf [debconf-2.0] 1.5.56
ii libc6 2.19-18+deb8u3
ii libsnmp-base 5.7.2.1+dfsg-1
ii libsnmp30 5.7.2.1+dfsg-1
ii lsb-base 4.1+Debian13+nmu1
snmpd recommends no packages.
Versions of packages snmpd suggests:
pn snmptrapd <none>
-- debconf information excluded
--- snmpd.orig 2015-04-15 06:36:32.000000000 +0900
+++ snmpd 2016-02-19 16:06:35.746248954 +0900
@@ -45,21 +45,21 @@
mkdir -p /var/run/agentx
fi
if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
- start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmpd \
+ start-stop-daemon --quiet --start --pidfile $SNMP_PID --oknodo --exec /usr/sbin/snmpd \
-- $SNMPDOPTS
log_progress_msg " snmpd"
fi
;;
stop)
log_daemon_msg "Stopping SNMP services:"
- start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
+ start-stop-daemon --quiet --stop --pidfile $SNMP_PID --oknodo --retry 3 --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
log_progress_msg " snmpd"
;;
restart)
log_daemon_msg "Restarting SNMP services:"
- start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
+ start-stop-daemon --quiet --stop --pidfile $SNMP_PID --oknodo --retry 3 --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
- start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS
+ start-stop-daemon --quiet --start --pidfile $SNMP_PID --exec /usr/sbin/snmpd -- $SNMPDOPTS
log_progress_msg " snmpd"
fi
;;
More information about the Pkg-net-snmp-devel
mailing list