Skip to content

Commit

Permalink
Merge pull request #723 from wdberry/add-config-socketdir
Browse files Browse the repository at this point in the history
Add parameter and default for Option SocketDir
  • Loading branch information
bastelfreak authored Oct 28, 2020
2 parents 628cad2 + 9a31243 commit 7ae8f5b
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 92 deletions.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
$include_dir = $zabbix::params::server_include,
$loadmodulepath = $zabbix::params::server_loadmodulepath,
$loadmodule = $zabbix::params::server_loadmodule,
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::server_socketdir,
Boolean $manage_selinux = $zabbix::params::manage_selinux,
String $additional_service_params = $zabbix::params::additional_service_params,
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,
Expand Down
5 changes: 5 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
$server_vmwarecachesize = '8M'
$server_vmwarefrequency = '60'
$server_vmwaretimeout = undef
$server_socketdir = undef

# Agent specific params
$agent_allowroot = '0'
Expand Down Expand Up @@ -425,6 +426,10 @@
$proxy_zabbix_server_host = undef
$proxy_zabbix_server_port = '10051'
$proxy_zbx_templates = ['Template App Zabbix Proxy']
$proxy_socketdir = versioncmp($zabbix_version, '5.0') ? {
-1 => undef,
default => '/var/run/zabbix',
}

