Skip to content
This repository was archived by the owner on Apr 4, 2022. It is now read-only.

Commit 7ae8f5b

Browse files
authored
Merge pull request voxpupuli#723 from wdberry/add-config-socketdir
Add parameter and default for Option SocketDir
2 parents 628cad2 + 9a31243 commit 7ae8f5b

File tree

8 files changed

+151
-92
lines changed

8 files changed

+151
-92
lines changed

manifests/init.pp

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
$include_dir = $zabbix::params::server_include,
177177
$loadmodulepath = $zabbix::params::server_loadmodulepath,
178178
$loadmodule = $zabbix::params::server_loadmodule,
179+
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::server_socketdir,
179180
Boolean $manage_selinux = $zabbix::params::manage_selinux,
180181
String $additional_service_params = $zabbix::params::additional_service_params,
181182
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,

manifests/params.pp

+5
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@
284284
$server_vmwarecachesize = '8M'
285285
$server_vmwarefrequency = '60'
286286
$server_vmwaretimeout = undef
287+
$server_socketdir = undef
287288

288289
# Agent specific params
289290
$agent_allowroot = '0'
@@ -425,6 +426,10 @@
425426
$proxy_zabbix_server_host = undef
426427
$proxy_zabbix_server_port = '10051'
427428
$proxy_zbx_templates = ['Template App Zabbix Proxy']
429+
$proxy_socketdir = versioncmp($zabbix_version, '5.0') ? {
430+
-1 => undef,
431+
default => '/var/run/zabbix',
432+
}
428433

429434
# Java Gateway specific params
430435
$javagateway_listenip = '0.0.0.0'

manifests/proxy.pp

