Skip to content

Commit a47067c

Browse files
committed
feat: added smsdevices param
1 parent 383c15e commit a47067c

File tree

7 files changed

+51
-3
lines changed

7 files changed

+51
-3
lines changed

REFERENCE.md

+18
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ The following parameters are available in the `zabbix` class:
158158
* [`starttimers`](#-zabbix--starttimers)
159159
* [`javagateway`](#-zabbix--javagateway)
160160
* [`javagatewayport`](#-zabbix--javagatewayport)
161+
* [`smsdevices`](#-zabbix--smsdevices)
161162
* [`startjavapollers`](#-zabbix--startjavapollers)
162163
* [`startlldprocessors`](#-zabbix--startlldprocessors)
163164
* [`startvmwarecollectors`](#-zabbix--startvmwarecollectors)
@@ -830,6 +831,14 @@ Port that zabbix java gateway listens on.
830831

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

834+
##### <a name="-zabbix--smsdevices"></a>`smsdevices`
835+
836+
Data type: `Optional[Array[String[1]]]`
837+
838+
Which devices to use for sms texting
839+
840+
Default value: `$zabbix::params::server_smsdevices`
841+
833842
##### <a name="-zabbix--startjavapollers"></a>`startjavapollers`
834843

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

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

4635+
##### <a name="-zabbix--server--smsdevices"></a>`smsdevices`
4636+
4637+
Data type: `Optional[Array[String[1]]]`
4638+
4639+
What devices to use for texting
4640+
4641+
Default value: `$zabbix::params::server_smsdevices`
4642+
46254643
##### <a name="-zabbix--server--startdbsyncers"></a>`startdbsyncers`
46264644

46274645
Data type: `Any`

manifests/init.pp

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
# @param starttimers Number of pre-forked instances of timers.
117117
# @param javagateway IP address (or hostname) of zabbix java gateway.
118118
# @param javagatewayport Port that zabbix java gateway listens on.
119+
# @param smsdevices Which devices to use for sms texting
119120
# @param startjavapollers Number of pre-forked instances of java pollers.
120121
# @param startlldprocessors Number of pre-forked instances of low-level discovery (LLD) workers.
121122
# @param startvmwarecollectors Number of pre-forked vmware collector instances.
@@ -304,6 +305,7 @@
304305
$cachesize = $zabbix::params::server_cachesize,
305306
$cacheupdatefrequency = $zabbix::params::server_cacheupdatefrequency,
306307
$startdbsyncers = $zabbix::params::server_startdbsyncers,
308+
Optional[Array[String[1]]] $smsdevices = $zabbix::params::server_smsdevices,
307309
$historycachesize = $zabbix::params::server_historycachesize,
308310
Zabbix::Historyics $historyindexcachesize = $zabbix::params::server_historyindexcachesize,
309311
$trendcachesize = $zabbix::params::server_trendcachesize,
@@ -423,6 +425,7 @@
423425
database_port => $database_port,
424426
database_tlsconnect => $database_tlsconnect,
425427
database_tlscafile => $database_tlscafile,
428+
smsdevices => $smsdevices,
426429
startpollers => $startpollers,
427430
startipmipollers => $startipmipollers,
428431
startpollersunreachable => $startpollersunreachable,

manifests/params.pp

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@
240240
$server_pacemaker_resource = undef
241241
$server_snmptrapperfile = '/tmp/zabbix_traps.tmp'
242242
$server_sourceip = undef
243+
$server_smsdevices = []
243244
$server_sshkeylocation = undef
244245
$server_sslcertlocation = '/usr/lib/zabbix/ssl/certs'
245246
$server_sslkeylocation = '/usr/lib/zabbix/ssl/keys'

manifests/server.pp

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
# if set to 0 then no limit is used at all. in this case you must know what you are doing!
8888
# @param cachesize Size of configuration cache, in bytes.
8989
# @param cacheupdatefrequency How often zabbix will perform update of configuration cache, in seconds.
90+
# @param smsdevices What devices to use for texting
9091
# @param startdbsyncers Number of pre-forked instances of db syncers.
9192
# @param historycachesize Size of history cache, in bytes.
9293
# @param historyindexcachesize Size of history index cache, in bytes.
@@ -204,6 +205,7 @@
204205
Optional[Stdlib::Absolutepath] $database_tlskeyfile = $zabbix::params::server_database_tlskeyfile,
205206
Optional[String[1]] $database_tlscipher = $zabbix::params::server_database_tlscipher,
206207
Optional[String[1]] $database_tlscipher13 = $zabbix::params::server_database_tlscipher13,
208+
Optional[Array[String[1]]] $smsdevices = $zabbix::params::server_smsdevices,
207209
$startpollers = $zabbix::params::server_startpollers,
208210
$startipmipollers = $zabbix::params::server_startipmipollers,
209211
Integer[0, 1000] $startodbcpollers = $zabbix::params::server_startodbcpollers,

manifests/startup.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
content => template("zabbix/${service_name}-systemd.init.erb"),
4949
}
5050
file { "/etc/init.d/${name}":
51-
ensure => absent,
51+
ensure => absent,
5252
}
5353
} elsif $facts['os']['family'] in ['Debian', 'RedHat'] {
5454
# Currently other osfamily without systemd is not supported

spec/classes/server_spec.rb

+22
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,28 @@
367367
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').without_content %r{^StartODBCPollers=1} }
368368
end
369369

370+
context 'with zabbix_server.conf and version 7.0' do
371+
let :params do
372+
{
373+
smsdevices: ['/dev/ttyS0'],
374+
zabbix_version: '7.0'
375+
}
376+
end
377+
378+
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^SMSDevices=/dev/ttyS0} }
379+
end
380+
381+
context 'with zabbix_server.conf and version 7.2' do
382+
let :params do
383+
{
384+
smsdevices: ['/dev/ttyS0'],
385+
zabbix_version: '7.2'
386+
}
387+
end
388+
389+
it { is_expected.to contain_file('/etc/zabbix/zabbix_server.conf').with_content %r{^SMSDevices=/dev/ttyS0} }
390+
end
391+
370392
context 'with zabbix_server.conf and logtype declared' do
371393
describe 'as system' do
372394
let :params do

templates/zabbix_server.conf.erb

+4-2
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,10 @@ LoadModulePath=<%= @loadmodulepath %>
962962
# Mandatory: no
963963
# Default:
964964
# SMSDevices=
965+
<% if @smsdevices.length > 0 -%>
966+
SMSDevices=<%= @smsdevices.join(',') -%><% end -%>
967+
<% end -%>
965968

966-
<% end %>
967969
<% if @zabbix_version.to_f >= 5.4 %>
968970
####### For advanced users - TCP-related fine-tuning parameters #######
969971

@@ -1017,4 +1019,4 @@ LoadModulePath=<%= @loadmodulepath %>
10171019
# Default:
10181020
# StartBrowserPollers=1
10191021

1020-
<% end %>
1022+
<% end %>

0 commit comments

Comments
 (0)