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 SMSDevices in zabbix server 7+ #988

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[Array[String[1]]]`

Which 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[Array[String[1]]]`

What devices to use for texting

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

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

Data type: `Any`
Expand Down
3 changes: 3 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 Which 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[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 Expand Up @@ -423,6 +425,7 @@
database_port => $database_port,
database_tlsconnect => $database_tlsconnect,
database_tlscafile => $database_tlscafile,
smsdevices => $smsdevices,
startpollers => $startpollers,
startipmipollers => $startipmipollers,
startpollersunreachable => $startpollersunreachable,
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 = []
$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 What devices to use for 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[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
2 changes: 1 addition & 1 deletion manifests/startup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
content => template("zabbix/${service_name}-systemd.init.erb"),
}
file { "/etc/init.d/${name}":
ensure => absent,
ensure => absent,
}
} elsif $facts['os']['family'] in ['Debian', 'RedHat'] {
# Currently other osfamily without systemd is not supported
Expand Down
22 changes: 22 additions & 0 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,28 @@
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
let :params do
{
smsdevices: ['/dev/ttyS0'],
zabbix_version: '7.0'
}
end

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

context 'with zabbix_server.conf and version 7.2' do
let :params do
{
smsdevices: ['/dev/ttyS0'],
zabbix_version: '7.2'
}
end

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

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

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

Expand Down Expand Up @@ -1017,4 +1019,4 @@ LoadModulePath=<%= @loadmodulepath %>
# Default:
# StartBrowserPollers=1

<% end %>
<% end %>
Loading