# Java Gateway specific params
$javagateway_listenip = '0.0.0.0'
Expand Down
187 changes: 96 additions & 91 deletions manifests/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@
# [*loadmodule*]
# Module to load at server startup.
#
# [*socketdir*]
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
#
# === Example
#
# When you want to run everything on one machine, you can use the following
Expand Down Expand Up @@ -332,97 +336,98 @@
# Copyright 2014 Werner Dijkerman
#
class zabbix::proxy (
Zabbix::Databases $database_type = $zabbix::params::database_type,
$database_path = $zabbix::params::database_path,
$zabbix_version = $zabbix::params::zabbix_version,
$zabbix_package_state = $zabbix::params::zabbix_package_state,
Boolean $manage_database = $zabbix::params::manage_database,
Boolean $manage_firewall = $zabbix::params::manage_firewall,
Boolean $manage_repo = $zabbix::params::manage_repo,
Boolean $manage_resources = $zabbix::params::manage_resources,
Boolean $manage_service = $zabbix::params::manage_service,
$zabbix_proxy = $zabbix::params::zabbix_proxy,
$zabbix_proxy_ip = $zabbix::params::zabbix_proxy_ip,
$use_ip = $zabbix::params::proxy_use_ip,
$zbx_templates = $zabbix::params::proxy_zbx_templates,
$proxy_configfile_path = $zabbix::params::proxy_configfile_path,
$proxy_service_name = $zabbix::params::proxy_service_name,
$mode = $zabbix::params::proxy_mode,
$zabbix_server_host = $zabbix::params::proxy_zabbix_server_host,
$zabbix_server_port = $zabbix::params::proxy_zabbix_server_port,
$hostname = $zabbix::params::proxy_hostname,
$listenport = $zabbix::params::proxy_listenport,
$sourceip = $zabbix::params::proxy_sourceip,
Integer[0] $enableremotecommands = $zabbix::params::proxy_enableremotecommands,
Integer[0] $logremotecommands = $zabbix::params::proxy_logremotecommands,
$logfile = $zabbix::params::proxy_logfile,
$logfilesize = $zabbix::params::proxy_logfilesize,
$debuglevel = $zabbix::params::proxy_debuglevel,
$pidfile = $zabbix::params::proxy_pidfile,
$database_schema_path = $zabbix::params::database_schema_path,
$database_host = $zabbix::params::proxy_database_host,
$database_name = $zabbix::params::proxy_database_name,
$database_schema = $zabbix::params::proxy_database_schema,
$database_user = $zabbix::params::proxy_database_user,
$database_password = $zabbix::params::proxy_database_password,
$database_socket = $zabbix::params::proxy_database_socket,
$database_port = $zabbix::params::proxy_database_port,
$localbuffer = $zabbix::params::proxy_localbuffer,
$offlinebuffer = $zabbix::params::proxy_offlinebuffer,
$heartbeatfrequency = $zabbix::params::proxy_heartbeatfrequency,
$configfrequency = $zabbix::params::proxy_configfrequency,
$datasenderfrequency = $zabbix::params::proxy_datasenderfrequency,
$startpollers = $zabbix::params::proxy_startpollers,
$startipmipollers = $zabbix::params::proxy_startipmipollers,
$startpollersunreachable = $zabbix::params::proxy_startpollersunreachable,
$starttrappers = $zabbix::params::proxy_starttrappers,
$startpingers = $zabbix::params::proxy_startpingers,
$startdiscoverers = $zabbix::params::proxy_startdiscoverers,
$starthttppollers = $zabbix::params::proxy_starthttppollers,
$javagateway = $zabbix::params::proxy_javagateway,
$javagatewayport = $zabbix::params::proxy_javagatewayport,
$startjavapollers = $zabbix::params::proxy_startjavapollers,
$startvmwarecollectors = $zabbix::params::proxy_startvmwarecollectors,
$vmwarefrequency = $zabbix::params::proxy_vmwarefrequency,
$vmwareperffrequency = $zabbix::params::proxy_vmwareperffrequency,
$vmwarecachesize = $zabbix::params::proxy_vmwarecachesize,
$vmwaretimeout = $zabbix::params::proxy_vmwaretimeout,
$enablesnmpbulkrequests = $zabbix::params::proxy_enablesnmpbulkrequests,
$snmptrapperfile = $zabbix::params::proxy_snmptrapperfile,
$snmptrapper = $zabbix::params::proxy_snmptrapper,
$listenip = $zabbix::params::proxy_listenip,
$housekeepingfrequency = $zabbix::params::proxy_housekeepingfrequency,
$cachesize = $zabbix::params::proxy_cachesize,
$startdbsyncers = $zabbix::params::proxy_startdbsyncers,
$historycachesize = $zabbix::params::proxy_historycachesize,
$historyindexcachesize = $zabbix::params::proxy_historyindexcachesize,
$historytextcachesize = $zabbix::params::proxy_historytextcachesize,
$timeout = $zabbix::params::proxy_timeout,
$tlsaccept = $zabbix::params::proxy_tlsaccept,
$tlscafile = $zabbix::params::proxy_tlscafile,
$tlscertfile = $zabbix::params::proxy_tlscertfile,
$tlsconnect = $zabbix::params::proxy_tlsconnect,
$tlscrlfile = $zabbix::params::proxy_tlscrlfile,
$tlskeyfile = $zabbix::params::proxy_tlskeyfile,
$tlspskfile = $zabbix::params::proxy_tlspskfile,
$tlspskidentity = $zabbix::params::proxy_tlspskidentity,
$tlsservercertissuer = $zabbix::params::proxy_tlsservercertissuer,
$tlsservercertsubject = $zabbix::params::proxy_tlsservercertsubject,
$trappertimeout = $zabbix::params::proxy_trappertimeout,
$unreachableperiod = $zabbix::params::proxy_unreachableperiod,
$unavaliabledelay = $zabbix::params::proxy_unavaliabledelay,
$unreachabedelay = $zabbix::params::proxy_unreachabedelay,
$externalscripts = $zabbix::params::proxy_externalscripts,
$fpinglocation = $zabbix::params::proxy_fpinglocation,
$fping6location = $zabbix::params::proxy_fping6location,
$sshkeylocation = $zabbix::params::proxy_sshkeylocation,
$logslowqueries = $zabbix::params::proxy_logslowqueries,
$tmpdir = $zabbix::params::proxy_tmpdir,
$allowroot = $zabbix::params::proxy_allowroot,
$include_dir = $zabbix::params::proxy_include,
$loadmodulepath = $zabbix::params::proxy_loadmodulepath,
$loadmodule = $zabbix::params::proxy_loadmodule,
Boolean $manage_selinux = $zabbix::params::manage_selinux,
Zabbix::Databases $database_type = $zabbix::params::database_type,
$database_path = $zabbix::params::database_path,
$zabbix_version = $zabbix::params::zabbix_version,
$zabbix_package_state = $zabbix::params::zabbix_package_state,
Boolean $manage_database = $zabbix::params::manage_database,
Boolean $manage_firewall = $zabbix::params::manage_firewall,
Boolean $manage_repo = $zabbix::params::manage_repo,
Boolean $manage_resources = $zabbix::params::manage_resources,
Boolean $manage_service = $zabbix::params::manage_service,
$zabbix_proxy = $zabbix::params::zabbix_proxy,
$zabbix_proxy_ip = $zabbix::params::zabbix_proxy_ip,
$use_ip = $zabbix::params::proxy_use_ip,
$zbx_templates = $zabbix::params::proxy_zbx_templates,
$proxy_configfile_path = $zabbix::params::proxy_configfile_path,
$proxy_service_name = $zabbix::params::proxy_service_name,
$mode = $zabbix::params::proxy_mode,
$zabbix_server_host = $zabbix::params::proxy_zabbix_server_host,
$zabbix_server_port = $zabbix::params::proxy_zabbix_server_port,
$hostname = $zabbix::params::proxy_hostname,
$listenport = $zabbix::params::proxy_listenport,
$sourceip = $zabbix::params::proxy_sourceip,
Integer[0] $enableremotecommands = $zabbix::params::proxy_enableremotecommands,
Integer[0] $logremotecommands = $zabbix::params::proxy_logremotecommands,
$logfile = $zabbix::params::proxy_logfile,
$logfilesize = $zabbix::params::proxy_logfilesize,
$debuglevel = $zabbix::params::proxy_debuglevel,
$pidfile = $zabbix::params::proxy_pidfile,
$database_schema_path = $zabbix::params::database_schema_path,
$database_host = $zabbix::params::proxy_database_host,
$database_name = $zabbix::params::proxy_database_name,
$database_schema = $zabbix::params::proxy_database_schema,
$database_user = $zabbix::params::proxy_database_user,
$database_password = $zabbix::params::proxy_database_password,
$database_socket = $zabbix::params::proxy_database_socket,
$database_port = $zabbix::params::proxy_database_port,
$localbuffer = $zabbix::params::proxy_localbuffer,
$offlinebuffer = $zabbix::params::proxy_offlinebuffer,
$heartbeatfrequency = $zabbix::params::proxy_heartbeatfrequency,
$configfrequency = $zabbix::params::proxy_configfrequency,
$datasenderfrequency = $zabbix::params::proxy_datasenderfrequency,
$startpollers = $zabbix::params::proxy_startpollers,
$startipmipollers = $zabbix::params::proxy_startipmipollers,
$startpollersunreachable = $zabbix::params::proxy_startpollersunreachable,
$starttrappers = $zabbix::params::proxy_starttrappers,
$startpingers = $zabbix::params::proxy_startpingers,
$startdiscoverers = $zabbix::params::proxy_startdiscoverers,
$starthttppollers = $zabbix::params::proxy_starthttppollers,
$javagateway = $zabbix::params::proxy_javagateway,
$javagatewayport = $zabbix::params::proxy_javagatewayport,
$startjavapollers = $zabbix::params::proxy_startjavapollers,
$startvmwarecollectors = $zabbix::params::proxy_startvmwarecollectors,
$vmwarefrequency = $zabbix::params::proxy_vmwarefrequency,
$vmwareperffrequency = $zabbix::params::proxy_vmwareperffrequency,
$vmwarecachesize = $zabbix::params::proxy_vmwarecachesize,
$vmwaretimeout = $zabbix::params::proxy_vmwaretimeout,
$enablesnmpbulkrequests = $zabbix::params::proxy_enablesnmpbulkrequests,
$snmptrapperfile = $zabbix::params::proxy_snmptrapperfile,
$snmptrapper = $zabbix::params::proxy_snmptrapper,
$listenip = $zabbix::params::proxy_listenip,
$housekeepingfrequency = $zabbix::params::proxy_housekeepingfrequency,
$cachesize = $zabbix::params::proxy_cachesize,
$startdbsyncers = $zabbix::params::proxy_startdbsyncers,
$historycachesize = $zabbix::params::proxy_historycachesize,
$historyindexcachesize = $zabbix::params::proxy_historyindexcachesize,
$historytextcachesize = $zabbix::params::proxy_historytextcachesize,
$timeout = $zabbix::params::proxy_timeout,
$tlsaccept = $zabbix::params::proxy_tlsaccept,
$tlscafile = $zabbix::params::proxy_tlscafile,
$tlscertfile = $zabbix::params::proxy_tlscertfile,
$tlsconnect = $zabbix::params::proxy_tlsconnect,
$tlscrlfile = $zabbix::params::proxy_tlscrlfile,
$tlskeyfile = $zabbix::params::proxy_tlskeyfile,
$tlspskfile = $zabbix::params::proxy_tlspskfile,
$tlspskidentity = $zabbix::params::proxy_tlspskidentity,
$tlsservercertissuer = $zabbix::params::proxy_tlsservercertissuer,
$tlsservercertsubject = $zabbix::params::proxy_tlsservercertsubject,
$trappertimeout = $zabbix::params::proxy_trappertimeout,
$unreachableperiod = $zabbix::params::proxy_unreachableperiod,
$unavaliabledelay = $zabbix::params::proxy_unavaliabledelay,
$unreachabedelay = $zabbix::params::proxy_unreachabedelay,
$externalscripts = $zabbix::params::proxy_externalscripts,
$fpinglocation = $zabbix::params::proxy_fpinglocation,
$fping6location = $zabbix::params::proxy_fping6location,
$sshkeylocation = $zabbix::params::proxy_sshkeylocation,
$logslowqueries = $zabbix::params::proxy_logslowqueries,
$tmpdir = $zabbix::params::proxy_tmpdir,
$allowroot = $zabbix::params::proxy_allowroot,
$include_dir = $zabbix::params::proxy_include,
$loadmodulepath = $zabbix::params::proxy_loadmodulepath,
$loadmodule = $zabbix::params::proxy_loadmodule,
Boolean $manage_selinux = $zabbix::params::manage_selinux,
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::proxy_socketdir,
) inherits zabbix::params {
# check osfamily, Arch is currently not supported for web
if $facts['os']['family'] == 'Archlinux' {
Expand Down
5 changes: 5 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@
# [*manage_startup_script*]
# 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)
#
# [*socketdir*]
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
#
# === Example
#
# When running everything on a single node, please check
Expand Down Expand Up @@ -383,6 +387,7 @@
String $additional_service_params = $zabbix::params::additional_service_params,
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,
Boolean $manage_startup_script = $zabbix::params::manage_startup_script,
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::server_socketdir,
) inherits zabbix::params {
# the following codeblock is a bit blargh. The correct default value for
# $real_additional_service_params changes based on the value of $zabbix_version
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,17 @@
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^EnableRemoteCommands=1$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^LogRemoteCommands=1$} }
end

