Package: nagios4-common
Version: 4.4.6-4.1
Followup-For: Bug #998045

> My previous systemd drop-in workaround was incomplete. 

The PIDFile being incorrect is a nuisance. IMO it's easiest to just remove it
rather than trying to keep this definition consistent across two places,
systemd can automatically detect its path correctly from how nagios4 executes.

My alternative approach, based on upstream's -d option, via systemd overrides 
using `systemctl edit nagios4`:

~~~~
# Note, this is an override, not the full service definition
[Service]
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=998045
# 
https://github.com/NagiosEnterprises/nagioscore/blob/master/startup/default-service.in
Type=forking
# Explicitly delete previous ExecStart= otherwise systemd complains
ExecStart=
ExecStart=/usr/sbin/nagios4 -d ${NAGIOSCFG}
ExecStop=/bin/kill -TERM ${MAINPID}
# Typo in Debian systemd service file for PIDFile
# Just remove it since systemd can detect it automatically
PIDFile=
User=nagios
RuntimeDirectory=nagios4
~~~~

I also had to add User=nagios otherwise the RuntimeDirectory gets created as
root:root and nagios4 fails because it can't write to it. Not sure why it worked
for you but I am writing in 2025 so perhaps some things got tightened up since
when you tried it.


-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (500, 'stable-security'), (300, 'unstable'), (200, 
'experimental'), (1, 'experimental-debug')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.17.8+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
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.153
ii  bsd-mailx [mailx]          8.1.2-0.20220412cvs-1.1
ii  coreutils                  9.7-3
ii  libjs-jquery               3.7.1+dfsg+~3.5.33-1
ii  mailutils [mailx]          1:3.20-2
ii  monitoring-plugins-basic   2.4.0-4
ii  sysvinit-utils [lsb-base]  3.15-6
ii  ucf                        3.0052

Versions of packages nagios4-common recommends:
pn  monitoring-plugins  <none>

nagios4-common suggests no packages.

-- Configuration Files:
/etc/nagios4/nagios.cfg changed [not included]
/etc/nagios4/objects/localhost.cfg changed [not included]
/etc/nagios4/resource.cfg [Errno 13] Permission denied: 
'/etc/nagios4/resource.cfg'

-- no debconf information

Reply via email to