Puppet Class: metricbeat

Inherits:
metricbeat::params
Inherited by:
metricbeat::repo
metricbeat::config
metricbeat::install
metricbeat::service
Defined in:
manifests/init.pp

Summary

Install, configures and manages Metricbeat on the target node.

Overview

metricbeat

This class installs the Elastic metricbeat statistic and metric collector and manages the configuration on the include nodes.

Parameters

  • apt_repo_url [String] The URL of the APT repository to install Metricbeat from. Only applicable on Debian systems. Default: https://artifacts.elastic.co/packages/$puppet_classes::metricbeatmetricbeat::major_version.x/apt

  • cloud_id [String] The cloud.id setting overwrites the output.elasticsearch.hosts and setup.kibana.host options. You can find the cloud.id in the Elastic Cloud web UI. Default: undef

  • cloud_auth [String] The cloud.auth setting overwrites the output.elasticsearch.username and output.elasticsearch.password settings. The format is <user>:<pass>. Default: undef

  • modules Array[Hash] The array of modules this instance of metricbeat will collect. (default: [{}])

  • outputs [Hash] Configures the output(s) this Metricbeat instance should send to. (default: {})

  • beat_name [String] The name of the beat which is published as the beat.name field of each transaction. (default: $::hostname)

  • config_dir [String] The absolute path to the configuration folder location. (default: /etc/metricbeat on Linux, C:/Program Files/Metricbeat on Windows)

  • config_mode [String] The file permission mode of the config file. Must be in Linux octal format. Default: '0600'

  • disable_configtest [Boolean] If true disable configuration file testing. It is generally recommended to leave this parameter at its default value. (default: false)

  • download_url Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] The URL of the ZIP file to download. Only valid on Windows nodes. (default: undef)

  • ensure [String] Ensures that all required resources are managed or removed from the target node. This is good for bulk uninstallation across a network. Valid values are 'present' or 'absent'. (default: 'present')

  • fields Optional[Hash] Optional fields to add to each transaction to provide additonal information. (default: undef)

  • fields_under_root [Boolean] Custom fields are added to each transaction under the fields sub-dictionary. When this is true custom fields are added to the top level dictionary of each transaction. (default: false)

  • install_dir Optional[String] The absolute path to the location where metricbeat will be installed. Only applicable on Windows. (default: C:/Program Files)

  • logging [Hash] The configuration section of File['metricbeat.yml'] for the logging output.

  • major_version [Enum] The major version of Metricbeat to install from vendor repositories. Valid values are '5', '6' and '7'. (default: '5')

  • manage_repo [Boolean] Weather the upstream (elastic) repository should be configured. (default: true)

  • package_ensure [String] The desired state of Package['metricbeat']. Only valid when $ensure is present. On Windows this is the version number of the package. (default: 'present')

  • processors Optional[Array[Hash]] An optional list of dictionaries to configure processors, provided by libbeat, to process events before they are sent to the output. (default: undef)

  • `proxy_address* Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] The Proxy server used for downloading files. (default: undef)

  • queue [Hash] Configure the internal queue before being consumed by the output(s) in bulk transactions. As of 6.0 only a memory queue is available, all settings must be configured by example: { 'mem' => ...}.

  • queue_size [Integer] The size of the internal queue for single events in the processing pipeline. This is only applicable if $major_version is '5'. (default: 1000)

  • service_ensure [String] The desirec state of Service['metricbeat']. Only valid when $ensure is present. Valid values are 'enabled', 'disabled', 'running' or 'unmanaged'. (default: 'enabled')

  • service_has_restart [Boolean] When true use the restart function of the init script. When false the init script's stop and start functions will be used. (default: true)

  • service_provider Optional[String] The optional service provider of the node. (default: 'redhat' on RedHat nodes, undef otherwise)

  • tags Optional[Array[String]] An optional list of values to include in the tag field of each published transaction. This is useful for identifying groups of servers by logical property. (default: undef)

  • tmp_dir [String] The absolute path to the temporary directory. On Windows, this is the target directory for the ZIP file download. (default: /tmp on Linux, C:\Windows\Temp on Windows)

  • `url_arch Optional[String] An optional string describing the architecture of the target node. Only applicable on Windows nodes. (default: x86 or x64)

  • xpack Optional[Hash] Configuration items to export internal stats to a monitoring Elasticsearch cluster

  • yum_repo_url [String] The URL of the YUM repo to install Metricbeat from. Only applicable on RedHat or Suse based systems. Default: https://artifacts.elastic.co/packages/$puppet_classes::metricbeatmetricbeat::major_version.x/yum

Examples:

class{'metricbeat':
  modules => [
    {
      'module'     => 'apache',
      'metricsets' => ['status'],
      'hosts'      => ['http://localhost'],
    },
  ],
  outputs => {
    'elasticsearch' => {
      'hosts' => ['http://localhost:9200'],
    },
  },
}