context 'with zabbix_proxy.conf and version 5.0' do
let :params do
{
socketdir: '/var/run/zabbix',
zabbix_version: '5.0'
}
end

it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^SocketDir=/var/run/zabbix} }
end
end
end
end
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,17 @@
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^HistoryIndexCacheSize=4M} }
end

context 'with zabbix_server.conf and version 5.0' do
let :params do
{
socketdir: '/var/run/zabbix',
zabbix_version: '5.0'
}
end

it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^SocketDir=/var/run/zabbix} }
end

context 'with zabbix_server.conf and system as logtype' do
let :params do
{
Expand Down
12 changes: 11 additions & 1 deletion templates/zabbix_proxy.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ DebugLevel=<%= @debuglevel %>
#
PidFile=<%= @pidfile %>
<% if @zabbix_version.to_f >= 5.0 %>
### Option: SocketDir
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
#
# Mandatory: no
# Default:

<% if @socketdir %>SocketDir=<%= @socketdir %><% end %>
<% end %>

### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
Expand Down Expand Up @@ -534,4 +545,3 @@ LoadModulePath=<%= @loadmodulepath %>
<% if @tlspskfile %>TLSPSKFile=<%= @tlspskfile %><% end %>
<% end %>

11 changes: 11 additions & 0 deletions templates/zabbix_server.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ DebugLevel=<%= @debuglevel %>
#
PidFile=<%= @pidfile %>
<% if @zabbix_version.to_f >= 3.4 %>
### Option: SocketDir
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
#
# Mandatory: no
# Default:

<% if @socketdir %>SocketDir=<%= @socketdir %><% end %>
<% end %>

### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
Expand Down

0 comments on commit 7ae8f5b

Please sign in to comment.