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 zabbix-server smsdevices configuration #991

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
18 changes: 18 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ The following parameters are available in the `zabbix` class:
* [`starttimers`](#-zabbix--starttimers)
* [`javagateway`](#-zabbix--javagateway)
* [`javagatewayport`](#-zabbix--javagatewayport)
* [`smsdevices`](#-zabbix--smsdevices)
* [`startjavapollers`](#-zabbix--startjavapollers)
* [`startlldprocessors`](#-zabbix--startlldprocessors)
* [`startvmwarecollectors`](#-zabbix--startvmwarecollectors)
Expand Down Expand Up @@ -830,6 +831,14 @@ Port that zabbix java gateway listens on.

Default value: `$zabbix::params::server_javagatewayport`

##### <a name="-zabbix--smsdevices"></a>`smsdevices`

Data type: `Optional[Variant[String[1],Array[String[1]]]]`

Devices to use for sms texting

Default value: `$zabbix::params::server_smsdevices`

##### <a name="-zabbix--startjavapollers"></a>`startjavapollers`

Data type: `Any`
Expand Down Expand Up @@ -4026,6 +4035,7 @@ The following parameters are available in the `zabbix::server` class:
* [`maxhousekeeperdelete`](#-zabbix--server--maxhousekeeperdelete)
* [`cachesize`](#-zabbix--server--cachesize)
* [`cacheupdatefrequency`](#-zabbix--server--cacheupdatefrequency)
* [`smsdevices`](#-zabbix--server--smsdevices)
* [`startdbsyncers`](#-zabbix--server--startdbsyncers)
* [`historycachesize`](#-zabbix--server--historycachesize)
* [`historyindexcachesize`](#-zabbix--server--historyindexcachesize)
Expand Down Expand Up @@ -4622,6 +4632,14 @@ How often zabbix will perform update of configuration cache, in seconds.

Default value: `$zabbix::params::server_cacheupdatefrequency`

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

Data type: `Optional[Variant[String[1],Array[String[1]]]]`

Devices to use for sms texting

Default value: `$zabbix::params::server_smsdevices`

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

Data type: `Any`
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
# @param starttimers Number of pre-forked instances of timers.
# @param javagateway IP address (or hostname) of zabbix java gateway.
# @param javagatewayport Port that zabbix java gateway listens on.
# @param smsdevices Devices to use for sms texting
# @param startjavapollers Number of pre-forked instances of java pollers.
# @param startlldprocessors Number of pre-forked instances of low-level discovery (LLD) workers.
# @param startvmwarecollectors Number of pre-forked vmware collector instances.
Expand Down Expand Up @@ -304,6 +305,7 @@
$cachesize = $zabbix::params::server_cachesize,
$cacheupdatefrequency = $zabbix::params::server_cacheupdatefrequency,
$startdbsyncers = $zabbix::params::server_startdbsyncers,
Optional[Variant[String[1],Array[String[1]]]] $smsdevices = $zabbix::params::server_smsdevices,
$historycachesize = $zabbix::params::server_historycachesize,
Zabbix::Historyics $historyindexcachesize = $zabbix::params::server_historyindexcachesize,
$trendcachesize = $zabbix::params::server_trendcachesize,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
$server_pacemaker_resource = undef
$server_snmptrapperfile = '/tmp/zabbix_traps.tmp'
$server_sourceip = undef
$server_smsdevices = undef
$server_sshkeylocation = undef
$server_sslcertlocation = '/usr/lib/zabbix/ssl/certs'
$server_sslkeylocation = '/usr/lib/zabbix/ssl/keys'
Expand Down
2 changes: 2 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
# if set to 0 then no limit is used at all. in this case you must know what you are doing!
# @param cachesize Size of configuration cache, in bytes.
# @param cacheupdatefrequency How often zabbix will perform update of configuration cache, in seconds.
# @param smsdevices Devices to use for sms texting
# @param startdbsyncers Number of pre-forked instances of db syncers.
# @param historycachesize Size of history cache, in bytes.
# @param historyindexcachesize Size of history index cache, in bytes.
Expand Down Expand Up @@ -204,6 +205,7 @@
Optional[Stdlib::Absolutepath] $database_tlskeyfile = $zabbix::params::server_database_tlskeyfile,
Optional[String[1]] $database_tlscipher = $zabbix::params::server_database_tlscipher,
Optional[String[1]] $database_tlscipher13 = $zabbix::params::server_database_tlscipher13,
Optional[Variant[String[1],Array[String[1]]]] $smsdevices = $zabbix::params::server_smsdevices,
$startpollers = $zabbix::params::server_startpollers,
$startipmipollers = $zabbix::params::server_startipmipollers,
Integer[0, 1000] $startodbcpollers = $zabbix::params::server_startodbcpollers,
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,20 @@
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').without_content %r{^StartODBCPollers=1} }
end

context 'with zabbix_server.conf and version 7.0' do
next if facts[:os]['name'] == 'Debian' && facts[:os]['release']['major'].to_i <= 11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the check be in the template iteself? If the parameter is set for an older zabbix version, the tests will pass but it will fail in production? templates/zabbix_server.conf.erb line 968 also has a version check.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the OS check from the file above. As for the template, if zabbix_version < 7.0 then the block won't print because of line 914 which reads:

<% if @zabbix_version.to_f >= 7.0 %>

next if facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'].to_i <= 20

let :params do
{
smsdevices: 'modem0',
zabbix_version: '7.0'
}
end

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

context 'with zabbix_server.conf and logtype declared' do
describe 'as system' do
let :params do
Expand Down
3 changes: 2 additions & 1 deletion templates/zabbix_server.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ LoadModulePath=<%= @loadmodulepath %>
# Mandatory: no
# Default:
# SMSDevices=
<% if @smsdevices %>SMSDevices=<%= @smsdevices.is_a?(Array) ? @smsdevices.join(',') : @smsdevices -%><% end %>

<% end %>
<% if @zabbix_version.to_f >= 5.4 %>
Expand Down Expand Up @@ -1017,4 +1018,4 @@ LoadModulePath=<%= @loadmodulepath %>
# Default:
# StartBrowserPollers=1

<% end %>
<% end %>
Loading