Skip to content

Commit 4f4b519

Browse files
Add configuration parameters to Server and Agent
- Server: - making StartHistoryPollers configurable - adding TrendFunctionCacheSize parameter to config file - Agent: - adding StatusPort parameter to config file - adding PersistentBufferPeriod parameter to config file - adding ControlSocket parameter to config file - Proxy - making ProxyBufferMode configurable - making ProxyMemoryBufferSize configurable - making ProxyMemoryBufferAge configurable
1 parent 0c2853d commit 4f4b519

11 files changed

+183
-6
lines changed

REFERENCE.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,7 @@ The following parameters are available in the `zabbix::agent` class:
14001400
* [`server`](#-zabbix--agent--server)
14011401
* [`listenport`](#-zabbix--agent--listenport)
14021402
* [`listenip`](#-zabbix--agent--listenip)
1403+
* [`statusport`](#-zabbix--agent--statusport)
14031404
* [`startagents`](#-zabbix--agent--startagents)
14041405
* [`serveractive`](#-zabbix--agent--serveractive)
14051406
* [`service_ensure`](#-zabbix--agent--service_ensure)
@@ -1413,6 +1414,9 @@ The following parameters are available in the `zabbix::agent` class:
14131414
* [`refreshactivechecks`](#-zabbix--agent--refreshactivechecks)
14141415
* [`buffersend`](#-zabbix--agent--buffersend)
14151416
* [`buffersize`](#-zabbix--agent--buffersize)
1417+
* [`enablepersistentbuffer`](#-zabbix--agent--enablepersistentbuffer)
1418+
* [`persistentbufferperiod`](#-zabbix--agent--persistentbufferperiod)
1419+
* [`persistentbufferfile`](#-zabbix--agent--persistentbufferfile)
14161420
* [`maxlinespersecond`](#-zabbix--agent--maxlinespersecond)
14171421
* [`allowroot`](#-zabbix--agent--allowroot)
14181422
* [`zabbix_user`](#-zabbix--agent--zabbix_user)
@@ -1447,6 +1451,7 @@ The following parameters are available in the `zabbix::agent` class:
14471451
* [`include_dir_purge`](#-zabbix--agent--include_dir_purge)
14481452
* [`unsafeuserparameters`](#-zabbix--agent--unsafeuserparameters)
14491453
* [`userparameter`](#-zabbix--agent--userparameter)
1454+
* [`controlsocket`](#-zabbix--agent--controlsocket)
14501455
* [`loadmodulepath`](#-zabbix--agent--loadmodulepath)
14511456
* [`loadmodule`](#-zabbix--agent--loadmodule)
14521457
* [`manage_startup_script`](#-zabbix--agent--manage_startup_script)
@@ -1721,6 +1726,14 @@ if more than 1 interface is on the server.
17211726

17221727
Default value: `$zabbix::params::agent_listenip`
17231728

1729+
##### <a name="-zabbix--agent--statusport"></a>`statusport`
1730+
1731+
Data type: `Optional[Integer[1024,32767]]`
1732+
1733+
Agent will listen on this port for HTTP status requests.
1734+
1735+
Default value: `$zabbix::params::agent_statusport`
1736+
17241737
##### <a name="-zabbix--agent--startagents"></a>`startagents`
17251738

17261739
Data type: `Any`
@@ -1827,6 +1840,30 @@ Maximum number of values in a memory buffer.
18271840

18281841
Default value: `$zabbix::params::agent_buffersize`
18291842

1843+
##### <a name="-zabbix--agent--enablepersistentbuffer"></a>`enablepersistentbuffer`
1844+
1845+
Data type: `Optional[Integer[0,1]]`
1846+
1847+
Use persistent buffer (set to 1), or in-memory buffer is used (default).
1848+
1849+
Default value: `$zabbix::params::agent_enablepersistentbuffer`
1850+
1851+
##### <a name="-zabbix--agent--persistentbufferperiod"></a>`persistentbufferperiod`
1852+
1853+
Data type: `Optional[String[1]]`
1854+
1855+
Zabbix Agent2 will keep data for this time period in case of no connectivity with Zabbix server or proxy.
1856+
1857+
Default value: `$zabbix::params::agent_persistentbufferperiod`
1858+
1859+
##### <a name="-zabbix--agent--persistentbufferfile"></a>`persistentbufferfile`
1860+
1861+
Data type: `Optional[Stdlib::Absolutepath]`
1862+
1863+
Full filename. Zabbix Agent2 will keep SQLite database in this file.
1864+
1865+
Default value: `$zabbix::params::agent_persistentbufferfile`
1866+
18301867
##### <a name="-zabbix--agent--maxlinespersecond"></a>`maxlinespersecond`
18311868

18321869
Data type: `Any`
@@ -2105,6 +2142,14 @@ User-defined parameter to monitor.
21052142

21062143
Default value: `$zabbix::params::agent_userparameter`
21072144

2145+
##### <a name="-zabbix--agent--controlsocket"></a>`controlsocket`
2146+
2147+
Data type: `Optional[Stdlib::Absolutepath]`
2148+
2149+
The control socket, used to send runtime commands with '-R' option.
2150+
2151+
Default value: `$zabbix::params::agent_controlsocket`
2152+
21082153
##### <a name="-zabbix--agent--loadmodulepath"></a>`loadmodulepath`
21092154

21102155
Data type: `Optional[String[1]]`
@@ -4013,6 +4058,7 @@ The following parameters are available in the `zabbix::server` class:
40134058
* [`startalerters`](#-zabbix--server--startalerters)
40144059
* [`startdiscoverers`](#-zabbix--server--startdiscoverers)
40154060
* [`startescalators`](#-zabbix--server--startescalators)
4061+
* [`starthistorypollers`](#-zabbix--server--starthistorypollers)
40164062
* [`starthttppollers`](#-zabbix--server--starthttppollers)
40174063
* [`starttimers`](#-zabbix--server--starttimers)
40184064
* [`javagateway`](#-zabbix--server--javagateway)
@@ -4040,6 +4086,7 @@ The following parameters are available in the `zabbix::server` class:
40404086
* [`historycachesize`](#-zabbix--server--historycachesize)
40414087
* [`historyindexcachesize`](#-zabbix--server--historyindexcachesize)
40424088
* [`trendcachesize`](#-zabbix--server--trendcachesize)
4089+
* [`trendfunctioncachesize`](#-zabbix--server--trendfunctioncachesize)
40434090
* [`valuecachesize`](#-zabbix--server--valuecachesize)
40444091
* [`timeout`](#-zabbix--server--timeout)
40454092
* [`tlscafile`](#-zabbix--server--tlscafile)
@@ -4450,6 +4497,14 @@ Number of pre-forked instances of escalators.
44504497

44514498
Default value: `$zabbix::params::server_startescalators`
44524499

4500+
##### <a name="-zabbix--server--starthistorypollers"></a>`starthistorypollers`
4501+
4502+
Data type: `Optional[Integer[0, 100]]`
4503+
4504+
Number of pre-forked instances of history pollers.
4505+
4506+
Default value: `$zabbix::params::server_starthistorypollers`
4507+
44534508
##### <a name="-zabbix--server--starthttppollers"></a>`starthttppollers`
44544509

44554510
Data type: `Any`
@@ -4672,6 +4727,14 @@ Size of trend cache, in bytes.
46724727

46734728
Default value: `$zabbix::params::server_trendcachesize`
46744729

4730+
##### <a name="-zabbix--server--trendfunctioncachesize"></a>`trendfunctioncachesize`
4731+
4732+
Data type: `Optional[String[1]]`
4733+
4734+
Size of trend function cache, in bytes.
4735+
4736+
Default value: `$zabbix::params::server_trendfunctioncachesize`
4737+
46754738
##### <a name="-zabbix--server--valuecachesize"></a>`valuecachesize`
46764739

46774740
Data type: `Any`

manifests/agent.pp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
# It will find out which ip is configured for this ipaddress. Can be handy
5454
# if more than 1 interface is on the server.
5555
#
56+
# @param statusport Agent will listen on this port for HTTP status requests.
5657
# @param startagents Number of pre-forked instances of zabbix_agentd that process passive checks.
5758
# @param serveractive List of comma delimited ip:port (or hostname:port) pairs of zabbix servers for active checks.
5859
# @param service_ensure Start / stop the agent service. E.g. to preconfigure a hosts agent and turn on the service at a later time (when the server reaches production SLA)
@@ -70,6 +71,9 @@
7071
# @param refreshactivechecks How often list of active checks is refreshed, in seconds.
7172
# @param buffersend Do not keep data longer than n seconds in buffer.
7273
# @param buffersize Maximum number of values in a memory buffer.
74+
# @param enablepersistentbuffer Use persistent buffer (set to 1), or in-memory buffer is used (default).
75+
# @param persistentbufferperiod Zabbix Agent2 will keep data for this time period in case of no connectivity with Zabbix server or proxy.
76+
# @param persistentbufferfile Full filename. Zabbix Agent2 will keep SQLite database in this file.
7377
# @param maxlinespersecond Maximum number of new lines the agent will send per second to zabbix server or proxy processing.
7478
# @param allowroot Allow the agent to run as 'root'.
7579
# @param zabbix_user Drop privileges to a specific, existing user on the system. Only has effect if run as 'root' and AllowRoot is disabled.
@@ -116,6 +120,7 @@
116120
# @param include_dir_purge Include dir to purge.
117121
# @param unsafeuserparameters Allow all characters to be passed in arguments to user-defined parameters.
118122
# @param userparameter User-defined parameter to monitor.
123+
# @param controlsocket The control socket, used to send runtime commands with '-R' option.
119124
# @param loadmodulepath Full path to location of agent modules.
120125
# @param loadmodule Module to load at agent startup.
121126
# @param manage_startup_script
@@ -179,6 +184,7 @@
179184
$server = $zabbix::params::agent_server,
180185
$listenport = $zabbix::params::agent_listenport,
181186
$listenip = $zabbix::params::agent_listenip,
187+
Optional[Integer[1024,32767]] $statusport = $zabbix::params::agent_statusport,
182188
$startagents = $zabbix::params::agent_startagents,
183189
$serveractive = $zabbix::params::agent_serveractive,
184190
Stdlib::Ensure::Service $service_ensure = $zabbix::params::agent_service_ensure,
@@ -192,6 +198,9 @@
192198
$refreshactivechecks = $zabbix::params::agent_refreshactivechecks,
193199
$buffersend = $zabbix::params::agent_buffersend,
194200
$buffersize = $zabbix::params::agent_buffersize,
201+
Optional[Integer[0,1]] $enablepersistentbuffer = $zabbix::params::agent_enablepersistentbuffer,
202+
Optional[Stdlib::Absolutepath] $persistentbufferfile = $zabbix::params::agent_persistentbufferfile,
203+
Optional[String[1]] $persistentbufferperiod = $zabbix::params::agent_persistentbufferperiod,
195204
$maxlinespersecond = $zabbix::params::agent_maxlinespersecond,
196205
Optional[Array] $zabbix_alias = $zabbix::params::agent_zabbix_alias,
197206
$timeout = $zabbix::params::agent_timeout,
@@ -201,6 +210,7 @@
201210
$include_dir_purge = $zabbix::params::agent_include_purge,
202211
$unsafeuserparameters = $zabbix::params::agent_unsafeuserparameters,
203212
$userparameter = $zabbix::params::agent_userparameter,
213+
Optional[Stdlib::Absolutepath] $controlsocket = $zabbix::params::agent_controlsocket,
204214
Optional[String[1]] $loadmodulepath = $zabbix::params::agent_loadmodulepath,
205215
$loadmodule = $zabbix::params::agent_loadmodule,
206216
Optional[Variant[Array[Enum['unencrypted','psk','cert']],Enum['unencrypted','psk','cert']]] $tlsaccept = $zabbix::params::agent_tlsaccept,

manifests/params.pp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248
$server_startalerters = 3
249249
$server_startdiscoverers = '1'
250250
$server_startescalators = 1
251+
$server_starthistorypollers = 5
251252
$server_starthttppollers = '1'
252253
$server_startipmipollers = '0'
253254
$server_startjavapollers = '5'
@@ -283,6 +284,7 @@
283284
$server_tmpdir = '/tmp'
284285
$server_trappertimeout = '300'
285286
$server_trendcachesize = '4M'
287+
$server_trendfunctioncachesize = undef
286288
$server_unavailabledelay = '60'
287289
$server_unreachabledelay = '15'
288290
$server_unreachableperiod = '45'
@@ -301,9 +303,11 @@
301303
$agent_allowroot = '0'
302304
$agent_buffersend = '5'
303305
$agent_buffersize = '100'
306+
$agent_controlsocket = undef
304307
$agent_debuglevel = '3'
305308
$agent_allowkey = undef
306309
$agent_denykey = undef
310+
$agent_enablepersistentbuffer = undef
307311
$agent_enableremotecommands = '0'
308312
$agent_hostmetadata = undef
309313
$agent_hostmetadataitem = undef
@@ -314,9 +318,12 @@
314318
$agent_include_purge = true
315319
$agent_listenip = undef
316320
$agent_listenport = '10050'
321+
$agent_statusport = undef
317322
$agent_loadmodule = undef
318323
$agent_logremotecommands = '0'
319324
$agent_maxlinespersecond = '100'
325+
$agent_persistentbufferfile = undef
326+
$agent_persistentbufferperiod = undef
320327
$agent_refreshactivechecks = '120'
321328
$agent_server = '127.0.0.1'
322329
$agent_serveractive = undef
@@ -369,6 +376,7 @@
369376

370377
# Proxy specific params
371378
$proxy_allowroot = '0'
379+
# $proxy_buffermode = 'disk'
372380
$proxy_cachesize = '32M'
373381
$proxy_configfile_path = '/etc/zabbix/zabbix_proxy.conf'
374382
$proxy_configfrequency = '3600'
@@ -408,6 +416,8 @@
408416
$proxy_logfilesize = '10'
409417
$proxy_logremotecommands = 0
410418
$proxy_logslowqueries = '0'
419+
# $proxy_memorybufferage = 0
420+
# $proxy_memorybuffersize = '0'
411421
$proxy_mode = '0'
412422
$proxy_offlinebuffer = '1'
413423
$proxy_pidfile = '/var/run/zabbix/zabbix_proxy.pid'

manifests/proxy.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@
235235
Optional[String[1]] $database_tlscipher13 = $zabbix::params::proxy_database_tlscipher13,
236236
$localbuffer = $zabbix::params::proxy_localbuffer,
237237
$offlinebuffer = $zabbix::params::proxy_offlinebuffer,
238+
# Optional[Enum['disk', 'memory', 'hybrid']] $buffermode = $zabbix::params::proxy_buffermode,
239+
# Optional[String[1]] $memorybuffersize = $zabbix::params::proxy_memorybuffersize,
240+
# Optional[Variant[Integer[0], Integer[600, 864000]]] $memorybufferage = $zabbix::params::proxy_memorybufferage,
238241
$heartbeatfrequency = $zabbix::params::proxy_heartbeatfrequency,
239242
$configfrequency = $zabbix::params::proxy_configfrequency,
240243
Optional[Integer[1,604800]] $proxyconfigfrequency = $zabbix::params::proxy_proxyconfigfrequency,

manifests/server.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
# @param startalerters Number of pre-forked instances of alerters.
5858
# @param startdiscoverers Number of pre-forked instances of discoverers.
5959
# @param startescalators Number of pre-forked instances of escalators.
60+
# @param starthistorypollers Number of pre-forked instances of history pollers.
6061
# @param starthttppollers Number of pre-forked instances of http pollers.
6162
# @param starttimers Number of pre-forked instances of timers.
6263
# @param javagateway IP address (or hostname) of zabbix java gateway.
@@ -92,6 +93,7 @@
9293
# @param historycachesize Size of history cache, in bytes.
9394
# @param historyindexcachesize Size of history index cache, in bytes.
9495
# @param trendcachesize Size of trend cache, in bytes.
96+
# @param trendfunctioncachesize Size of trend function cache, in bytes.
9597
# @param valuecachesize Size of history value cache, in bytes.
9698
# @param timeout Specifies how long we wait for agent, snmp device or external check (in seconds).
9799
# @param tlscafile Full pathname of a file containing the top-level CA(s) certificates for peer certificate verification.
@@ -216,6 +218,7 @@
216218
Integer[1, 100] $startalerters = $zabbix::params::server_startalerters,
217219
$startdiscoverers = $zabbix::params::server_startdiscoverers,
218220
Integer[1, 100] $startescalators = $zabbix::params::server_startescalators,
221+
Optional[Integer[0, 100]] $starthistorypollers = $zabbix::params::server_starthistorypollers,
219222
$starthttppollers = $zabbix::params::server_starthttppollers,
220223
$starttimers = $zabbix::params::server_starttimers,
221224
$javagateway = $zabbix::params::server_javagateway,
@@ -241,6 +244,7 @@
241244
$historycachesize = $zabbix::params::server_historycachesize,
242245
$historyindexcachesize = $zabbix::params::server_historyindexcachesize,
243246
$trendcachesize = $zabbix::params::server_trendcachesize,
247+
Optional[String[1]] $trendfunctioncachesize = $zabbix::params::server_trendfunctioncachesize,
244248
$valuecachesize = $zabbix::params::server_valuecachesize,
245249
$timeout = $zabbix::params::server_timeout,
246250
$tlscafile = $zabbix::params::server_tlscafile,

spec/classes/agent_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292
agent_configfile_path: '/etc/zabbix/zabbix_agentd.conf',
293293
buffersend: '5',
294294
buffersize: '100',
295+
controlsocket: '/tmp/agent.sock',
295296
debuglevel: '4',
296297
allowkey: 'system.run[*]',
297298
denykey: 'system.run[*]',
@@ -334,6 +335,7 @@
334335
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^AllowRoot=0$} }
335336
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^BufferSend=5$} }
336337
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^BufferSize=100$} }
338+
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^ControlSocket=/tmp/agent.sock$} }
337339
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^DebugLevel=4$} }
338340
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^AllowKey=system.run\[\*\]$} }
339341
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^DenyKey=system.run\[\*\]$} }
@@ -499,7 +501,9 @@
499501
maxlinespersecond: 1, allowroot: 1, zabbix_user: 'root',
500502
loadmodulepath: '/tmp', allowkey: 'system.run[*]',
501503
denykey: 'system.run[*]', enableremotecommands: 1,
502-
logremotecommands: 1
504+
logremotecommands: 1, enablepersistentbuffer: 1,
505+
persistentbufferfile: '/var/lib/zabbix/zabbix_agent2.zbxtmp',
506+
persistentbufferperiod: '1h',
503507
}
504508
end
505509

@@ -509,7 +513,9 @@
509513
is_expected.not_to contain_file(config_path).with_content(
510514
%r{^(LogRemoteCommands|StartAgents|MaxLinesPerSecond
511515
|AllowRoot|User|LoadModulePath|
512-
EnableRemoteCommands|LogRemoteCommands)}
516+
EnableRemoteCommands|LogRemoteCommands|
517+
EnablePersistentBuffer|PersistentBufferFile|
518+
PersistentBufferPeriod)}
513519
)
514520
end
515521
end

spec/classes/proxy_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,25 @@
368368
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^StartODBCPollers=1$} }
369369
end
370370

371+
# context 'with zabbix_proxy.conf and version 7.0' do
372+
# let :params do
373+
# {
374+
# buffermode: 'disk',
375+
# memorybufferage: 0,
376+
# memorybuffersize: '0',
377+
# socketdir: '/var/run/zabbix',
378+
# startodbcpollers: 1,
379+
# zabbix_version: '7.0'
380+
# }
381+
# end
382+
383+
# it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^ProxyBufferMode=disk$} }
384+
# it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^ProxyMemoryBufferSize=0$} }
385+
# it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^ProxyMemoryBufferAge=0$} }
386+
# it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^SocketDir=/var/run/zabbix} }
387+
# it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^StartODBCPollers=1$} }
388+
# end
389+
371390
context 'with zabbix_proxy.conf and logtype declared' do
372391
describe 'as system' do
373392
let :params do

0 commit comments

Comments
 (0)