diff --git a/manifests/javagateway.pp b/manifests/javagateway.pp index 47b4f2006..721af3520 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]/ => 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']) { class { 'zabbix::repo': diff --git a/manifests/params.pp b/manifests/params.pp index 6db7d225c..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.pid' + $javagateway_pidfile = undef $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.