Skip to content

Commit a05e0cd

Browse files
Add configuration parameters to Server and Agent
- Server: - making StartHistoryPollers configurable - adding TrendFunctionCacheSize parameter to config file - Agent: - adding controlsocket and persistantbuffer parameters
1 parent feb6014 commit a05e0cd

File tree

8 files changed

+144
-3
lines changed

8 files changed

+144
-3
lines changed

REFERENCE.md

+63
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ The following parameters are available in the `zabbix::agent` class:
13911391
* [`server`](#-zabbix--agent--server)
13921392
* [`listenport`](#-zabbix--agent--listenport)
13931393
* [`listenip`](#-zabbix--agent--listenip)
1394+
* [`statusport`](#-zabbix--agent--statusport)
13941395
* [`startagents`](#-zabbix--agent--startagents)
13951396
* [`serveractive`](#-zabbix--agent--serveractive)
13961397
* [`service_ensure`](#-zabbix--agent--service_ensure)
@@ -1404,6 +1405,9 @@ The following parameters are available in the `zabbix::agent` class:
14041405
* [`refreshactivechecks`](#-zabbix--agent--refreshactivechecks)
14051406
* [`buffersend`](#-zabbix--agent--buffersend)
14061407
* [`buffersize`](#-zabbix--agent--buffersize)
1408+
* [`enablepersistentbuffer`](#-zabbix--agent--enablepersistentbuffer)
1409+
* [`persistentbufferperiod`](#-zabbix--agent--persistentbufferperiod)
1410+
* [`persistentbufferfile`](#-zabbix--agent--persistentbufferfile)
14071411
* [`maxlinespersecond`](#-zabbix--agent--maxlinespersecond)
14081412
* [`allowroot`](#-zabbix--agent--allowroot)
14091413
* [`zabbix_user`](#-zabbix--agent--zabbix_user)
@@ -1438,6 +1442,7 @@ The following parameters are available in the `zabbix::agent` class:
14381442
* [`include_dir_purge`](#-zabbix--agent--include_dir_purge)
14391443
* [`unsafeuserparameters`](#-zabbix--agent--unsafeuserparameters)
14401444
* [`userparameter`](#-zabbix--agent--userparameter)
1445+
* [`controlsocket`](#-zabbix--agent--controlsocket)
14411446
* [`loadmodulepath`](#-zabbix--agent--loadmodulepath)
14421447
* [`loadmodule`](#-zabbix--agent--loadmodule)
14431448
* [`manage_startup_script`](#-zabbix--agent--manage_startup_script)
@@ -1712,6 +1717,14 @@ if more than 1 interface is on the server.
17121717

17131718
Default value: `$zabbix::params::agent_listenip`
17141719

1720+
##### <a name="-zabbix--agent--statusport"></a>`statusport`
1721+
1722+
Data type: `Optional[Integer]`
1723+
1724+
Agent will listen on this port for HTTP status requests.
1725+
1726+
Default value: `$zabbix::params::agent_statusport`
1727+
17151728
##### <a name="-zabbix--agent--startagents"></a>`startagents`
17161729

17171730
Data type: `Any`
@@ -1818,6 +1831,30 @@ Maximum number of values in a memory buffer.
18181831

18191832
Default value: `$zabbix::params::agent_buffersize`
18201833

1834+
##### <a name="-zabbix--agent--enablepersistentbuffer"></a>`enablepersistentbuffer`
1835+
1836+
Data type: `Optional[Integer[0,1]]`
1837+
1838+
Use persistent buffer (set to 1), or in-memory buffer is used (default).
1839+
1840+
Default value: `$zabbix::params::agent_enablepersistentbuffer`
1841+
1842+
##### <a name="-zabbix--agent--persistentbufferperiod"></a>`persistentbufferperiod`
1843+
1844+
Data type: `Optional[String[1]]`
1845+
1846+
Zabbix Agent2 will keep data for this time period in case of no connectivity with Zabbix server or proxy.
1847+
1848+
Default value: `$zabbix::params::agent_persistentbufferperiod`
1849+
1850+
##### <a name="-zabbix--agent--persistentbufferfile"></a>`persistentbufferfile`
1851+
1852+
Data type: `Optional[Stdlib::Absolutepath]`
1853+
1854+
Full filename. Zabbix Agent2 will keep SQLite database in this file.
1855+
1856+
Default value: `$zabbix::params::agent_persistentbufferfile`
1857+
18211858
##### <a name="-zabbix--agent--maxlinespersecond"></a>`maxlinespersecond`
18221859

18231860
Data type: `Any`
@@ -2096,6 +2133,14 @@ User-defined parameter to monitor.
20962133

20972134
Default value: `$zabbix::params::agent_userparameter`
20982135

2136+
##### <a name="-zabbix--agent--controlsocket"></a>`controlsocket`
2137+
2138+
Data type: `Optional[Stdlib::Absolutepath]`
2139+
2140+
The control socket, used to send runtime commands with '-R' option.
2141+
2142+
Default value: `$zabbix::params::agent_controlsocket`
2143+
20992144
##### <a name="-zabbix--agent--loadmodulepath"></a>`loadmodulepath`
21002145

21012146
Data type: `Optional[String[1]]`
@@ -3986,6 +4031,7 @@ The following parameters are available in the `zabbix::server` class:
39864031
* [`startalerters`](#-zabbix--server--startalerters)
39874032
* [`startdiscoverers`](#-zabbix--server--startdiscoverers)
39884033
* [`startescalators`](#-zabbix--server--startescalators)
4034+
* [`starthistorypollers`](#-zabbix--server--starthistorypollers)
39894035
* [`starthttppollers`](#-zabbix--server--starthttppollers)
39904036
* [`starttimers`](#-zabbix--server--starttimers)
39914037
* [`javagateway`](#-zabbix--server--javagateway)
@@ -4012,6 +4058,7 @@ The following parameters are available in the `zabbix::server` class:
40124058
* [`historycachesize`](#-zabbix--server--historycachesize)
40134059
* [`historyindexcachesize`](#-zabbix--server--historyindexcachesize)
40144060
* [`trendcachesize`](#-zabbix--server--trendcachesize)
4061+
* [`trendfunctioncachesize`](#-zabbix--server--trendfunctioncachesize)
40154062
* [`valuecachesize`](#-zabbix--server--valuecachesize)
40164063
* [`timeout`](#-zabbix--server--timeout)
40174064
* [`tlscafile`](#-zabbix--server--tlscafile)
@@ -4422,6 +4469,14 @@ Number of pre-forked instances of escalators.
44224469

44234470
Default value: `$zabbix::params::server_startescalators`
44244471

4472+
##### <a name="-zabbix--server--starthistorypollers"></a>`starthistorypollers`
4473+
4474+
Data type: `Integer[1, 100]`
4475+
4476+
Number of pre-forked instances of history pollers.
4477+
4478+
Default value: `$zabbix::params::server_starthistorypollers`
4479+
44254480
##### <a name="-zabbix--server--starthttppollers"></a>`starthttppollers`
44264481

44274482
Data type: `Any`
@@ -4636,6 +4691,14 @@ Size of trend cache, in bytes.
46364691

46374692
Default value: `$zabbix::params::server_trendcachesize`
46384693

4694+
##### <a name="-zabbix--server--trendfunctioncachesize"></a>`trendfunctioncachesize`
4695+
4696+
Data type: `Optional[String[1]]`
4697+
4698+
Size of trend function cache, in bytes.
4699+
4700+
Default value: `$zabbix::params::server_trendfunctioncachesize`
4701+
46394702
##### <a name="-zabbix--server--valuecachesize"></a>`valuecachesize`
46404703

46414704
Data type: `Any`

manifests/agent.pp

+10
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] $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

+7
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
$server_startalerters = 3
246246
$server_startdiscoverers = '1'
247247
$server_startescalators = 1
248+
$server_starthistorypollers = 5
248249
$server_starthttppollers = '1'
249250
$server_startipmipollers = '0'
250251
$server_startjavapollers = '5'
@@ -280,6 +281,7 @@
280281
$server_tmpdir = '/tmp'
281282
$server_trappertimeout = '300'
282283
$server_trendcachesize = '4M'
284+
$server_trendfunctioncachesize = undef
283285
$server_unavailabledelay = '60'
284286
$server_unreachabledelay = '15'
285287
$server_unreachableperiod = '45'
@@ -298,9 +300,11 @@
298300
$agent_allowroot = '0'
299301
$agent_buffersend = '5'
300302
$agent_buffersize = '100'
303+
$agent_controlsocket = undef
301304
$agent_debuglevel = '3'
302305
$agent_allowkey = undef
303306
$agent_denykey = undef
307+
$agent_enablepersistentbuffer = undef
304308
$agent_enableremotecommands = '0'
305309
$agent_hostmetadata = undef
306310
$agent_hostmetadataitem = undef
@@ -311,9 +315,12 @@
311315
$agent_include_purge = true
312316
$agent_listenip = undef
313317
$agent_listenport = '10050'
318+
$agent_statusport = undef
314319
$agent_loadmodule = undef
315320
$agent_logremotecommands = '0'
316321
$agent_maxlinespersecond = '100'
322+
$agent_persistentbufferfile = undef
323+
$agent_persistentbufferperiod = undef
317324
$agent_refreshactivechecks = '120'
318325
$agent_server = '127.0.0.1'
319326
$agent_serveractive = undef

manifests/server.pp

+4
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.
@@ -91,6 +92,7 @@
9192
# @param historycachesize Size of history cache, in bytes.
9293
# @param historyindexcachesize Size of history index cache, in bytes.
9394
# @param trendcachesize Size of trend cache, in bytes.
95+
# @param trendfunctioncachesize Size of trend function cache, in bytes.
9496
# @param valuecachesize Size of history value cache, in bytes.
9597
# @param timeout Specifies how long we wait for agent, snmp device or external check (in seconds).
9698
# @param tlscafile Full pathname of a file containing the top-level CA(s) certificates for peer certificate verification.
@@ -214,6 +216,7 @@
214216
Integer[1, 100] $startalerters = $zabbix::params::server_startalerters,
215217
$startdiscoverers = $zabbix::params::server_startdiscoverers,
216218
Integer[1, 100] $startescalators = $zabbix::params::server_startescalators,
219+
Integer[1, 100] $starthistorypollers = $zabbix::params::server_starthistorypollers,
217220
$starthttppollers = $zabbix::params::server_starthttppollers,
218221
$starttimers = $zabbix::params::server_starttimers,
219222
$javagateway = $zabbix::params::server_javagateway,
@@ -239,6 +242,7 @@
239242
$historycachesize = $zabbix::params::server_historycachesize,
240243
$historyindexcachesize = $zabbix::params::server_historyindexcachesize,
241244
$trendcachesize = $zabbix::params::server_trendcachesize,
245+
Optional[String[1]] $trendfunctioncachesize = $zabbix::params::server_trendfunctioncachesize,
242246
$valuecachesize = $zabbix::params::server_valuecachesize,
243247
$timeout = $zabbix::params::server_timeout,
244248
$tlscafile = $zabbix::params::server_tlscafile,

spec/classes/agent_spec.rb

+8-2
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/server_spec.rb

+4
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
startalerters: 10,
246246
startdiscoverers: '1',
247247
startescalators: 10,
248+
starthistorypollers: 5,
248249
starthttppollers: '1',
249250
startipmipollers: '12',
250251
startpingers: '1',
@@ -261,6 +262,7 @@
261262
tmpdir: '/tmp',
262263
trappertimeout: '30',
263264
trendcachesize: '4M',
265+
trendfunctioncachesize: '4M',
264266
unavailabledelay: '30',
265267
unreachabledelay: '30',
266268
unreachableperiod: '30',
@@ -324,6 +326,7 @@
324326
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^StartDiscoverers=1} }
325327
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^StartEscalators=10} }
326328
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^StartHTTPPollers=1} }
329+
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^StartHistoryPollers=5} }
327330
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^StartIPMIPollers=12} }
328331
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^StartPingers=1} }
329332
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^StartPollers=12} }
@@ -338,6 +341,7 @@
338341
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TmpDir=/tmp} }
339342
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TrapperTimeout=30} }
340343
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TrendCacheSize=4M} }
344+
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TrendFunctionCacheSize=4M} }
341345
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^UnavailableDelay=30} }
342346
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^UnreachableDelay=30} }
343347
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^UnreachablePeriod=30} }

0 commit comments

Comments
 (0)