Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration parameters to server and agent #976

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ The following parameters are available in the `zabbix::agent` class:
* [`server`](#-zabbix--agent--server)
* [`listenport`](#-zabbix--agent--listenport)
* [`listenip`](#-zabbix--agent--listenip)
* [`statusport`](#-zabbix--agent--statusport)
* [`startagents`](#-zabbix--agent--startagents)
* [`serveractive`](#-zabbix--agent--serveractive)
* [`service_ensure`](#-zabbix--agent--service_ensure)
Expand All @@ -1404,6 +1405,9 @@ The following parameters are available in the `zabbix::agent` class:
* [`refreshactivechecks`](#-zabbix--agent--refreshactivechecks)
* [`buffersend`](#-zabbix--agent--buffersend)
* [`buffersize`](#-zabbix--agent--buffersize)
* [`enablepersistentbuffer`](#-zabbix--agent--enablepersistentbuffer)
* [`persistentbufferperiod`](#-zabbix--agent--persistentbufferperiod)
* [`persistentbufferfile`](#-zabbix--agent--persistentbufferfile)
* [`maxlinespersecond`](#-zabbix--agent--maxlinespersecond)
* [`allowroot`](#-zabbix--agent--allowroot)
* [`zabbix_user`](#-zabbix--agent--zabbix_user)
Expand Down Expand Up @@ -1438,6 +1442,7 @@ The following parameters are available in the `zabbix::agent` class:
* [`include_dir_purge`](#-zabbix--agent--include_dir_purge)
* [`unsafeuserparameters`](#-zabbix--agent--unsafeuserparameters)
* [`userparameter`](#-zabbix--agent--userparameter)
* [`controlsocket`](#-zabbix--agent--controlsocket)
* [`loadmodulepath`](#-zabbix--agent--loadmodulepath)
* [`loadmodule`](#-zabbix--agent--loadmodule)
* [`manage_startup_script`](#-zabbix--agent--manage_startup_script)
Expand Down Expand Up @@ -1712,6 +1717,14 @@ if more than 1 interface is on the server.

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

##### <a name="-zabbix--agent--statusport"></a>`statusport`

Data type: `Optional[Integer]`

Agent will listen on this port for HTTP status requests.

Default value: `$zabbix::params::agent_statusport`

##### <a name="-zabbix--agent--startagents"></a>`startagents`

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

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

##### <a name="-zabbix--agent--enablepersistentbuffer"></a>`enablepersistentbuffer`

Data type: `Optional[Integer[0,1]]`

Use persistent buffer (set to 1), or in-memory buffer is used (default).

Default value: `$zabbix::params::agent_enablepersistentbuffer`

##### <a name="-zabbix--agent--persistentbufferperiod"></a>`persistentbufferperiod`

Data type: `Optional[String[1]]`

Zabbix Agent2 will keep data for this time period in case of no connectivity with Zabbix server or proxy.

Default value: `$zabbix::params::agent_persistentbufferperiod`

##### <a name="-zabbix--agent--persistentbufferfile"></a>`persistentbufferfile`

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

Full filename. Zabbix Agent2 will keep SQLite database in this file.

Default value: `$zabbix::params::agent_persistentbufferfile`

##### <a name="-zabbix--agent--maxlinespersecond"></a>`maxlinespersecond`

Data type: `Any`
Expand Down Expand Up @@ -2096,6 +2133,14 @@ User-defined parameter to monitor.

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

##### <a name="-zabbix--agent--controlsocket"></a>`controlsocket`

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

The control socket, used to send runtime commands with '-R' option.

Default value: `$zabbix::params::agent_controlsocket`

##### <a name="-zabbix--agent--loadmodulepath"></a>`loadmodulepath`

Data type: `Optional[String[1]]`
Expand Down Expand Up @@ -3986,6 +4031,7 @@ The following parameters are available in the `zabbix::server` class:
* [`startalerters`](#-zabbix--server--startalerters)
* [`startdiscoverers`](#-zabbix--server--startdiscoverers)
* [`startescalators`](#-zabbix--server--startescalators)
* [`starthistorypollers`](#-zabbix--server--starthistorypollers)
* [`starthttppollers`](#-zabbix--server--starthttppollers)
* [`starttimers`](#-zabbix--server--starttimers)
* [`javagateway`](#-zabbix--server--javagateway)
Expand All @@ -4012,6 +4058,7 @@ The following parameters are available in the `zabbix::server` class:
* [`historycachesize`](#-zabbix--server--historycachesize)
* [`historyindexcachesize`](#-zabbix--server--historyindexcachesize)
* [`trendcachesize`](#-zabbix--server--trendcachesize)
* [`trendfunctioncachesize`](#-zabbix--server--trendfunctioncachesize)
* [`valuecachesize`](#-zabbix--server--valuecachesize)
* [`timeout`](#-zabbix--server--timeout)
* [`tlscafile`](#-zabbix--server--tlscafile)
Expand Down Expand Up @@ -4422,6 +4469,14 @@ Number of pre-forked instances of escalators.

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

##### <a name="-zabbix--server--starthistorypollers"></a>`starthistorypollers`

Data type: `Optional[Integer[0, 100]]`

Number of pre-forked instances of history pollers.

Default value: `$zabbix::params::server_starthistorypollers`

##### <a name="-zabbix--server--starthttppollers"></a>`starthttppollers`

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

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

##### <a name="-zabbix--server--trendfunctioncachesize"></a>`trendfunctioncachesize`

Data type: `Optional[String[1]]`

Size of trend function cache, in bytes.

Default value: `$zabbix::params::server_trendfunctioncachesize`

##### <a name="-zabbix--server--valuecachesize"></a>`valuecachesize`

Data type: `Any`
Expand Down
10 changes: 10 additions & 0 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
# It will find out which ip is configured for this ipaddress. Can be handy
# if more than 1 interface is on the server.
#
# @param statusport Agent will listen on this port for HTTP status requests.
# @param startagents Number of pre-forked instances of zabbix_agentd that process passive checks.
# @param serveractive List of comma delimited ip:port (or hostname:port) pairs of zabbix servers for active checks.
# @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)
Expand All @@ -70,6 +71,9 @@
# @param refreshactivechecks How often list of active checks is refreshed, in seconds.
# @param buffersend Do not keep data longer than n seconds in buffer.
# @param buffersize Maximum number of values in a memory buffer.
# @param enablepersistentbuffer Use persistent buffer (set to 1), or in-memory buffer is used (default).
# @param persistentbufferperiod Zabbix Agent2 will keep data for this time period in case of no connectivity with Zabbix server or proxy.
# @param persistentbufferfile Full filename. Zabbix Agent2 will keep SQLite database in this file.
# @param maxlinespersecond Maximum number of new lines the agent will send per second to zabbix server or proxy processing.
# @param allowroot Allow the agent to run as 'root'.
# @param zabbix_user Drop privileges to a specific, existing user on the system. Only has effect if run as 'root' and AllowRoot is disabled.
Expand Down Expand Up @@ -116,6 +120,7 @@
# @param include_dir_purge Include dir to purge.
# @param unsafeuserparameters Allow all characters to be passed in arguments to user-defined parameters.
# @param userparameter User-defined parameter to monitor.
# @param controlsocket The control socket, used to send runtime commands with '-R' option.
# @param loadmodulepath Full path to location of agent modules.
# @param loadmodule Module to load at agent startup.
# @param manage_startup_script
Expand Down Expand Up @@ -179,6 +184,7 @@
$server = $zabbix::params::agent_server,
$listenport = $zabbix::params::agent_listenport,
$listenip = $zabbix::params::agent_listenip,
Optional[Integer] $statusport = $zabbix::params::agent_statusport,
$startagents = $zabbix::params::agent_startagents,
$serveractive = $zabbix::params::agent_serveractive,
Stdlib::Ensure::Service $service_ensure = $zabbix::params::agent_service_ensure,
Expand All @@ -192,6 +198,9 @@
$refreshactivechecks = $zabbix::params::agent_refreshactivechecks,
$buffersend = $zabbix::params::agent_buffersend,
$buffersize = $zabbix::params::agent_buffersize,
Optional[Integer[0,1]] $enablepersistentbuffer = $zabbix::params::agent_enablepersistentbuffer,
Optional[Stdlib::Absolutepath] $persistentbufferfile = $zabbix::params::agent_persistentbufferfile,
Optional[String[1]] $persistentbufferperiod = $zabbix::params::agent_persistentbufferperiod,
$maxlinespersecond = $zabbix::params::agent_maxlinespersecond,
Optional[Array] $zabbix_alias = $zabbix::params::agent_zabbix_alias,
$timeout = $zabbix::params::agent_timeout,
Expand All @@ -201,6 +210,7 @@
$include_dir_purge = $zabbix::params::agent_include_purge,
$unsafeuserparameters = $zabbix::params::agent_unsafeuserparameters,
$userparameter = $zabbix::params::agent_userparameter,
Optional[Stdlib::Absolutepath] $controlsocket = $zabbix::params::agent_controlsocket,
Optional[String[1]] $loadmodulepath = $zabbix::params::agent_loadmodulepath,
$loadmodule = $zabbix::params::agent_loadmodule,
Optional[Variant[Array[Enum['unencrypted','psk','cert']],Enum['unencrypted','psk','cert']]] $tlsaccept = $zabbix::params::agent_tlsaccept,
Expand Down
7 changes: 7 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
$server_startalerters = 3
$server_startdiscoverers = '1'
$server_startescalators = 1
$server_starthistorypollers = 5
$server_starthttppollers = '1'
$server_startipmipollers = '0'
$server_startjavapollers = '5'
Expand Down Expand Up @@ -280,6 +281,7 @@
$server_tmpdir = '/tmp'
$server_trappertimeout = '300'
$server_trendcachesize = '4M'
$server_trendfunctioncachesize = undef
$server_unavailabledelay = '60'
$server_unreachabledelay = '15'
$server_unreachableperiod = '45'
Expand All @@ -298,9 +300,11 @@
$agent_allowroot = '0'
$agent_buffersend = '5'
$agent_buffersize = '100'
$agent_controlsocket = undef
$agent_debuglevel = '3'
$agent_allowkey = undef
$agent_denykey = undef
$agent_enablepersistentbuffer = undef
$agent_enableremotecommands = '0'
$agent_hostmetadata = undef
$agent_hostmetadataitem = undef
Expand All @@ -311,9 +315,12 @@
$agent_include_purge = true
$agent_listenip = undef
$agent_listenport = '10050'
$agent_statusport = undef
$agent_loadmodule = undef
$agent_logremotecommands = '0'
$agent_maxlinespersecond = '100'
$agent_persistentbufferfile = undef
$agent_persistentbufferperiod = undef
$agent_refreshactivechecks = '120'
$agent_server = '127.0.0.1'
$agent_serveractive = undef
Expand Down
4 changes: 4 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
# @param startalerters Number of pre-forked instances of alerters.
# @param startdiscoverers Number of pre-forked instances of discoverers.
# @param startescalators Number of pre-forked instances of escalators.
# @param starthistorypollers Number of pre-forked instances of history pollers.
# @param starthttppollers Number of pre-forked instances of http pollers.
# @param starttimers Number of pre-forked instances of timers.
# @param javagateway IP address (or hostname) of zabbix java gateway.
Expand Down Expand Up @@ -91,6 +92,7 @@
# @param historycachesize Size of history cache, in bytes.
# @param historyindexcachesize Size of history index cache, in bytes.
# @param trendcachesize Size of trend cache, in bytes.
# @param trendfunctioncachesize Size of trend function cache, in bytes.
# @param valuecachesize Size of history value cache, in bytes.
# @param timeout Specifies how long we wait for agent, snmp device or external check (in seconds).
# @param tlscafile Full pathname of a file containing the top-level CA(s) certificates for peer certificate verification.
Expand Down Expand Up @@ -214,6 +216,7 @@
Integer[1, 100] $startalerters = $zabbix::params::server_startalerters,
$startdiscoverers = $zabbix::params::server_startdiscoverers,
Integer[1, 100] $startescalators = $zabbix::params::server_startescalators,
Optional[Integer[0, 100]] $starthistorypollers = $zabbix::params::server_starthistorypollers,
$starthttppollers = $zabbix::params::server_starthttppollers,
$starttimers = $zabbix::params::server_starttimers,
$javagateway = $zabbix::params::server_javagateway,
Expand All @@ -239,6 +242,7 @@
$historycachesize = $zabbix::params::server_historycachesize,
$historyindexcachesize = $zabbix::params::server_historyindexcachesize,
$trendcachesize = $zabbix::params::server_trendcachesize,
Optional[String[1]] $trendfunctioncachesize = $zabbix::params::server_trendfunctioncachesize,
$valuecachesize = $zabbix::params::server_valuecachesize,
$timeout = $zabbix::params::server_timeout,
$tlscafile = $zabbix::params::server_tlscafile,
Expand Down
10 changes: 8 additions & 2 deletions spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@
agent_configfile_path: '/etc/zabbix/zabbix_agentd.conf',
buffersend: '5',
buffersize: '100',
controlsocket: '/tmp/agent.sock',
debuglevel: '4',
allowkey: 'system.run[*]',
denykey: 'system.run[*]',
Expand Down Expand Up @@ -334,6 +335,7 @@
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^AllowRoot=0$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^BufferSend=5$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^BufferSize=100$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^ControlSocket=/tmp/agent.sock$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^DebugLevel=4$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^AllowKey=system.run\[\*\]$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_agentd.conf').with_content %r{^DenyKey=system.run\[\*\]$} }
Expand Down Expand Up @@ -486,7 +488,7 @@
super().merge(systemd: true)
end

it { is_expected.to contain_systemd__unit_file('zabbix-agent.service') }

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on redhat-8-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on redhat-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on oraclelinux-8-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on oraclelinux-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on centos-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on almalinux-8-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on almalinux-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on rocky-8-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on rocky-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

zabbix::agent on ubuntu-20.04-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on redhat-8-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on redhat-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on oraclelinux-8-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on oraclelinux-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on centos-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on almalinux-8-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on almalinux-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on rocky-8-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on rocky-9-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file

Check warning on line 491 in spec/classes/agent_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

zabbix::agent on ubuntu-20.04-x86_64 with systemd active Skipped: user package provided instead systemd::unit_file
end
end

Expand All @@ -499,7 +501,9 @@
maxlinespersecond: 1, allowroot: 1, zabbix_user: 'root',
loadmodulepath: '/tmp', allowkey: 'system.run[*]',
denykey: 'system.run[*]', enableremotecommands: 1,
logremotecommands: 1
logremotecommands: 1, enablepersistentbuffer: 1,
persistentbufferfile: '/var/lib/zabbix/zabbix_agent2.zbxtmp',
persistentbufferperiod: '1h',
}
end

Expand All @@ -509,7 +513,9 @@
is_expected.not_to contain_file(config_path).with_content(
%r{^(LogRemoteCommands|StartAgents|MaxLinesPerSecond
|AllowRoot|User|LoadModulePath|
EnableRemoteCommands|LogRemoteCommands)}
EnableRemoteCommands|LogRemoteCommands|
EnablePersistentBuffer|PersistentBufferFile|
PersistentBufferPeriod)}
)
end
end
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
tmpdir: '/tmp',
trappertimeout: '30',
trendcachesize: '4M',
trendfunctioncachesize: '4M',
unavailabledelay: '30',
unreachabledelay: '30',
unreachableperiod: '30',
Expand Down Expand Up @@ -338,6 +339,7 @@
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TmpDir=/tmp} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TrapperTimeout=30} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TrendCacheSize=4M} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TrendFunctionCacheSize=4M} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^UnavailableDelay=30} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^UnreachableDelay=30} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^UnreachablePeriod=30} }
Expand All @@ -352,6 +354,17 @@
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^TLSCipherAll13=EECDH\+aRSA\+AES128:RSA\+aRSA\+AES128:kECDHEPSK\+AES128:kPSK\+AES128$} }
end

context 'with zabbix_server.conf and version 7.0' do
let :params do
{
starthistorypollers: 5,
zabbix_version: '7.0'
}
end

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

context 'with zabbix_server.conf and version 5.0' do
next if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '9'

Expand Down
Loading