Parameters:

  • apt_repo_url (Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]]) (defaults to: $metricbeat::params::apt_repo_url)
  • cloud_id (Optional[String]) (defaults to: $metricbeat::params::cloud_id)
  • cloud_auth (Optional[String]) (defaults to: $metricbeat::params::cloud_auth)
  • modules (Array[Hash]) (defaults to: $metricbeat::params::modules)
  • module_templates (Array[String]) (defaults to: $metricbeat::params::module_templates)
  • outputs (Hash) (defaults to: $metricbeat::params::outputs)
  • beat_name (String) (defaults to: $metricbeat::params::beat_name)
  • config_dir (String) (defaults to: $metricbeat::params::config_dir)
  • config_mode (Pattern[/^0[0-7]{3}$/]) (defaults to: $metricbeat::params::config_mode)
  • disable_configtest (Boolean) (defaults to: $metricbeat::params::disable_configtest)
  • download_url (Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]]) (defaults to: $metricbeat::params::download_url)
  • ensure (Enum['present', 'absent']) (defaults to: $metricbeat::params::ensure)
  • fields (Optional[Hash]) (defaults to: $metricbeat::params::fields)
  • fields_under_root (Boolean) (defaults to: $metricbeat::params::fields_under_root)
  • install_dir (Optional[String]) (defaults to: $metricbeat::params::install_dir)
  • logging (Hash) (defaults to: $metricbeat::params::logging)
  • major_version (Enum['5', '6', '7']) (defaults to: $metricbeat::params::major_version)
  • manage_repo (Boolean) (defaults to: $metricbeat::params::manage_repo)
  • package_ensure (String) (defaults to: $metricbeat::params::package_ensure)
  • processors (Optional[Array[Hash]]) (defaults to: $metricbeat::params::processors)
  • proxy_address (Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]]) (defaults to: $metricbeat::params::proxy_address)
  • queue (Hash) (defaults to: $metricbeat::params::queue)
  • queue_size (Integer) (defaults to: $metricbeat::params::queue_size)
  • service_ensure (Enum['enabled', 'disabled', 'running', 'unmanaged']) (defaults to: $metricbeat::params::service_ensure)
  • service_has_restart (Boolean) (defaults to: $metricbeat::params::service_has_restart)
  • service_provider (Optional[String]) (defaults to: $metricbeat::params::service_provider)
  • tags (Optional[Array[String]]) (defaults to: $metricbeat::params::tags)
  • tmp_dir (String) (defaults to: $metricbeat::params::tmp_dir)
  • url_arch (Optional[String]) (defaults to: $metricbeat::params::url_arch)
  • xpack (Optional[Hash]) (defaults to: $metricbeat::params::xpack)
  • yum_repo_url (Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]]) (defaults to: $metricbeat::params::yum_repo_url)


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
# File 'manifests/init.pp', line 159

class metricbeat(
  Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] $apt_repo_url  = $metricbeat::params::apt_repo_url,
  Optional[String] $cloud_id                                          = $metricbeat::params::cloud_id,
  Optional[String] $cloud_auth                                        = $metricbeat::params::cloud_auth,
  Array[Hash] $modules                                                = $metricbeat::params::modules,
  Array[String] $module_templates                                     = $metricbeat::params::module_templates,
  Hash $outputs                                                       = $metricbeat::params::outputs,
  String $beat_name                                                   = $metricbeat::params::beat_name,
  String $config_dir                                                  = $metricbeat::params::config_dir,
  Pattern[/^0[0-7]{3}$/] $config_mode                                 = $metricbeat::params::config_mode,
  Boolean $disable_configtest                                         = $metricbeat::params::disable_configtest,
  Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] $download_url  = $metricbeat::params::download_url,
  Enum['present', 'absent'] $ensure                                   = $metricbeat::params::ensure,
  Optional[Hash] $fields                                              = $metricbeat::params::fields,
  Boolean $fields_under_root                                          = $metricbeat::params::fields_under_root,
  Optional[String] $install_dir                                       = $metricbeat::params::install_dir,
  Hash $logging                                                       = $metricbeat::params::logging,
  Enum['5', '6', '7'] $major_version                                  = $metricbeat::params::major_version,
  Boolean $manage_repo                                                = $metricbeat::params::manage_repo,
  String $package_ensure                                              = $metricbeat::params::package_ensure,
  Optional[Array[Hash]] $processors                                   = $metricbeat::params::processors,
  Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] $proxy_address = $metricbeat::params::proxy_address,
  Hash $queue                                                         = $metricbeat::params::queue,
  Integer $queue_size                                                 = $metricbeat::params::queue_size,
  Enum['enabled', 'disabled', 'running', 'unmanaged'] $service_ensure = $metricbeat::params::service_ensure,
  Boolean $service_has_restart                                        = $metricbeat::params::service_has_restart,
  Optional[String] $service_provider                                  = $metricbeat::params::service_provider,
  Optional[Array[String]] $tags                                       = $metricbeat::params::tags,
  String $tmp_dir                                                     = $metricbeat::params::tmp_dir,
  Optional[String] $url_arch                                          = $metricbeat::params::url_arch,
  Optional[Hash] $xpack                                               = $metricbeat::params::xpack,
  Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] $yum_repo_url  = $metricbeat::params::yum_repo_url,
) inherits metricbeat::params {

  $real_download_url = $download_url ? {
    undef   => "https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-${package_ensure}-windows-${metricbeat::params::url_arch}.zip",
    default => $download_url,
  }

  if $manage_repo {
    class{'metricbeat::repo':}

    Class['metricbeat::repo']
    -> Class['metricbeat::install']
  }

  if $ensure == 'present' {
    Anchor['metricbeat::begin']
    -> Class['metricbeat::install']
    -> Class['metricbeat::config']
    ~> Class['metricbeat::service']

    Class['metricbeat::install']
    ~> Class['metricbeat::service']
  }
  else {
    Anchor['metricbeat::begin']
    -> Class['metricbeat::service']
    -> Class['metricbeat::install']
  }

  anchor{'metricbeat::begin':}
  class{'metricbeat::config':}
  class{'metricbeat::install':}
  class{'metricbeat::service':}
}