metricbeat

A module to install, configure and manage the Metricbeat collector.
rosh10

rosh10

roshan

4,767 downloads

4,677 latest version

4.3 quality score

Version information

  • 5.6.6 (latest)
  • 5.6.5
released Jul 3rd 2019
This version is compatible with:
  • Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.7.0 < 6.0.0
  • CentOS
    ,
    OracleLinux
    ,
    RedHat
    ,
    CentOS
    ,
    Debian
    ,
    Ubuntu
    ,
    Fedora
    ,
    SLES

Start using this module

Documentation

roshan/metricbeat — version 5.6.6 Jul 3rd 2019

metricbeat

Table of Contents

  1. Description
  2. Setup - The basics of getting started with metricbeat
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

The metricbeat installs the metricbeat operating system and service collector maintained by elastic.

Setup

What metricbeat affects

By default metricbeat adds a software repository to your system and installs metricbeat along with required configurations.

Beginning with metricbeat

Full metricbeat functionality cam be configured with the modules and outputs parameters declared. This module can run but the metricbeat agent on the nodes may not start their services without these parameters defined.

class{'metricbeat':
  modules => [
    {
      'module'     => 'system',
      'metricsets' => [
        'cpu',
        'load',
        'memory',
        'process',
      ],
      'processes'  => ['.*'],
    },
  ],
  outputs => {
    'elasticsearch' => {
      'hosts' => ['http://localhost:9200'],
      'index' => 'metricbeat',
    },
  },
}

Usage

As of this writing all the default values follow the upstream values. This module saves all configuration options in a to_yaml() fashion. Therefore this allows some advanced configuration settings to be easily rendered.

To ship metrics from an Apache Web Server to Elasticsearch

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

To ship metrics from a MySQL Database Server to Logstash

class{'metricbeat':
  modules => {
    'module' => 'mysql',
    'metricsets' => ['status'],
    'hosts'      => ['tcp(127.0.0.1:3306)/']
    'username'   => 'root',
    'password'   => 'secret',
  },
  outputs => {
    'logstash' => {
      'hosts' => ['localhost:5044'],
    },
  },
}

Please review the elastic documentation for configuration options and service compatability.

Processors

Libbeat 5.0 and later include a feature for filtering/enhancing exported data called processors. These may be added into the configuration by populating the processors parameter and may apply to all events or those that match certain conditions.

To drop events when field apache.status.total_accesses is 0

class{'metricbeat':
  processors => [
    {
      'drop_event' => {
        'when' => {
          'apache.status.total_accesses' => 0,
        }
      }
    }
  ],
  ...
}

To drop the mysql.status.aborted.clients field from the output

class{'metricbeat':
  processors => [
    {
      'drop_field' => {
        'fields' => 'mysql.status.aborted.clients',
      }
    }
  ]
}

Please review the documentation

Reference

Public Classes

Class: metricbeat

Installs and configures metricbeat.

Parameters within metricbeat

  • modules: [Tuple[Hash]] The required metricbeat.modules section of the configuration.
  • outputs: [Hash] The required output section of the configuration.
  • beat_name: [String] The name of the beat shipper (default: hostname)
  • ensure: [String] Valid values are 'present' and 'absent'. Determines weather to manage all required resources or remove them from the node. (default: 'present')
  • disable_config_test: [Boolean] If true, disable configuration file testing. It is generally recommended to leave this parameter at this default value. (default: false)
  • fields: [Hash] Optional fields to add any additional information to the output. (default: undef)
  • fields_under_root: [Boolean] By default custom fields are under a fields sub-dictionary. When set to true custom fields are added to the root-level document. (default: false)
  • logging: [Hash] Defines metricbeat's logging configuration, if not explicitly configured all logging output is forwarded to syslog on Linux nodes and file output on Windows. See the docs for all available options.
  • manage_repo: [Boolean] When false does not install the upstream repository to the node's package manager. (default: true)
  • package_ensure: [String] The desired state of the Package resources. Only applicable if ensure is 'present'. (default: 'present')
  • processors: [Array[Hash]] Add processors to the configuration to run on data before sending to the output. (default: undef)
  • queue_size: [Integer] The queue size for single events in the processing pipeline. (default: 1000)
  • service_ensure: [String] Determine the state of the metricbeat service. Must be one of 'enabled', 'disabled', 'running', 'unmanaged'. (default: enabled)
  • service_has_restart: [Boolean] When true the Service resource issues the 'restart' command instead of 'stop' and 'start'. (default: true)
  • tags: [Array] Optional list of tags to help group different logical properties easily. (default: undef)

Private Classes

Class: metricbeat::config

Manages metricbeats main configuration file.

Class: metricbeat::install

Installs the metricbeat package.

Class: metricbeat::repo

Installs the upstream Yum or Apt repository for the system package manager.

Class: metricbeat::service

Manages the metricbeat service.

Limitations

This module does not support loading kibana dashboards or elasticsearch templates, used when outputting to Elasticsearch.

Development

Pull requests and bug reports are welcome. If you're sending a pull request, please consider writing tests if applicable.

Testing

Sandbox testing is done through the PDK utility provided by Puppet. To utilize PDK execute the following commands to validate and test the new code:

  1. Validate syntax of metadata.json, all *.pp* and all *.rb files
pdk validate
  1. Perform tests
pdk test unit