zabbix: fix agentd PidFile creation
authorDaniel F. Dickinson <dfdpublic@wildtechgarden.ca>
Thu, 25 Dec 2025 20:04:47 +0000 (15:04 -0500)
committerGeorge Sapkin <george@sapk.in>
Thu, 15 Jan 2026 23:10:59 +0000 (01:10 +0200)
Addresses the issue pointed out in #28165, which is that zabbix_agentd
always creates a PidFile and has no option to disable PidFile creation.
Therefore update the configuration file to default to create a PidFile
where we want it.

Close #28165

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
admin/zabbix/files/zabbix_agentd.init
admin/zabbix/patches/010-change-agentd-config.patch

index ea886346e7c821f8cd63032e2bc15876cde0eb88..2938caff4d8d1a8db2f9446737a6443237c646bc 100755 (executable)
@@ -13,6 +13,9 @@ start_service() {
 
        [ -f ${CONFIG} ] || return 1
 
+       mkdir -p /var/run/zabbix
+       chown zabbix:zabbix /var/run/zabbix
+
        procd_open_instance
        procd_set_param command ${PROG} -c ${CONFIG} -f
        procd_set_param respawn
index 2dbae8baa537b2ff7a937df71d47f1cc5913cdb8..024b56e879c3df9cd032976a0e7107ae1eea2b03 100644 (file)
@@ -4,13 +4,13 @@ Date: Wed, 17 Dec 2025 18:28:37 -0500
 Subject: [PATCH] zabbix_agentd: Tweak config file for OpenWrt
 
 Note: original patch had no header, header added 2025-12-16, while
-bumping package version.
+bumping package version. Modified 2025-12-25.
 
 1. Use syslog not a file for logging
-2. Do not use PidFile
-3. Only start in passive agent by default
+2. Place PidFile under /var/run/zabbix
+3. Only start passive agent by default
 4. Do not do active checks by default
-5. Use the system hostname as hostname.
+5. Use the system hostname as hostname (except on zabbix server)
 6. Include configurations under /etc/zabbix_agentd.conf.d/
 
 Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
@@ -30,8 +30,8 @@ Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
 -# Mandatory: no
 -# Default:
 -# PidFile=/tmp/zabbix_agentd.pid
-+# We do not need PidFile with procd
-+# PidFile=/var/run/zabbix_agentd.pid
++# Zabbix always creates a PidFile. Make sure it is where we want it.
++PidFile=/var/run/zabbix/zabbix_agentd.pid
 +
 +# use syslog
 +LogType=system