From 01833a5a6cad6eb6eecaa3ba98264a228779ce84 Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Mon, 31 Jul 2023 11:12:41 +0200 Subject: [PATCH] add support for ODBC pollers in Zabbix >= 6.0 --- REFERENCE.md | 27 +++++++++++++++++++++++++++ manifests/init.pp | 2 ++ manifests/params.pp | 2 ++ manifests/proxy.pp | 2 ++ manifests/server.pp | 2 ++ spec/classes/proxy_spec.rb | 15 +++++++++++++++ spec/classes/server_spec.rb | 2 ++ templates/zabbix_proxy.conf.erb | 11 +++++++++++ templates/zabbix_server.conf.erb | 11 +++++++++++ 9 files changed, 74 insertions(+) diff --git a/REFERENCE.md b/REFERENCE.md index 340be403f..7499730be 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -146,6 +146,7 @@ The following parameters are available in the `zabbix` class: * [`startpollers`](#-zabbix--startpollers) * [`startpreprocessors`](#-zabbix--startpreprocessors) * [`startipmipollers`](#-zabbix--startipmipollers) +* [`startodbcpollers`](#-zabbix--startodbcpollers) * [`startpollersunreachable`](#-zabbix--startpollersunreachable) * [`starttrappers`](#-zabbix--starttrappers) * [`startpingers`](#-zabbix--startpingers) @@ -740,6 +741,14 @@ Number of pre-forked instances of ipmi pollers. Default value: `$zabbix::params::server_startipmipollers` +##### `startodbcpollers` + +Data type: `Integer[0, 1000]` + +Number of pre-forked instances of ODBC pollers. + +Default value: `$zabbix::params::server_startodbcpollers` + ##### `startpollersunreachable` Data type: `Any` @@ -2548,6 +2557,7 @@ The following parameters are available in the `zabbix::proxy` class: * [`startpollers`](#-zabbix--proxy--startpollers) * [`startpreprocessors`](#-zabbix--proxy--startpreprocessors) * [`startipmipollers`](#-zabbix--proxy--startipmipollers) +* [`startodbcpollers`](#-zabbix--proxy--startodbcpollers) * [`startpollersunreachable`](#-zabbix--proxy--startpollersunreachable) * [`starttrappers`](#-zabbix--proxy--starttrappers) * [`startpingers`](#-zabbix--proxy--startpingers) @@ -3034,6 +3044,14 @@ Number of pre-forked instances of ipmi pollers. Default value: `$zabbix::params::proxy_startipmipollers` +##### `startodbcpollers` + +Data type: `Integer[0, 1000]` + +Number of pre-forked instances of ODBC pollers. + +Default value: `$zabbix::params::proxy_startodbcpollers` + ##### `startpollersunreachable` Data type: `Any` @@ -3947,6 +3965,7 @@ The following parameters are available in the `zabbix::server` class: * [`startpollers`](#-zabbix--server--startpollers) * [`startpreprocessors`](#-zabbix--server--startpreprocessors) * [`startipmipollers`](#-zabbix--server--startipmipollers) +* [`startodbcpollers`](#-zabbix--server--startodbcpollers) * [`startpollersunreachable`](#-zabbix--server--startpollersunreachable) * [`starttrappers`](#-zabbix--server--starttrappers) * [`startpingers`](#-zabbix--server--startpingers) @@ -4330,6 +4349,14 @@ Number of pre-forked instances of ipmi pollers. Default value: `$zabbix::params::server_startipmipollers` +##### `startodbcpollers` + +Data type: `Integer[0, 1000]` + +Number of pre-forked instances of ODBC pollers. + +Default value: `$zabbix::params::server_startodbcpollers` + ##### `startpollersunreachable` Data type: `Any` diff --git a/manifests/init.pp b/manifests/init.pp index 2cbd3a86e..830218ccd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -105,6 +105,7 @@ # @param startpollers Number of pre-forked instances of pollers. # @param startpreprocessors Number of pre-forked instances of preprocessing workers # @param startipmipollers Number of pre-forked instances of ipmi pollers. +# @param startodbcpollers Number of pre-forked instances of ODBC pollers. # @param startpollersunreachable Number of pre-forked instances of pollers for unreachable hosts (including ipmi). # @param starttrappers Number of pre-forked instances of trappers. # @param startpingers Number of pre-forked instances of icmp pingers. @@ -274,6 +275,7 @@ Optional[Stdlib::Absolutepath] $database_tlscafile = $zabbix::params::server_database_tlscafile, $startpollers = $zabbix::params::server_startpollers, $startipmipollers = $zabbix::params::server_startipmipollers, + Integer[0, 1000] $startodbcpollers = $zabbix::params::server_startodbcpollers, $startpollersunreachable = $zabbix::params::server_startpollersunreachable, Integer[1, 1000] $startpreprocessors = $zabbix::params::server_startpreprocessors, $starttrappers = $zabbix::params::server_starttrappers, diff --git a/manifests/params.pp b/manifests/params.pp index 6db7d225c..eea76f5a5 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -253,6 +253,7 @@ $server_startipmipollers = '0' $server_startjavapollers = '5' $server_startlldprocessors = 2 + $server_startodbcpollers = 1 $server_startpingers = '1' $server_startpollers = '5' $server_startpollersunreachable = '1' @@ -422,6 +423,7 @@ $proxy_startipmipollers = '0' $proxy_startjavapollers = '5' $proxy_startpingers = '1' + $proxy_startodbcpollers = 1 $proxy_startpollers = '5' $proxy_startpollersunreachable = '1' $proxy_startpreprocessors = 3 diff --git a/manifests/proxy.pp b/manifests/proxy.pp index 731c57d59..555166c44 100644 --- a/manifests/proxy.pp +++ b/manifests/proxy.pp @@ -63,6 +63,7 @@ # @param startpollers Number of pre-forked instances of pollers. # @param startpreprocessors Number of pre-forked instances of preprocessing workers # @param startipmipollers Number of pre-forked instances of ipmi pollers. +# @param startodbcpollers Number of pre-forked instances of ODBC pollers. # @param startpollersunreachable Number of pre-forked instances of pollers for unreachable hosts (including ipmi). # @param starttrappers Number of pre-forked instances of trappers. # @param startpingers Number of pre-forked instances of icmp pingers. @@ -237,6 +238,7 @@ $datasenderfrequency = $zabbix::params::proxy_datasenderfrequency, $startpollers = $zabbix::params::proxy_startpollers, $startipmipollers = $zabbix::params::proxy_startipmipollers, + Integer[0, 1000] $startodbcpollers = $zabbix::params::proxy_startodbcpollers, $startpollersunreachable = $zabbix::params::proxy_startpollersunreachable, Integer[1, 1000] $startpreprocessors = $zabbix::params::proxy_startpreprocessors, $starttrappers = $zabbix::params::proxy_starttrappers, diff --git a/manifests/server.pp b/manifests/server.pp index 0ea355153..7b53b1aa7 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -50,6 +50,7 @@ # @param startpollers Number of pre-forked instances of pollers. # @param startpreprocessors Number of pre-forked instances of preprocessing workers # @param startipmipollers Number of pre-forked instances of ipmi pollers. +# @param startodbcpollers Number of pre-forked instances of ODBC pollers. # @param startpollersunreachable Number of pre-forked instances of pollers for unreachable hosts (including ipmi). # @param starttrappers Number of pre-forked instances of trappers. # @param startpingers Number of pre-forked instances of icmp pingers. @@ -202,6 +203,7 @@ Optional[String[1]] $database_tlscipher13 = $zabbix::params::server_database_tlscipher13, $startpollers = $zabbix::params::server_startpollers, $startipmipollers = $zabbix::params::server_startipmipollers, + Integer[0, 1000] $startodbcpollers = $zabbix::params::server_startodbcpollers, $startpollersunreachable = $zabbix::params::server_startpollersunreachable, Integer[1, 1000] $startpreprocessors = $zabbix::params::server_startpreprocessors, $starttrappers = $zabbix::params::server_starttrappers, diff --git a/spec/classes/proxy_spec.rb b/spec/classes/proxy_spec.rb index 4dbbed9c9..887da943a 100644 --- a/spec/classes/proxy_spec.rb +++ b/spec/classes/proxy_spec.rb @@ -366,11 +366,26 @@ let :params do { socketdir: '/var/run/zabbix', + startodbcpollers: 1, zabbix_version: '5.0' } end it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^SocketDir=/var/run/zabbix} } + it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').without_content %r{^StartODBCPollers=1$} } + end + + context 'with zabbix_proxy.conf and version 6.0' do + let :params do + { + socketdir: '/var/run/zabbix', + startodbcpollers: 1, + zabbix_version: '6.0' + } + end + + it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^SocketDir=/var/run/zabbix} } + it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^StartODBCPollers=1$} } end context 'with zabbix_proxy.conf and logtype declared' do diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index 4676a9a85..8caebd5d1 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -367,11 +367,13 @@ let :params do { socketdir: '/var/run/zabbix', + startodbcpollers: 1, zabbix_version: '5.0' } end it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^SocketDir=/var/run/zabbix} } + it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').without_content %r{^StartODBCPollers=1} } end context 'with zabbix_server.conf and logtype declared' do diff --git a/templates/zabbix_proxy.conf.erb b/templates/zabbix_proxy.conf.erb index 97c46f365..61060b940 100644 --- a/templates/zabbix_proxy.conf.erb +++ b/templates/zabbix_proxy.conf.erb @@ -356,6 +356,17 @@ UnavailableDelay=<%= @unavaliabledelay %> # UnreachableDelay=<%= @unreachabedelay %> +## Option: StartODBCPollers +# Number of pre-forked ODBC poller instances. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartODBCPollers=1 +<% if @zabbix_version.to_f >= 6.0 %> +StartODBCPollers=<%= @startodbcpollers %> +<% end %> + ### Option: ExternalScripts # Full path to location of external scripts. # Default depends on compilation options. diff --git a/templates/zabbix_server.conf.erb b/templates/zabbix_server.conf.erb index 169076f69..dfb535417 100644 --- a/templates/zabbix_server.conf.erb +++ b/templates/zabbix_server.conf.erb @@ -133,6 +133,17 @@ StartIPMIPollers=<%= @startipmipollers %> # StartPollersUnreachable=<%= @startpollersunreachable %> +## Option: StartODBCPollers +# Number of pre-forked ODBC poller instances. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartODBCPollers=1 +<% if @zabbix_version.to_f >= 6.0 %> +StartODBCPollers=<%= @startodbcpollers %> +<% end %> + ### Option: StartTrappers # Number of pre-forked instances of trappers. # Trappers accept incoming connections from Zabbix sender, active agents and active proxies.