Skip to content

Commit db01009

Browse files
geirraGeir Råness
and
Geir Råness
authored
Add and remove Zabbix 6.0 + 6.4 options (HA mode, StatsAllowedIP, ProxyConfigFrequency, HeartbeatFrequency) (#921)
* add StatsAllowedIP for proxy and server * make value optional * remove ServerPort for proxy for versions below 6.0 - its deprecated * Add Zabbix 6.0 and 6.4 changes * add reference for statsallowedip * fix proxy--statsallowedip reference * add statsallowedip to params * add reference for HA (nodename + nodeaddress) * run strings:generate:reference * attempt to rewrite web_spec.rb checks * adjust web_spec.rb * fix context * remove emptyline --------- Co-authored-by: Geir Råness <[email protected]>
1 parent f10033f commit db01009

File tree

8 files changed

+156
-2
lines changed

8 files changed

+156
-2
lines changed

REFERENCE.md

+47-1
Original file line numberDiff line numberDiff line change
@@ -2545,6 +2545,7 @@ The following parameters are available in the `zabbix::proxy` class:
25452545
* [`offlinebuffer`](#-zabbix--proxy--offlinebuffer)
25462546
* [`heartbeatfrequency`](#-zabbix--proxy--heartbeatfrequency)
25472547
* [`configfrequency`](#-zabbix--proxy--configfrequency)
2548+
* [`proxyconfigfrequency`](#-zabbix--proxy--proxyconfigfrequency)
25482549
* [`datasenderfrequency`](#-zabbix--proxy--datasenderfrequency)
25492550
* [`startpollers`](#-zabbix--proxy--startpollers)
25502551
* [`startpreprocessors`](#-zabbix--proxy--startpreprocessors)
@@ -2600,6 +2601,7 @@ The following parameters are available in the `zabbix::proxy` class:
26002601
* [`fpinglocation`](#-zabbix--proxy--fpinglocation)
26012602
* [`fping6location`](#-zabbix--proxy--fping6location)
26022603
* [`sshkeylocation`](#-zabbix--proxy--sshkeylocation)
2604+
* [`statsallowedip`](#-zabbix--proxy--statsallowedip)
26032605
* [`sslcalocation_dir`](#-zabbix--proxy--sslcalocation_dir)
26042606
* [`sslcertlocation_dir`](#-zabbix--proxy--sslcertlocation_dir)
26052607
* [`sslkeylocation_dir`](#-zabbix--proxy--sslkeylocation_dir)
@@ -3004,6 +3006,14 @@ How often proxy retrieves configuration data from Zabbix Server in seconds.
30043006

30053007
Default value: `$zabbix::params::proxy_configfrequency`
30063008

3009+
##### <a name="-zabbix--proxy--proxyconfigfrequency"></a>`proxyconfigfrequency`
3010+
3011+
Data type: `Optional[Integer[1,604800]]`
3012+
3013+
How often proxy retrieves configuration data from Zabbix Server in seconds (Zabbix 6.4).
3014+
3015+
Default value: `$zabbix::params::proxy_proxyconfigfrequency`
3016+
30073017
##### <a name="-zabbix--proxy--datasenderfrequency"></a>`datasenderfrequency`
30083018

30093019
Data type: `Any`
@@ -3452,6 +3462,14 @@ Location of public and private keys for ssh checks and actions.
34523462

34533463
Default value: `$zabbix::params::proxy_sshkeylocation`
34543464

3465+
##### <a name="-zabbix--proxy--statsallowedip"></a>`statsallowedip`
3466+
3467+
Data type: `Optional[String[1]]`
3468+
3469+
list of allowed ipadresses that can access the internal stats of zabbix proxy over network
3470+
3471+
Default value: `$zabbix::params::proxy_statsallowedip`
3472+
34553473
##### <a name="-zabbix--proxy--sslcalocation_dir"></a>`sslcalocation_dir`
34563474

34573475
Data type: `Optional[Stdlib::Absolutepath]`
@@ -4009,6 +4027,7 @@ The following parameters are available in the `zabbix::server` class:
40094027
* [`proxydatafrequency`](#-zabbix--server--proxydatafrequency)
40104028
* [`allowroot`](#-zabbix--server--allowroot)
40114029
* [`include_dir`](#-zabbix--server--include_dir)
4030+
* [`statsallowedip`](#-zabbix--server--statsallowedip)
40124031
* [`loadmodulepath`](#-zabbix--server--loadmodulepath)
40134032
* [`loadmodule`](#-zabbix--server--loadmodule)
40144033
* [`sslcertlocation_dir`](#-zabbix--server--sslcertlocation_dir)
@@ -4018,6 +4037,8 @@ The following parameters are available in the `zabbix::server` class:
40184037
* [`zabbix_user`](#-zabbix--server--zabbix_user)
40194038
* [`manage_startup_script`](#-zabbix--server--manage_startup_script)
40204039
* [`socketdir`](#-zabbix--server--socketdir)
4040+
* [`hanodename`](#-zabbix--server--hanodename)
4041+
* [`nodeaddress`](#-zabbix--server--nodeaddress)
40214042

40224043
##### <a name="-zabbix--server--database_type"></a>`database_type`
40234044

@@ -4832,6 +4853,14 @@ You may include individual files or all files in a directory in the configuratio
48324853

48334854
Default value: `$zabbix::params::server_include`
48344855

4856+
##### <a name="-zabbix--server--statsallowedip"></a>`statsallowedip`
4857+
4858+
Data type: `Optional[String[1]]`
4859+
4860+
list of allowed ipadresses that can access the internal stats of zabbix server over network
4861+
4862+
Default value: `$zabbix::params::server_statsallowedip`
4863+
48354864
##### <a name="-zabbix--server--loadmodulepath"></a>`loadmodulepath`
48364865

48374866
Data type: `Any`
@@ -4900,10 +4929,27 @@ Default value: `$zabbix::params::manage_startup_script`
49004929

49014930
Data type: `Optional[Stdlib::Absolutepath]`
49024931

4932+
4933+
4934+
Default value: `$zabbix::params::server_socketdir`
4935+
4936+
##### <a name="-zabbix--server--hanodename"></a>`hanodename`
4937+
4938+
Data type: `Optional[String[1]]`
4939+
4940+
Node name identifier in HA setup
4941+
4942+
Default value: `$zabbix::params::server_hanodename`
4943+
4944+
##### <a name="-zabbix--server--nodeaddress"></a>`nodeaddress`
4945+
4946+
Data type: `Optional[String[1]]`
4947+
4948+
Connection details to the HA node, used to check if zabbix-web can talk to zabbix server
49034949
IPC socket directory.
49044950
Directory to store IPC sockets used by internal Zabbix services.
49054951

4906-
Default value: `$zabbix::params::server_socketdir`
4952+
Default value: `$zabbix::params::server_nodeaddress`
49074953

49084954
### <a name="zabbix--userparameter"></a>`zabbix::userparameter`
49094955

manifests/params.pp

100644100755
+5
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@
260260
$server_starttimers = '1'
261261
$server_starttrappers = '5'
262262
$server_startvmwarecollectors = '0'
263+
$server_statsallowedip = undef
263264
$server_timeout = '3'
264265
$server_database_tlsconnect = undef
265266
$server_database_tlscafile = undef
@@ -291,6 +292,8 @@
291292
$server_vmwarefrequency = '60'
292293
$server_vmwaretimeout = undef
293294
$server_socketdir = undef
295+
$server_hanodename = undef
296+
$server_nodeaddress = undef
294297

295298
# Agent specific params
296299
$agent_allowroot = '0'
@@ -367,6 +370,7 @@
367370
$proxy_cachesize = '32M'
368371
$proxy_configfile_path = '/etc/zabbix/zabbix_proxy.conf'
369372
$proxy_configfrequency = '3600'
373+
$proxy_proxyconfigfrequency = undef
370374
$proxy_database_host = 'localhost'
371375
$proxy_database_name = 'zabbix_proxy'
372376
$proxy_database_password = 'zabbix-proxy'
@@ -425,6 +429,7 @@
425429
$proxy_startpreprocessors = 3
426430
$proxy_starttrappers = '5'
427431
$proxy_startvmwarecollectors = '0'
432+
$proxy_statsallowedip = undef
428433
$proxy_timeout = '3'
429434
$proxy_database_tlsconnect = undef
430435
$proxy_database_tlscafile = undef

manifests/proxy.pp

100644100755
+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
# @param offlinebuffer Proxy will keep data for N hours in case if no connectivity with Zabbix Server
6060
# @param heartbeatfrequency Unique nodeid in distributed setup.
6161
# @param configfrequency How often proxy retrieves configuration data from Zabbix Server in seconds.
62+
# @param proxyconfigfrequency How often proxy retrieves configuration data from Zabbix Server in seconds (Zabbix 6.4).
6263
# @param datasenderfrequency Proxy will send collected data to the Server every N seconds.
6364
# @param startpollers Number of pre-forked instances of pollers.
6465
# @param startpreprocessors Number of pre-forked instances of preprocessing workers
@@ -130,6 +131,7 @@
130131
# @param fpinglocation Location of fping.
131132
# @param fping6location Location of fping6.
132133
# @param sshkeylocation Location of public and private keys for ssh checks and actions.
134+
# @param statsallowedip list of allowed ipadresses that can access the internal stats of zabbix proxy over network
133135
# @param sslcalocation_dir Location of certificate authority (CA) files for SSL server certificate verification.
134136
# @param sslcertlocation_dir Location of SSL client certificate files for client authentication.
135137
# @param sslkeylocation_dir Location of SSL private key files for client authentication.
@@ -235,6 +237,7 @@
235237
$offlinebuffer = $zabbix::params::proxy_offlinebuffer,
236238
$heartbeatfrequency = $zabbix::params::proxy_heartbeatfrequency,
237239
$configfrequency = $zabbix::params::proxy_configfrequency,
240+
Optional[Integer[1,604800]] $proxyconfigfrequency = $zabbix::params::proxy_proxyconfigfrequency,
238241
$datasenderfrequency = $zabbix::params::proxy_datasenderfrequency,
239242
$startpollers = $zabbix::params::proxy_startpollers,
240243
$startipmipollers = $zabbix::params::proxy_startipmipollers,
@@ -290,6 +293,7 @@
290293
$fpinglocation = $zabbix::params::proxy_fpinglocation,
291294
$fping6location = $zabbix::params::proxy_fping6location,
292295
$sshkeylocation = $zabbix::params::proxy_sshkeylocation,
296+
Optional[String[1]] $statsallowedip = $zabbix::params::proxy_statsallowedip,
293297
$logslowqueries = $zabbix::params::proxy_logslowqueries,
294298
$tmpdir = $zabbix::params::proxy_tmpdir,
295299
$allowroot = $zabbix::params::proxy_allowroot,

manifests/server.pp

100644100755
+6
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
# @param proxydatafrequency How often zabbix server requests history data from a zabbix proxy in seconds.
132132
# @param allowroot Allow the server to run as 'root'.
133133
# @param include_dir You may include individual files or all files in a directory in the configuration file.
134+
# @param statsallowedip list of allowed ipadresses that can access the internal stats of zabbix server over network
134135
# @param loadmodulepath Full path to location of server modules.
135136
# @param loadmodule Module to load at server startup.
136137
# @param sslcertlocation_dir Location of SSL client certificate files for client authentication.
@@ -140,6 +141,8 @@
140141
# @param zabbix_user User the zabbix service will run as.
141142
# @param 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)
142143
# @param socketdir
144+
# @param hanodename Node name identifier in HA setup
145+
# @param nodeaddress Connection details to the HA node, used to check if zabbix-web can talk to zabbix server
143146
# IPC socket directory.
144147
# Directory to store IPC sockets used by internal Zabbix services.
145148
# @example
@@ -268,12 +271,15 @@
268271
$loadmodule = $zabbix::params::server_loadmodule,
269272
$sslcertlocation_dir = $zabbix::params::server_sslcertlocation,
270273
$sslkeylocation_dir = $zabbix::params::server_sslkeylocation,
274+
Optional[String[1]] $statsallowedip = $zabbix::params::server_statsallowedip,
271275
Boolean $manage_selinux = $zabbix::params::manage_selinux,
272276
String $additional_service_params = $zabbix::params::additional_service_params,
273277
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,
274278
Boolean $manage_startup_script = $zabbix::params::manage_startup_script,
275279
Optional[Stdlib::Absolutepath] $socketdir = $zabbix::params::server_socketdir,
276280
Optional[Stdlib::HTTPUrl] $webserviceurl = undef,
281+
Optional[String[1]] $hanodename = $zabbix::params::server_hanodename,
282+
Optional[String[1]] $nodeaddress = $zabbix::params::server_nodeaddress,
277283
) inherits zabbix::params {
278284
# zabbix server 5.2, 5.4 and 6.0 is not supported on RHEL 7.
279285
# https://www.zabbix.com/documentation/current/manual/installation/install_from_packages/rhel_centos

spec/classes/web_spec.rb

+22-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class { 'apache':
195195

196196
it { is_expected.to contain_apache__vhost('zabbix.example.com').with_name('zabbix.example.com') }
197197

198-
context 'with database_* settings' do
198+
context 'with database_* settings and zabbix_version 6.0' do
199199
let :params do
200200
super().merge(
201201
database_host: 'localhost',
@@ -209,6 +209,27 @@ class { 'apache':
209209
)
210210
end
211211

212+
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['SERVER'\] = 'localhost'}) }
213+
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['DATABASE'\] = 'zabbix-server'}) }
214+
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['USER'\] = 'zabbix-server'}) }
215+
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['PASSWORD'\] = 'zabbix-server'}) }
216+
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$ZBX_SERVER_NAME = 'localhost'}) }
217+
end
218+
219+
context 'with database_* settings and zabbix_version 5.0' do
220+
let :params do
221+
super().merge(
222+
database_host: 'localhost',
223+
database_name: 'zabbix-server',
224+
database_user: 'zabbix-server',
225+
database_password: 'zabbix-server',
226+
zabbix_server: 'localhost',
227+
zabbix_listenport: '3306',
228+
zabbix_server_name: 'localhost',
229+
zabbix_version: '5.0'
230+
)
231+
end
232+
212233
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['SERVER'\] = 'localhost'}) }
213234
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['DATABASE'\] = 'zabbix-server'}) }
214235
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['USER'\] = 'zabbix-server'}) }

templates/web/zabbix.conf.php.erb

100644100755
+2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ $DB['SCHEMA'] = '';
2626
$DB['DOUBLE_IEEE754'] = 'true';
2727
<% end -%>
2828

29+
<% if @zabbix_version.to_f < 6.0 -%>
2930
$ZBX_SERVER = '<%= @zabbix_server %>';
3031
$ZBX_SERVER_PORT = '<%= @zabbix_listenport %>';
32+
<% end -%>
3133
$ZBX_SERVER_NAME = '<%= @zabbix_server_name %>';
3234

3335
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

templates/zabbix_proxy.conf.erb

100644100755
+30
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ ProxyMode=<%= @mode %>
1717
#
1818
Server=<%= @zabbix_server_host %>
1919

20+
<% if @zabbix_version.to_f < 6.0 %>
2021
### Option: ServerPort
2122
# Port of Zabbix trapper on Zabbix server.
2223
# For a proxy in the passive mode this parameter will be ignored.
2324
#
2425
ServerPort=<%= @zabbix_server_port %>
26+
<% end %>
2527

2628
### Option: Hostname
2729
# Unique, case sensitive Proxy name. Make sure the Proxy name is known to the server!
@@ -162,6 +164,7 @@ ProxyLocalBuffer=<%= @localbuffer %>
162164
#
163165
ProxyOfflineBuffer=<%= @offlinebuffer %>
164166

167+
<% if @zabbix_version.to_f < 6.4 %>
165168
### Option: HeartbeatFrequency
166169
# Frequency of heartbeat messages in seconds.
167170
# Used for monitoring availability of Proxy on server side.
@@ -175,6 +178,19 @@ HeartbeatFrequency=<%= @heartbeatfrequency %>
175178
# For a proxy in the passive mode this parameter will be ignored.
176179
#
177180
ConfigFrequency=<%= @configfrequency %>
181+
<% end %>
182+
183+
<% if @zabbix_version.to_f >= 6.4 %>
184+
### Option: ProxyConfigFrequency
185+
# How often proxy retrieves configuration data from Zabbix Server in seconds.
186+
# For a proxy in the passive mode this parameter will be ignored.
187+
#
188+
# Mandatory: no
189+
# Range: 1-3600*24*7
190+
# Default:
191+
# ProxyConfigFrequency=10
192+
<% if @proxyconfigfrequency %>ProxyConfigFrequency=<%= @proxyconfigfrequency %><% end %>
193+
<% end %>
178194

179195
### Option: DataSenderFrequency
180196
# Proxy will send collected data to the Server every N seconds.
@@ -457,6 +473,20 @@ LoadModulePath=<%= @loadmodulepath %>
457473
#
458474
<% if @loadmodule %>LoadModule=<%= @loadmodule %><% end %>
459475

476+
### Option: StatsAllowedIP
477+
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of external Zabbix instances.
478+
# Stats request will be accepted only from the addresses listed here. If this parameter is not set no stats requests
479+
# will be accepted.
480+
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
481+
# and '::/0' will allow any IPv4 or IPv6 address.
482+
# '0.0.0.0/0' can be used to allow any IPv4 address.
483+
# Example: StatsAllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
484+
#
485+
# Mandatory: no
486+
# Default:
487+
# StatsAllowedIP=
488+
<% if @statsallowedip %>StatsAllowedIP=<%= @statsallowedip %><% end %>
489+
460490
####### TLS-RELATED PARAMETERS #######
461491

462492
### Option: TLSConnect

templates/zabbix_server.conf.erb

100644100755
+40
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,20 @@ SSLKeyLocation=<%= @sslkeylocation_dir %>
447447
#
448448
<% if @sslcalocation_dir %>SSLCALocation=<%= @sslcalocation_dir %><% end %>
449449

450+
### Option: StatsAllowedIP
451+
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of external Zabbix instances.
452+
# Stats request will be accepted only from the addresses listed here. If this parameter is not set no stats requests
453+
# will be accepted.
454+
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
455+
# and '::/0' will allow any IPv4 or IPv6 address.
456+
# '0.0.0.0/0' can be used to allow any IPv4 address.
457+
# Example: StatsAllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
458+
#
459+
# Mandatory: no
460+
# Default:
461+
# StatsAllowedIP=
462+
<% if @statsallowedip %>StatsAllowedIP=<%= @statsallowedip %><% end %>
463+
450464
####### LOADABLE MODULES #######
451465

452466
### Option: LoadModulePath
@@ -676,3 +690,29 @@ LoadModulePath=<%= @loadmodulepath %>
676690
# WebServiceURL=
677691
<% if @webserviceurl %>WebServiceURL=<%= @webserviceurl -%><% end %>
678692
<% end %>
693+
694+
<% if @zabbix_version.to_f >= 6.0 %>
695+
####### High availability cluster parameters #######
696+
697+
## Option: HANodeName
698+
# The high availability cluster node name.
699+
# When empty, server is working in standalone mode; a node with empty name is registered with address for the frontend to connect to.
700+
#
701+
# Mandatory: no
702+
# Default:
703+
# HANodeName=
704+
<% if @hanodename %>HANodeName=<%= @hanodename -%><% end %>
705+
706+
## Option: NodeAddress
707+
# IP or hostname with optional port to specify how frontend should connect to the server.
708+
# Format: <address>[:<port>]
709+
#
710+
# If IP or hostname is not set, then ListenIP value will be used. In case ListenIP is not set, localhost will be used.
711+
# If port is not set, then ListenPort value will be used. In case ListenPort is not set, 10051 will be used.
712+
# This option can be overridden by address specified in frontend configuration.
713+
#
714+
# Mandatory: no
715+
# Default:
716+
# NodeAddress=localhost:10051
717+
<% if @nodeaddress %>NodeAddress=<%= @nodeaddress -%><% end %>
718+
<% end %>

0 commit comments

Comments
 (0)