Configuring Metricbeat

edit

Configuring Metricbeat

edit

After following the configuration steps in the Getting Started, you might want to fine tune the behavior of Metricbeat. This section describes some common use cases for changing configuration options.

To configure Metricbeat, you edit the configuration file. For rpm and deb, you’ll find the configuration file at /etc/metricbeat/metricbeat.yml. There’s also a full example configuration file at /etc/metricbeat/metricbeat.full.yml that shows all non-deprecated options. For mac and win, look in the archive that you extracted.

The following topics describe how to configure Metricbeat:

Basic Configuration

edit

A Metricbeat configuration contains a list of modules. Each module contains the following config options:

  • module: The name of the module to run. For documentation about each module, see the Modules section.
  • metricsets: A list of metricsets to execute. For a list of available metricsets, see the documentation for the module.
  • enabled: Specifies whether the module is enabled.
  • period: How often the metricsets are executed.
  • hosts: A list of hosts to fetch information from. For some modules, such as the System module, this setting is not required.
  • fields: A dictionary of fields that will be sent with the metricset event. This setting is optional.
  • tags: A list of tags that will be sent with the metricset event. This setting is optional.
  • filters: With filters you can reduce the amount of data that is sent in the event. For more about the available filter options, see Filtering and Enhancing the Exported Data. This setting is optional.

The following example shows a basic configuration for the Apache module:

metricbeat:
  modules:
    - module: apache
      metricsets: ["status"]
      hosts: ["http://127.0.0.1/"]
      period: 10s
      enabled: true
      fields:
        dc: west
      tags: ["tag"]
      filters:
        ....

Configuration Combinations

edit

You can specify a configuration that uses different combinations of modules, metricsets, periods, and hosts. In the following example, the Redis host is crawled for stats information every second because this is critical data, but the full list of Apache metricsets is only fetched every 30 seconds because the metrics are less critical.

metricbeat:
  modules:
    - module: redis
      metricsets: ["info"]
      hosts: ["host1"]
      period: 1s
      enabled: true
    - module: apache
      metricsets: ["info"]
      hosts: ["host1"]
      period: 30s
      enabled: true

For a module with multiple metricsets defined, it’s possible to define the module twice and specify a different period to use for each metricset. For the following example, the set1 metricset will be fetched every 10 seconds, while the set2 metricset will be fetched every 2 minutes:

metricbeat:
  modules:
    - module: example
      metricsets: ["set1"]
      hosts: ["host1"]
      period: 10s
    - module: example
      metricsets: ["set2"]
      hosts: ["host1"]
      period: 2m