Puppet Class: zabbixagent

Inherits:
::zabbixagent::params
Defined in:
manifests/init.pp

Overview

Class: zabbixagent

This module manages the zabbix agent on a monitored machine.

Unless listed otherwise below, all settings in zabbix_agentd.conf are ommitted unless a value is passed in. In the config file, setting names are capitalized and run together. Here, they share the same name but are lower case and have an underscore separating words. Ex: PidFile becomes pid_file.

Parameters:

$manage_repo_epel          Determines if the EPEL repo is managed on the
                           RedHat family of OS's.
                           Default: false
                           Type: boolean

$manage_repo_zabbix        Determines if the Zabbix repo is managed on the
                           RedHat family of OS's.
                           Default: false
                           Type: boolean

$ensure_setting            Passed directly to ensure of package resource
                           Default: 'present'

$custom_require_linux      Passed directly to require of package resource
                           when on Linux
                           Default: undef

$custom_require_windows    Passed directly to require of package resource
                           when on Windows
                           Default: undef

$allow_root                0 - do not allow, 1 - allow
                           Type: integer

$buffer_send               Range: 1-3600
                           Type: integer

$buffer_size               Range: 2-65535
                           Type: integer

$debug_level               Range: 0-4
                           Type: integer

$enable_remote_commands    0 - not allowed, 1 - allowed
                           Type: integer

$host_metadata             Range: 0-255 characters
                           Type: string

$host_metadata_item        Parameter that defines an item used for getting
                           host metadata used during host auto-registration
                           process. To disable, set to ''.
                           Default: 'system.uname'

$hostname                  The hostname used in the config file.
                           Default: downcase($::fqdn)

$hostname_item             An item to be used for determining a host's name

$include_files             Equates to include in zabbix_agentd.conf.
                           Renamed due to include being special in Puppet.
                           An array with one or more files to be included
                           in the config. On non-Windows systems, this can
                           be a folder or a path with a wildcard. See
                           zabbix_agentd.conf for details.
                           Type: array

$item_alias                Equates to alias in zabbix_agentd.conf. Renamed
                           due to alias being the name of a Puppet
                           metaparameter. Sets an alias for an item key.
                           Type: array

$listen_ip                 List of comma delimited IP addresses that the
                           agent should listen on.
                           Type: string

$listen_port               Range: 1024-32767
                           Default: 10050
                           Type: integer

$load_module               Type: string

$load_module_path          Type: string

$log_file_size             Range: 0-1024
                           Type: integer

$log_file                  The full path to where Zabbix should store it's
                           logs.
                           Default: 'C:\zabbix_agentd.log' OR
                                    '/var/log/zabbix/zabbix_agentd.log'
                           Type: string

$log_remote_commands       0 - disabled, 1 - enabled
                           Type: integer

$max_lines_per_second      Range: 1-1000
                           Type: integer

$perf_counter              Each item should be formmated as follows:
                           <parameter_name>,"<perf_counter_path>",<period>
                           Type: array

$pid_file                  Name of PID file.
                           Type: string

$refresh_active_checks     Range: 60-3600
                           Type: integer

$server                    Default: '127.0.0.1'
                           Type: String separated by commas OR Array

$server_active             Default: '127.0.0.1'
                           Type: String separated by commas OR Array

$source_ip                 Source IP address for outgoing connections.
                           Type: string, formatted as an IP address

$start_agents              Range: 0-100
                           Type: integer

$timeout                   Range: 1-30
                           Type: integer

$unsafe_user_parameters    0 - do not allow, 1 - allow

$user_parameter            User-defined parameter to monitor.
                           Type: array

$user                      Drop privileges to a specific, existing user on
                           the system.
                           Type: string

Requires: see metadata.json

Sample Usage: see README.md

Parameters:

  • include_dir (Any) (defaults to: undef)
  • include_file (Any) (defaults to: undef)
  • logfile (Any) (defaults to: undef)
  • servers (Any) (defaults to: undef)
  • servers_active (Any) (defaults to: undef)
  • manage_repo_epel (Any) (defaults to: $::zabbixagent::params::manage_repo_epel)
  • manage_repo_zabbix (Any) (defaults to: $::zabbixagent::params::manage_repo_zabbix)
  • ensure_setting (Any) (defaults to: $::zabbixagent::params::ensure_setting)
  • custom_require_linux (Any) (defaults to: $::zabbixagent::params::custom_require_linux)
  • custom_require_windows (Any) (defaults to: $::zabbixagent::params::custom_require_windows)
  • allow_root (Any) (defaults to: $::zabbixagent::params::allow_root)
  • buffer_send (Any) (defaults to: $::zabbixagent::params::buffer_send)
  • buffer_size (Any) (defaults to: $::zabbixagent::params::buffer_size)
  • debug_level (Any) (defaults to: $::zabbixagent::params::debug_level)
  • enable_remote_commands (Any) (defaults to: $::zabbixagent::params::enable_remote_commands)
  • host_metadata (Any) (defaults to: $::zabbixagent::params::host_metadata)
  • host_metadata_item (Any) (defaults to: $::zabbixagent::params::host_metadata_item)
  • hostname (Any) (defaults to: $::zabbixagent::params::hostname)
  • hostname_item (Any) (defaults to: $::zabbixagent::params::hostname_item)
  • include_files (Any) (defaults to: $::zabbixagent::params::include_files)
  • item_alias (Any) (defaults to: $::zabbixagent::params::item_alias)
  • listen_ip (Any) (defaults to: $::zabbixagent::params::listen_ip)
  • listen_port (Any) (defaults to: $::zabbixagent::params::listen_port)
  • load_module (Any) (defaults to: $::zabbixagent::params::load_module)
  • load_module_path (Any) (defaults to: $::zabbixagent::params::load_module_path)
  • log_file (Any) (defaults to: $::zabbixagent::params::log_file)
  • log_file_size (Any) (defaults to: $::zabbixagent::params::log_file_size)
  • log_remote_commands (Any) (defaults to: $::zabbixagent::params::log_remote_commands)
  • max_lines_per_second (Any) (defaults to: $::zabbixagent::params::max_lines_per_second)
  • perf_counter (Any) (defaults to: $::zabbixagent::params::perf_counter)
  • pid_file (Any) (defaults to: $::zabbixagent::params::pid_file)
  • refresh_active_checks (Any) (defaults to: $::zabbixagent::params::refresh_active_checks)
  • server (Any) (defaults to: $::zabbixagent::params::server)
  • server_active (Any) (defaults to: $::zabbixagent::params::server_active)
  • source_ip (Any) (defaults to: $::zabbixagent::params::source_ip)
  • start_agents (Any) (defaults to: $::zabbixagent::params::start_agents)
  • timeout (Any) (defaults to: $::zabbixagent::params::timeout)
  • unsafe_user_parameters (Any) (defaults to: $::zabbixagent::params::unsafe_user_parameters)
  • user_parameter (Any) (defaults to: $::zabbixagent::params::user_parameter)
  • user (Any) (defaults to: $::zabbixagent::params::user)


