Package: nagios4-common
Version: 4.4.6-4
Severity: normal
X-Debbugs-Cc:
hablu...@gmail.com
Dear Maintainer, the current systemd service unit for Nagios 4 (/lib/systemd/system/nagios4.service) doesn't allow Nagios to create its PID file because Nagios is not running in daemon mode (option -d is missing) and Nagios (apparently) only creates its PID file ('lock_file' option in /etc/nagios4/nagios.cfg) when it runs in daemon mode.
In addition, the default PID file name in the service unit (PIDFile=/run/nagios4/nagios.pid) is different that the one in /etc/nagios4/nagios.cfg (lock_file=/var/run/nagios4/nagios4.pid), so it might be a good idea to fix that inconsistency as well.
Now, and just for reference, I've created the following systemd drop-in as a workaround, /etc/systemd/system/nagios4.service.d/10-fix-for-incorrect-pid-management.conf:
[Service]
ExecStartPost=/bin/sh -c 'umask 022; pgrep nagios4 > /var/run/nagios4/nagios4.pid'
PIDFile=/run/nagios4/nagios4.pid
But maybe that approach wouldn't be really appropriate for the fix and instead, it would be preferred to run Nagios in daemon mode as you can see upstream. From
https://github.com/NagiosEnterprises/nagioscore/blob/master/startup/default-service.in:
ExecStart=@bindir@/nagios -d @sysconfdir@/nagios.cfg
-- System Information:
Debian Release: 11.0
APT prefers impish-updates
APT policy: (500, 'impish-updates'), (500, 'impish-security'), (500, 'impish-proposed'), (500, 'impish')
Architecture: amd64 (x86_64)
Kernel: Linux 5.13.0-1005-gcp (SMP w/2 CPU threads)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages nagios4-common depends on:
ii adduser 3.118ubuntu5
ii bsd-mailx [mailx] 8.1.2-0.20180807cvs-2build1
ii coreutils 8.32-4ubuntu2
ii libjs-jquery 3.5.1+dfsg+~3.5.5-7
ii lsb-base 11.1.0ubuntu3
ii monitoring-plugins-basic 2.3.1-1ubuntu2
ii ucf 3.0043
Versions of packages nagios4-common recommends:
ii monitoring-plugins 2.3.1-1ubuntu2
nagios4-common suggests no packages.
-- Configuration Files:
-- debconf-show failed