From df3f9c3f967a1ee58138a46fc78acc154e13890a Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 11 Jan 2024 00:39:49 +0100 Subject: [PATCH] - fixed Agent2 .pid and .log paths --- tld.patch | 120 +++++++++++++++++++++++++++++++++++++++++++++++----- zabbix.spec | 3 +- 2 files changed, 111 insertions(+), 12 deletions(-) diff --git a/tld.patch b/tld.patch index 663fcd7..22f8dd9 100644 --- a/tld.patch +++ b/tld.patch @@ -1,6 +1,6 @@ diff -ur zabbix-6.0.25.orig/conf/zabbix_agentd.conf zabbix-6.0.25/conf/zabbix_agentd.conf --- zabbix-6.0.25.orig/conf/zabbix_agentd.conf 2023-12-13 09:17:32.000000000 +0100 -+++ zabbix-6.0.25/conf/zabbix_agentd.conf 2024-01-10 22:39:30.653744791 +0100 ++++ zabbix-6.0.25/conf/zabbix_agentd.conf 2024-01-11 00:18:54.065715198 +0100 @@ -8,7 +8,7 @@ # # Mandatory: no @@ -38,7 +38,7 @@ diff -ur zabbix-6.0.25.orig/conf/zabbix_agentd.conf zabbix-6.0.25/conf/zabbix_ag diff -ur zabbix-6.0.25.orig/conf/zabbix_proxy.conf zabbix-6.0.25/conf/zabbix_proxy.conf --- zabbix-6.0.25.orig/conf/zabbix_proxy.conf 2023-12-13 09:17:32.000000000 +0100 -+++ zabbix-6.0.25/conf/zabbix_proxy.conf 2024-01-10 22:39:30.653744791 +0100 ++++ zabbix-6.0.25/conf/zabbix_proxy.conf 2024-01-11 00:18:54.065715198 +0100 @@ -81,7 +81,7 @@ # Default: # LogFile= @@ -76,7 +76,7 @@ diff -ur zabbix-6.0.25.orig/conf/zabbix_proxy.conf zabbix-6.0.25/conf/zabbix_pro # Location of SSL client certificates. diff -ur zabbix-6.0.25.orig/conf/zabbix_server.conf zabbix-6.0.25/conf/zabbix_server.conf --- zabbix-6.0.25.orig/conf/zabbix_server.conf 2023-12-13 09:17:32.000000000 +0100 -+++ zabbix-6.0.25/conf/zabbix_server.conf 2024-01-10 22:39:30.653744791 +0100 ++++ zabbix-6.0.25/conf/zabbix_server.conf 2024-01-11 00:18:54.065715198 +0100 @@ -35,7 +35,7 @@ # Default: # LogFile= @@ -112,9 +112,107 @@ diff -ur zabbix-6.0.25.orig/conf/zabbix_server.conf zabbix-6.0.25/conf/zabbix_se ### Option: SSLCertLocation # Location of SSL client certificates. +diff -ur zabbix-6.0.25.orig/src/go/cmd/zabbix_web_service/config.go zabbix-6.0.25/src/go/cmd/zabbix_web_service/config.go +--- zabbix-6.0.25.orig/src/go/cmd/zabbix_web_service/config.go 2023-12-13 09:17:16.000000000 +0100 ++++ zabbix-6.0.25/src/go/cmd/zabbix_web_service/config.go 2024-01-11 00:28:57.120343885 +0100 +@@ -25,7 +25,7 @@ + ListenPort string `conf:"optional,range=1024:32767,default=10053"` + AllowedIP string `conf:"optional"` + LogType string `conf:"optional,default=file"` +- LogFile string `conf:"optional,default=/tmp/zabbix_web_service.log"` ++ LogFile string `conf:"optional,default=/var/log/zabbix/zabbix_web_service.log"` + LogFileSize int `conf:"optional,range=0:1024,default=1"` + Timeout int `conf:"optional,range=1:30,default=3"` + DebugLevel int `conf:"range=0:5,default=3"` +diff -ur zabbix-6.0.25.orig/src/go/conf/mock_server.conf zabbix-6.0.25/src/go/conf/mock_server.conf +--- zabbix-6.0.25.orig/src/go/conf/mock_server.conf 2023-12-13 09:17:29.000000000 +0100 ++++ zabbix-6.0.25/src/go/conf/mock_server.conf 2024-01-11 00:29:17.508601798 +0100 +@@ -18,7 +18,7 @@ + # Default: + # LogFile= + +-#LogFile=/tmp/zabbix_mock_server.log ++#LogFile=/var/log/zabbix/zabbix_mock_server.log + + ### Option: DebugLevel + # Specifies debug level: +diff -ur zabbix-6.0.25.orig/src/go/conf/zabbix_agent2.conf zabbix-6.0.25/src/go/conf/zabbix_agent2.conf +--- zabbix-6.0.25.orig/src/go/conf/zabbix_agent2.conf 2023-12-13 09:17:33.000000000 +0100 ++++ zabbix-6.0.25/src/go/conf/zabbix_agent2.conf 2024-01-11 00:27:56.657579028 +0100 +@@ -8,7 +8,7 @@ + # + # Mandatory: no + # Default: +-# PidFile=/tmp/zabbix_agent2.pid ++# PidFile=/var/run/zabbix/zabbix_agent2.pid + + ### Option: LogType + # Specifies where log messages are written to: +@@ -25,7 +25,7 @@ + # + # Mandatory: yes, if LogType is set to file, otherwise no + # Default: +-# LogFile=/tmp/zabbix_agent2.log ++# LogFile=/var/log/zabbix/zabbix_agent2.log + + ### Option: LogFileSize + # Maximum size of log file in MB. +@@ -272,9 +272,7 @@ + # Default: + # Include= + +-# Include=/usr/local/etc/zabbix_agent2.userparams.conf +-# Include=/usr/local/etc/zabbix_agent2.conf.d/ +-# Include=/usr/local/etc/zabbix_agent2.conf.d/*.conf ++Include=/etc/zabbix/zabbix_agent2.conf.d/*.conf + + ### Option:PluginTimeout + # Timeout for connections with external plugins. +@@ -477,4 +475,4 @@ + # ForceActiveChecksOnStart=0 + + # Include configuration files for plugins +-Include=./zabbix_agent2.d/plugins.d/*.conf ++Include=/etc/zabbix/zabbix_agent2.d/plugins.d/*.conf +diff -ur zabbix-6.0.25.orig/src/go/conf/zabbix_web_service.conf zabbix-6.0.25/src/go/conf/zabbix_web_service.conf +--- zabbix-6.0.25.orig/src/go/conf/zabbix_web_service.conf 2023-12-13 09:17:29.000000000 +0100 ++++ zabbix-6.0.25/src/go/conf/zabbix_web_service.conf 2024-01-11 00:29:05.116445036 +0100 +@@ -18,7 +18,7 @@ + # + # Mandatory: yes, if LogType is set to file, otherwise no + # Default: +-# LogFile=/tmp/zabbix_web_service.log ++# LogFile=/var/log/zabbix/zabbix_web_service.log + + ### Option: LogFileSize + # Maximum size of log file in MB. +diff -ur zabbix-6.0.25.orig/src/go/internal/agent/options_nix.go zabbix-6.0.25/src/go/internal/agent/options_nix.go +--- zabbix-6.0.25.orig/src/go/internal/agent/options_nix.go 2023-12-13 09:17:33.000000000 +0100 ++++ zabbix-6.0.25/src/go/internal/agent/options_nix.go 2024-01-11 00:31:22.998189252 +0100 +@@ -24,7 +24,7 @@ + + type AgentOptions struct { + LogType string `conf:"optional,default=file"` +- LogFile string `conf:"optional,default=/tmp/zabbix_agent2.log"` ++ LogFile string `conf:"optional,default=/var/log/zabbix/zabbix_agent2.log"` + LogFileSize int `conf:"optional,range=0:1024,default=1"` + DebugLevel int `conf:"optional,range=0:5,default=3"` + PidFile string `conf:"optional"` +diff -ur zabbix-6.0.25.orig/src/go/pkg/pidfile/pidfile_nix.go zabbix-6.0.25/src/go/pkg/pidfile/pidfile_nix.go +--- zabbix-6.0.25.orig/src/go/pkg/pidfile/pidfile_nix.go 2023-12-13 09:17:16.000000000 +0100 ++++ zabbix-6.0.25/src/go/pkg/pidfile/pidfile_nix.go 2024-01-11 00:28:30.003000848 +0100 +@@ -31,7 +31,7 @@ + + func createPidFile(pid int, path string) (file *os.File, err error) { + if path == "" { +- path = "/tmp/zabbix_agent2.pid" ++ path = "/var/run/zabbix/zabbix_agent2.pid" + } + + flockT := syscall.Flock_t{ diff -ur zabbix-6.0.25.orig/src/zabbix_agent/zabbix_agentd.c zabbix-6.0.25/src/zabbix_agent/zabbix_agentd.c --- zabbix-6.0.25.orig/src/zabbix_agent/zabbix_agentd.c 2023-12-13 09:17:33.000000000 +0100 -+++ zabbix-6.0.25/src/zabbix_agent/zabbix_agentd.c 2024-01-10 22:39:30.654744803 +0100 ++++ zabbix-6.0.25/src/zabbix_agent/zabbix_agentd.c 2024-01-11 00:18:54.066715211 +0100 @@ -603,7 +603,7 @@ CONFIG_LOAD_MODULE_PATH = zbx_strdup(CONFIG_LOAD_MODULE_PATH, DEFAULT_LOAD_MODULE_PATH); @@ -126,7 +224,7 @@ diff -ur zabbix-6.0.25.orig/src/zabbix_agent/zabbix_agentd.c zabbix-6.0.25/src/z CONFIG_LOG_TYPE_STR = zbx_strdup(CONFIG_LOG_TYPE_STR, ZBX_OPTION_LOGTYPE_FILE); diff -ur zabbix-6.0.25.orig/src/zabbix_java/lib/logback.xml zabbix-6.0.25/src/zabbix_java/lib/logback.xml --- zabbix-6.0.25.orig/src/zabbix_java/lib/logback.xml 2023-12-13 09:17:17.000000000 +0100 -+++ zabbix-6.0.25/src/zabbix_java/lib/logback.xml 2024-01-10 22:39:30.654744803 +0100 ++++ zabbix-6.0.25/src/zabbix_java/lib/logback.xml 2024-01-11 00:18:54.066715211 +0100 @@ -2,10 +2,10 @@ @@ -142,7 +240,7 @@ diff -ur zabbix-6.0.25.orig/src/zabbix_java/lib/logback.xml zabbix-6.0.25/src/za diff -ur zabbix-6.0.25.orig/src/zabbix_java/settings.sh zabbix-6.0.25/src/zabbix_java/settings.sh --- zabbix-6.0.25.orig/src/zabbix_java/settings.sh 2023-12-13 09:17:17.000000000 +0100 -+++ zabbix-6.0.25/src/zabbix_java/settings.sh 2024-01-10 22:39:30.654744803 +0100 ++++ zabbix-6.0.25/src/zabbix_java/settings.sh 2024-01-11 00:18:54.066715211 +0100 @@ -24,7 +24,7 @@ # Default: # PID_FILE= @@ -154,7 +252,7 @@ diff -ur zabbix-6.0.25.orig/src/zabbix_java/settings.sh zabbix-6.0.25/src/zabbix # Number of worker threads to start. diff -ur zabbix-6.0.25.orig/src/zabbix_proxy/proxy.c zabbix-6.0.25/src/zabbix_proxy/proxy.c --- zabbix-6.0.25.orig/src/zabbix_proxy/proxy.c 2023-12-13 09:17:33.000000000 +0100 -+++ zabbix-6.0.25/src/zabbix_proxy/proxy.c 2024-01-10 22:39:30.655744816 +0100 ++++ zabbix-6.0.25/src/zabbix_proxy/proxy.c 2024-01-11 00:18:54.067715224 +0100 @@ -515,7 +515,7 @@ CONFIG_SNMPTRAP_FILE = zbx_strdup(CONFIG_SNMPTRAP_FILE, "/tmp/zabbix_traps.tmp"); @@ -166,7 +264,7 @@ diff -ur zabbix-6.0.25.orig/src/zabbix_proxy/proxy.c zabbix-6.0.25/src/zabbix_pr CONFIG_TMPDIR = zbx_strdup(CONFIG_TMPDIR, "/tmp"); diff -ur zabbix-6.0.25.orig/src/zabbix_server/server.c zabbix-6.0.25/src/zabbix_server/server.c --- zabbix-6.0.25.orig/src/zabbix_server/server.c 2023-12-13 09:17:33.000000000 +0100 -+++ zabbix-6.0.25/src/zabbix_server/server.c 2024-01-10 22:39:30.655744816 +0100 ++++ zabbix-6.0.25/src/zabbix_server/server.c 2024-01-11 00:18:54.067715224 +0100 @@ -578,7 +578,7 @@ CONFIG_SNMPTRAP_FILE = zbx_strdup(CONFIG_SNMPTRAP_FILE, "/tmp/zabbix_traps.tmp"); @@ -178,7 +276,7 @@ diff -ur zabbix-6.0.25.orig/src/zabbix_server/server.c zabbix-6.0.25/src/zabbix_ CONFIG_ALERT_SCRIPTS_PATH = zbx_strdup(CONFIG_ALERT_SCRIPTS_PATH, DEFAULT_ALERT_SCRIPTS_PATH); diff -ur zabbix-6.0.25.orig/ui/include/classes/core/CConfigFile.php zabbix-6.0.25/ui/include/classes/core/CConfigFile.php --- zabbix-6.0.25.orig/ui/include/classes/core/CConfigFile.php 2023-12-13 09:17:33.000000000 +0100 -+++ zabbix-6.0.25/ui/include/classes/core/CConfigFile.php 2024-01-10 22:39:30.655744816 +0100 ++++ zabbix-6.0.25/ui/include/classes/core/CConfigFile.php 2024-01-11 00:18:54.067715224 +0100 @@ -25,7 +25,7 @@ const CONFIG_ERROR = 2; const CONFIG_VAULT_ERROR = 3; @@ -190,7 +288,7 @@ diff -ur zabbix-6.0.25.orig/ui/include/classes/core/CConfigFile.php zabbix-6.0.2 ZBX_DB_MYSQL => true, diff -ur zabbix-6.0.25.orig/ui/include/classes/core/ZBase.php zabbix-6.0.25/ui/include/classes/core/ZBase.php --- zabbix-6.0.25.orig/ui/include/classes/core/ZBase.php 2023-12-13 09:17:33.000000000 +0100 -+++ zabbix-6.0.25/ui/include/classes/core/ZBase.php 2024-01-10 22:39:30.754746056 +0100 ++++ zabbix-6.0.25/ui/include/classes/core/ZBase.php 2024-01-11 00:18:54.139716136 +0100 @@ -380,7 +380,7 @@ * @throws Exception */ @@ -211,7 +309,7 @@ diff -ur zabbix-6.0.25.orig/ui/include/classes/core/ZBase.php zabbix-6.0.25/ui/i } diff -ur zabbix-6.0.25.orig/ui/include/classes/setup/CSetupWizard.php zabbix-6.0.25/ui/include/classes/setup/CSetupWizard.php --- zabbix-6.0.25.orig/ui/include/classes/setup/CSetupWizard.php 2023-12-13 09:17:33.000000000 +0100 -+++ zabbix-6.0.25/ui/include/classes/setup/CSetupWizard.php 2024-01-10 22:39:30.754746056 +0100 ++++ zabbix-6.0.25/ui/include/classes/setup/CSetupWizard.php 2024-01-11 00:18:54.139716136 +0100 @@ -271,7 +271,7 @@ // make zabbix.conf.php downloadable header('Content-Type: application/x-httpd-php'); diff --git a/zabbix.spec b/zabbix.spec index c135908..17b0a1b 100644 --- a/zabbix.spec +++ b/zabbix.spec @@ -344,7 +344,7 @@ done %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/{rc.d/init.d,sysconfig},/etc/webapps/%{_webapp},%{_appdir}} \ +install -d $RPM_BUILD_ROOT{%{_sysconfdir}/zabbix_agent2.conf.d,/etc/{rc.d/init.d,sysconfig},/etc/webapps/%{_webapp},%{_appdir}} \ $RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix} %{__make} install \ @@ -540,6 +540,7 @@ fi %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.conf %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.d %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.d/plugins.d +%dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_agent2.conf.d %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/ceph.conf %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/docker.conf %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/memcached.conf -- 2.46.0