+96-91
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@
264264
# [*loadmodule*]
265265
# Module to load at server startup.
266266
#
267+
# [*socketdir*]
268+
# IPC socket directory.
269+
# Directory to store IPC sockets used by internal Zabbix services.
270+
#
267271
# === Example
268272
#
269273
# When you want to run everything on one machine, you can use the following
@@ -332,97 +336,98 @@
332336
# Copyright 2014 Werner Dijkerman
333337
#
334338
class zabbix::proxy (
335-
Zabbix::Databases $database_type = $zabbix::params::database_type,
336-
$database_path = $zabbix::params::database_path,
337-
$zabbix_version = $zabbix::params::zabbix_version,
338-
$zabbix_package_state = $zabbix::params::zabbix_package_state,
339-
Boolean $manage_database = $zabbix::params::manage_database,
340-
Boolean $manage_firewall = $zabbix::params::manage_firewall,
341-
Boolean $manage_repo = $zabbix::params::manage_repo,
342-
Boolean $manage_resources = $zabbix::params::manage_resources,
343-
Boolean $manage_service = $zabbix::params::manage_service,
344-
$zabbix_proxy = $zabbix::params::zabbix_proxy,
345-
$zabbix_proxy_ip = $zabbix::params::zabbix_proxy_ip,
346-
$use_ip = $zabbix::params::proxy_use_ip,
347-
$zbx_templates = $zabbix::params::proxy_zbx_templates,
348-
$proxy_configfile_path = $zabbix::params::proxy_configfile_path,
349-
$proxy_service_name = $zabbix::params::proxy_service_name,
350-
$mode = $zabbix::params::proxy_mode,
351-
$zabbix_server_host = $zabbix::params::proxy_zabbix_server_host,
352-
$zabbix_server_port = $zabbix::params::proxy_zabbix_server_port,
353-
$hostname = $zabbix::params::proxy_hostname,
354-
$listenport = $zabbix::params::proxy_listenport,
355-
$sourceip = $zabbix::params::proxy_sourceip,
356-
Integer[0] $enableremotecommands = $zabbix::params::proxy_enableremotecommands,
357-
Integer[0] $logremotecommands = $zabbix::params::proxy_logremotecommands,
358-
$logfile = $zabbix::params::proxy_logfile,
359-
$logfilesize = $zabbix::params::proxy_logfilesize,
360-
$debuglevel = $zabbix::params::proxy_debuglevel,
361-
$pidfile = $zabbix::params::proxy_pidfile,
362-
$database_schema_path = $zabbix::params::database_schema_path,
363-
$database_host = $zabbix::params::proxy_database_host,
364-
$database_name = $zabbix::params::proxy_database_name,
365-
$database_schema = $zabbix::params::proxy_database_schema,
366-
$database_user = $zabbix::params::proxy_database_user,
367-
$database_password = $zabbix::params::proxy_database_password,
368-
$database_socket = $zabbix::params::proxy_database_socket,
369-
$database_port = $zabbix::params::proxy_database_port,
370-
$localbuffer = $zabbix::params::proxy_localbuffer,
371-
$offlinebuffer = $zabbix::params::proxy_offlinebuffer,
372-
$heartbeatfrequency = $zabbix::params::proxy_heartbeatfrequency,
373-
$configfrequency = $zabbix::params::proxy_configfrequency,
374-
$datasenderfrequency = $zabbix::params::proxy_datasenderfrequency,
375-
$startpollers = $zabbix::params::proxy_startpollers,
376-
$startipmipollers = $zabbix::params::proxy_startipmipollers,
377-
$startpollersunreachable = $zabbix::params::proxy_startpollersunreachable,
378-
$starttrappers = $zabbix::params::proxy_starttrappers,
379-
$startpingers = $zabbix::params::proxy_startpingers,
380-
$startdiscoverers = $zabbix::params::proxy_startdiscoverers,
381-
$starthttppollers = $zabbix::params::proxy_starthttppollers,
382-
$javagateway = $zabbix::params::proxy_javagateway,
383-
$javagatewayport = $zabbix::params::proxy_javagatewayport,
384-
$startjavapollers = $zabbix::params::proxy_startjavapollers,
385-
$startvmwarecollectors = $zabbix::params::proxy_startvmwarecollectors,
386-
$vmwarefrequency = $zabbix::params::proxy_vmwarefrequency,
387-
$vmwareperffrequency = $zabbix::params::proxy_vmwareperffrequency,
388-
$vmwarecachesize = $zabbix::params::proxy_vmwarecachesize,
389-
$vmwaretimeout = $zabbix::params::proxy_vmwaretimeout,
390-
$enablesnmpbulkrequests = $zabbix::params::proxy_enablesnmpbulkrequests,
391-
$snmptrapperfile = $zabbix::params::proxy_snmptrapperfile,
392-
$snmptrapper = $zabbix::params::proxy_snmptrapper,
393-
$listenip = $zabbix::params::proxy_listenip,
394-
$housekeepingfrequency = $zabbix::params::proxy_housekeepingfrequency,
395-
$cachesize = $zabbix::params::proxy_cachesize,
396-
$startdbsyncers = $zabbix::params::proxy_startdbsyncers,
397-
$historycachesize = $zabbix::params::proxy_historycachesize,
398-
$historyindexcachesize = $zabbix::params::proxy_historyindexcachesize,
399-
$historytextcachesize = $zabbix::params::proxy_historytextcachesize,
400-
$timeout = $zabbix::params::proxy_timeout,
401-
$tlsaccept = $zabbix::params::proxy_tlsaccept,
402-
$tlscafile = $zabbix::params::proxy_tlscafile,
403-
$tlscertfile = $zabbix::params::proxy_tlscertfile,
404-
$tlsconnect = $zabbix::params::proxy_tlsconnect,
405-
$tlscrlfile = $zabbix::params::proxy_tlscrlfile,
406-
$tlskeyfile = $zabbix::params::proxy_tlskeyfile,
407-
$tlspskfile = $zabbix::params::proxy_tlspskfile,
408-
$tlspskidentity = $zabbix::params::proxy_tlspskidentity,
409-
$tlsservercertissuer = $zabbix::params::proxy_tlsservercertissuer,
410-
$tlsservercertsubject = $zabbix::params::proxy_tlsservercertsubject,
411-
$trappertimeout = $zabbix::params::proxy_trappertimeout,
412-
$unreachableperiod = $zabbix::params::proxy_unreachableperiod,
413-
$unavaliabledelay = $zabbix::params::proxy_unavaliabledelay,
414-
$unreachabedelay = $zabbix::params::proxy_unreachabedelay,
415-
$externalscripts = $zabbix::params::proxy_externalscripts,
416-
$fpinglocation = $zabbix::params::proxy_fpinglocation,
417-
$fping6location = $zabbix::params::proxy_fping6location,
418-
$sshkeylocation = $zabbix::params::proxy_sshkeylocation,
419-
$logslowqueries = $zabbix::params::proxy_logslowqueries,
420-
$tmpdir = $zabbix::params::proxy_tmpdir,
421-
$allowroot = $zabbix::params::proxy_allowroot,
422-
$include_dir = $zabbix::params::proxy_include,
423-
$loadmodulepath = $zabbix::params::proxy_loadmodulepath,
424-
$loadmodule = $zabbix::params::proxy_loadmodule,
425-
Boolean $manage_selinux = $zabbix::params::manage_selinux,
339+
Zabbix::Databases $database_type = $zabbix::params::database_type,
340+
$database_path = $zabbix::params::database_path,
341+
$zabbix_version = $zabbix::params::zabbix_version,
342+
$zabbix_package_state = $zabbix::params::zabbix_package_state,
343+
Boolean $manage_database = $zabbix::params::manage_database,
344+
Boolean $manage_firewall = $zabbix::params::manage_firewall,
345+
Boolean $manage_repo = $zabbix::params::manage_repo,
346+
Boolean $manage_resources = $zabbix::params::manage_resources,
347+
Boolean $manage_service = $zabbix::params::manage_service,
348+
$zabbix_proxy = $zabbix::params::zabbix_proxy,
349+
$zabbix_proxy_ip = $zabbix::params::zabbix_proxy_ip,
350+
$use_ip = $zabbix::params::proxy_use_ip,
351+
$zbx_templates = $zabbix::params::proxy_zbx_templates,
352+
$proxy_configfile_path = $zabbix::params::proxy_configfile_path,
353+
$proxy_service_name = $zabbix::params::proxy_service_name,
354+
$mode = $zabbix::params::proxy_mode,
355+
$zabbix_server_host = $zabbix::params::proxy_zabbix_server_host,
356+
$zabbix_server_port = $zabbix::params::proxy_zabbix_server_port,
357+
$hostname = $zabbix::params::proxy_hostname,
358+
$listenport = $zabbix::params::proxy_listenport,
359+
$sourceip = $zabbix::params::proxy_sourceip,
360+
Integer[0] $enableremotecommands = $zabbix::params::proxy_enableremotecommands,
361+
Integer[0] $logremotecommands = $zabbix::params::proxy_logremotecommands,
362+
$logfile = $zabbix::params::proxy_logfile,
363+
$logfilesize = $zabbix::params::proxy_logfilesize,
364+
$debuglevel = $zabbix::params::proxy_debuglevel,
365+
$pidfile = $zabbix::params::proxy_pidfile,
366+
$database_schema_path = $zabbix::params::database_schema_path,
367+
$database_host = $zabbix::params::proxy_database_host,
368+
$database_name = $zabbix::params::proxy_database_name,
369+
$database_schema = $zabbix::params::proxy_database_schema,
370+
$database_user = $zabbix::params::proxy_database_user,
371+
$database_password = $zabbix::params::proxy_database_password,
372+
$database_socket = $zabbix::params::proxy_database_socket,
373+
$database_port = $zabbix::params::proxy_database_port,
374+
$localbuffer = $zabbix::params::proxy_localbuffer,
375+
$offlinebuffer = $zabbix::params::proxy_offlinebuffer,
376+
$heartbeatfrequency = $zabbix::params::proxy_heartbeatfrequency,
377+
$configfrequency = $zabbix::params::proxy_configfrequency,
378+
$datasenderfrequency = $zabbix::params::proxy_datasenderfrequency,
379+
$startpollers = $zabbix::params::proxy_startpollers,
380+
$startipmipollers = $zabbix::params::proxy_startipmipollers,
381+
$startpollersunreachable = $zabbix::params::proxy_startpollersunreachable,
382+
$starttrappers = $zabbix::params::proxy_starttrappers,
383+
$startpingers = $zabbix::params::proxy_startpingers,
384+
$startdiscoverers = $zabbix::params::proxy_startdiscoverers,
385+
$starthttppollers = $zabbix::params::proxy_starthttppollers,
386+
$javagateway = $zabbix::params::proxy_javagateway,
387+
$javagatewayport = $zabbix::params::proxy_javagatewayport,
388+
$startjavapollers = $zabbix::params::proxy_startjavapollers,
389+
$startvmwarecollectors = $zabbix::params::proxy_startvmwarecollectors,
390+
$vmwarefrequency = $zabbix::params::proxy_vmwarefrequency,
391+
$vmwareperffrequency = $zabbix::params::proxy_vmwareperffrequency,
392+
$vmwarecachesize = $zabbix::params::proxy_vmwarecachesize,
393+
$vmwaretimeout = $zabbix::params::proxy_vmwaretimeout,
394+
$enablesnmpbulkrequests = $zabbix::params::proxy_enablesnmpbulkrequests,
395+
$snmptrapperfile = $zabbix::params::proxy_snmptrapperfile,
396+
$snmptrapper = $zabbix::params::proxy_snmptrapper,
397+
$listenip = $zabbix::params::proxy_listenip,
398+
$housekeepingfrequency = $zabbix::params::proxy_housekeepingfrequency,
399+
$cachesize = $zabbix::params::proxy_cachesize,
400+
$startdbsyncers = $zabbix::params::proxy_startdbsyncers,
401+
$historycachesize = $zabbix::params::proxy_historycachesize,
402+
$historyindexcachesize = $zabbix::params::proxy_historyindexcachesize,
403+
$historytextcachesize = $zabbix::params::proxy_historytextcachesize,
404+
$timeout = $zabbix::params::proxy_timeout,
405+
$tlsaccept = $zabbix::params::proxy_tlsaccept,
406+
$tlscafile = $zabbix::params::proxy_tlscafile,
407+
$tlscertfile = $zabbix::params::proxy_tlscertfile,
408+
$tlsconnect = $zabbix::params::proxy_tlsconnect,
409+
$tlscrlfile = $zabbix::params::proxy_tlscrlfile,
410+
$tlskeyfile = $zabbix::params::proxy_tlskeyfile,
411+
$tlspskfile = $zabbix::params::proxy_tlspskfile,
412+
$tlspskidentity = $zabbix::params::proxy_tlspskidentity,
413+
$tlsservercertissuer = $zabbix::params::proxy_tlsservercertissuer,
414+
$tlsservercertsubject = $zabbix::params::proxy_tlsservercertsubject,
415+
$trappertimeout = $zabbix::params::proxy_trappertimeout,
416+
$unreachableperiod = $zabbix::params::proxy_unreachableperiod,
417+
$unavaliabledelay = $zabbix::params::proxy_unavaliabledelay,
418+
$unreachabedelay = $zabbix::params::proxy_unreachabedelay,
419+
$externalscripts = $zabbix::params::proxy_externalscripts,
420+
$fpinglocation = $zabbix::params::proxy_fpinglocation,
421+
$fping6location = $zabbix::params::proxy_fping6location,
422+
$sshkeylocation = $zabbix::params::proxy_sshkeylocation,
423+
$logslowqueries = $zabbix::params::proxy_logslowqueries,
424+
$tmpdir = $zabbix::params::proxy_tmpdir,
425+
$allowroot = $zabbix::params::proxy_allowroot,
426+
$include_dir = $zabbix::params::proxy_include,
427+
$loadmodulepath = $zabbix::params::proxy_loadmodulepath,
428+
$loadmodule = $zabbix::params::proxy_loadmodule,
429+
Boolean $manage_selinux = $zabbix::params::manage_selinux,
430+
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::proxy_socketdir,
426431
) inherits zabbix::params {
427432
# check osfamily, Arch is currently not supported for web
428433
if $facts['os']['family'] == 'Archlinux' {

manifests/server.pp

+5
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@
261261
# [*manage_startup_script*]
262262
# If the init script should be managed by this module. Attention: This might cause problems with some config options of this module (e.g server_configfile_path)
263263
#
264+
# [*socketdir*]
265+
# IPC socket directory.
266+
# Directory to store IPC sockets used by internal Zabbix services.
267+
#
264268
# === Example
265269
#
266270
# When running everything on a single node, please check
@@ -383,6 +387,7 @@
383387
String $additional_service_params = $zabbix::params::additional_service_params,
384388
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,
385389
Boolean $manage_startup_script = $zabbix::params::manage_startup_script,
390+
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::server_socketdir,
386391
) inherits zabbix::params {
387392
# the following codeblock is a bit blargh. The correct default value for
388393
# $real_additional_service_params changes based on the value of $zabbix_version

spec/classes/proxy_spec.rb

+11
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,17 @@
367367
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^EnableRemoteCommands=1$} }
368368
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^LogRemoteCommands=1$} }
369369
end
370+
371+
context 'with zabbix_proxy.conf and version 5.0' do
372+
let :params do
373+
{
374+
socketdir: '/var/run/zabbix',
375+
zabbix_version: '5.0'
376+
}
377+
end
378+
379+
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^SocketDir=/var/run/zabbix} }
380+
end
370381
end
371382
end
372383
end

