From a6d1eda33fb554aa1c4fbd9333ef254c969dea0a Mon Sep 17 00:00:00 2001 From: Fabian van der Hoeven Date: Tue, 19 Sep 2023 15:45:14 +0200 Subject: [PATCH 1/2] Fix java-gateway pid different in zabbix 6 --- manifests/javagateway.pp | 5 +++++ manifests/params.pp | 2 +- templates/zabbix_java_gateway.conf.erb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/manifests/javagateway.pp b/manifests/javagateway.pp index 47b4f2006..9035a6f04 100644 --- a/manifests/javagateway.pp +++ b/manifests/javagateway.pp @@ -24,6 +24,11 @@ $startpollers = $zabbix::params::javagateway_startpollers, $timeout = $zabbix::params::javagateway_timeout, ) inherits zabbix::params { + # Fix for pid file. Is different in Zabbix (4, 5) and 6 + $real_pidfile = $zabbix_version ? { + /^[45]\.[024]/ => '/var/run/zabbix/zabbix_java.pid', + /^[6]\.[024]/ => $pidfile, + } # Only include the repo class if it has not yet been included unless defined(Class['Zabbix::Repo']) { class { 'zabbix::repo': diff --git a/manifests/params.pp b/manifests/params.pp index 6db7d225c..d728d336e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -474,7 +474,7 @@ # Java Gateway specific params $javagateway_listenip = '0.0.0.0' $javagateway_listenport = '10052' - $javagateway_pidfile = '/var/run/zabbix/zabbix_java.pid' + $javagateway_pidfile = '/var/run/zabbix/zabbix_java_gateway.pid' $javagateway_startpollers = '5' $javagateway_timeout = '3' diff --git a/templates/zabbix_java_gateway.conf.erb b/templates/zabbix_java_gateway.conf.erb index 9a23a71a5..09b8bfea4 100644 --- a/templates/zabbix_java_gateway.conf.erb +++ b/templates/zabbix_java_gateway.conf.erb @@ -15,7 +15,7 @@ LISTEN_PORT=<%= @listenport %> # Name of PID file. # If omitted, Zabbix Java Gateway is started as a console application. # -PID_FILE=<%= @pidfile %> +PID_FILE=<%= @real_pidfile %> ### Option: zabbix.startPollers # Number of worker threads to start. From d8d080fc79b3134887db32f7cbcd3a523994d085 Mon Sep 17 00:00:00 2001 From: Fabian van der Hoeven Date: Fri, 13 Oct 2023 10:02:29 +0200 Subject: [PATCH 2/2] Fix javegateway pid not configurable by user --- manifests/javagateway.pp | 4 ++-- manifests/params.pp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/javagateway.pp b/manifests/javagateway.pp index 9035a6f04..721af3520 100644 --- a/manifests/javagateway.pp +++ b/manifests/javagateway.pp @@ -26,8 +26,8 @@ ) inherits zabbix::params { # Fix for pid file. Is different in Zabbix (4, 5) and 6 $real_pidfile = $zabbix_version ? { - /^[45]\.[024]/ => '/var/run/zabbix/zabbix_java.pid', - /^[6]\.[024]/ => $pidfile, + /^[45]\.[024]/ => pick($pidfile, '/var/run/zabbix/zabbix_java.pid'), + /^[6]\.[024]/ => pick($pidfile, '/var/run/zabbix/zabbix_java_gateway.pid'), } # Only include the repo class if it has not yet been included unless defined(Class['Zabbix::Repo']) { diff --git a/manifests/params.pp b/manifests/params.pp index d728d336e..f7567935d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -474,7 +474,7 @@ # Java Gateway specific params $javagateway_listenip = '0.0.0.0' $javagateway_listenport = '10052' - $javagateway_pidfile = '/var/run/zabbix/zabbix_java_gateway.pid' + $javagateway_pidfile = undef $javagateway_startpollers = '5' $javagateway_timeout = '3'