139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'manifests/init.pp', line 139

class zabbixagent (
  # depreciated vars
  $include_dir            = undef,
  $include_file           = undef,
  $logfile                = undef,
  $servers                = undef,
  $servers_active         = undef,

  # preinstall settings
  $manage_repo_epel       = $::zabbixagent::params::manage_repo_epel,
  $manage_repo_zabbix     = $::zabbixagent::params::manage_repo_zabbix,

  # install setting
  $ensure_setting         = $::zabbixagent::params::ensure_setting,
  $custom_require_linux   = $::zabbixagent::params::custom_require_linux,
  $custom_require_windows = $::zabbixagent::params::custom_require_windows,

  # config file settings
  $allow_root             = $::zabbixagent::params::allow_root,
  $buffer_send            = $::zabbixagent::params::buffer_send,
  $buffer_size            = $::zabbixagent::params::buffer_size,
  $debug_level            = $::zabbixagent::params::debug_level,
  $enable_remote_commands = $::zabbixagent::params::enable_remote_commands,
  $host_metadata          = $::zabbixagent::params::host_metadata,
  $host_metadata_item     = $::zabbixagent::params::host_metadata_item,
  $hostname               = $::zabbixagent::params::hostname,
  $hostname_item          = $::zabbixagent::params::hostname_item,
  $include_files          = $::zabbixagent::params::include_files,
  $item_alias             = $::zabbixagent::params::item_alias,
  $listen_ip              = $::zabbixagent::params::listen_ip,
  $listen_port            = $::zabbixagent::params::listen_port,
  $load_module            = $::zabbixagent::params::load_module,
  $load_module_path       = $::zabbixagent::params::load_module_path,
  $log_file               = $::zabbixagent::params::log_file,
  $log_file_size          = $::zabbixagent::params::log_file_size,
  $log_remote_commands    = $::zabbixagent::params::log_remote_commands,
  $max_lines_per_second   = $::zabbixagent::params::max_lines_per_second,
  $perf_counter           = $::zabbixagent::params::perf_counter,
  $pid_file               = $::zabbixagent::params::pid_file,
  $refresh_active_checks  = $::zabbixagent::params::refresh_active_checks,
  $server                 = $::zabbixagent::params::server,
  $server_active          = $::zabbixagent::params::server_active,
  $source_ip              = $::zabbixagent::params::source_ip,
  $start_agents           = $::zabbixagent::params::start_agents,
  $timeout                = $::zabbixagent::params::timeout,
  $unsafe_user_parameters = $::zabbixagent::params::unsafe_user_parameters,
  $user_parameter         = $::zabbixagent::params::user_parameter,
  $user                   = $::zabbixagent::params::user,
) inherits ::zabbixagent::params {
  # lint:ignore:80chars
  # these should not be used as they are pre v2.1
  $depreciation_msg = 'was removed in v2.1. Please update your manifests and/or hiera data.'
  # lint:endignore

  if ($include_dir) {
    fail("\$include_dir ${depreciation_msg}")
  }

  if ($include_file) {
    fail("\$include_file ${depreciation_msg}")
  }

  if ($logfile) {
    fail("\$logfile ${depreciation_msg}")
  }

  if ($servers) {
    fail("\$servers ${depreciation_msg}")
  }

  if ($servers_active) {
    fail("\$servers_active ${depreciation_msg}")
  }

  # validate booleans
  validate_bool($manage_repo_epel)
  validate_bool($manage_repo_zabbix)

  # validate strings
  validate_string($ensure_setting)
  validate_string($hostname)

  if (!(is_string($server) or is_array($server))) {
    fail('$servers must be either a string or an array')
  }

  if (!(is_string($server_active) or is_array($server_active))) {
    fail('$servers_active must be either a string or an array')
  }

  class { '::zabbixagent::preinstall':
  } ->
  class { '::zabbixagent::install':
  } ->
  class { '::zabbixagent::config':
  } ->
  class { '::zabbixagent::service':
  }

}