spec/classes/server_spec.rb

+11
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,17 @@
385385
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^HistoryIndexCacheSize=4M} }
386386
end
387387

388+
context 'with zabbix_server.conf and version 5.0' do
389+
let :params do
390+
{
391+
socketdir: '/var/run/zabbix',
392+
zabbix_version: '5.0'
393+
}
394+
end
395+
396+
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^SocketDir=/var/run/zabbix} }
397+
end
398+
388399
context 'with zabbix_server.conf and system as logtype' do
389400
let :params do
390401
{

templates/zabbix_proxy.conf.erb

+11-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ DebugLevel=<%= @debuglevel %>
9595
#
9696
PidFile=<%= @pidfile %>
9797

98+
<% if @zabbix_version.to_f >= 5.0 %>
99+
### Option: SocketDir
100+
# IPC socket directory.
101+
# Directory to store IPC sockets used by internal Zabbix services.
102+
#
103+
# Mandatory: no
104+
# Default:
105+
106+
<% if @socketdir %>SocketDir=<%= @socketdir %><% end %>
107+
<% end %>
108+
98109
### Option: DBHost
99110
# Database host name.
100111
# If set to localhost, socket is used for MySQL.
@@ -534,4 +545,3 @@ LoadModulePath=<%= @loadmodulepath %>
534545
<% if @tlspskfile %>TLSPSKFile=<%= @tlspskfile %><% end %>
535546

536547
<% end %>
537-

templates/zabbix_server.conf.erb

+11
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ DebugLevel=<%= @debuglevel %>
7777
#
7878
PidFile=<%= @pidfile %>
7979

80+
<% if @zabbix_version.to_f >= 3.4 %>
81+
### Option: SocketDir
82+
# IPC socket directory.
83+
# Directory to store IPC sockets used by internal Zabbix services.
84+
#
85+
# Mandatory: no
86+
# Default:
87+
88+
<% if @socketdir %>SocketDir=<%= @socketdir %><% end %>
89+
<% end %>
90+
8091
### Option: DBHost
8192
# Database host name.
8293
# If set to localhost, socket is used for MySQL.

0 commit comments

Comments
 (0)