WARNING: Version 6.0 of Metricbeat has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Step 2: Configure Metricbeat
editStep 2: Configure Metricbeat
editTo configure Metricbeat, you edit the configuration file. For rpm and deb,
you’ll find the configuration file at /etc/metricbeat/metricbeat.yml
. Under
Docker, it’s located at /usr/share/metricbeat/metricbeat.yml
. For mac and win,
look in the archive that you just extracted. There’s also a full example
configuration file called metricbeat.reference.yml
that shows all non-deprecated
options.
See the Config File Format section of the Beats Platform Reference for more about the structure of the config file.
Metricbeat uses modules to collect metrics. You configure
each module individually. The following example shows the default configuration
in the metricbeat.yml
file. The system status module is enabled by default to
collect metrics about your server, such as CPU usage, memory usage, network IO
metrics, and process statistics:
metricbeat.modules: - module: system metricsets: - cpu - filesystem - memory - network - process enabled: true period: 10s processes: ['.*'] cpu_ticks: false
The following example shows how to configure two modules: the system module and the Apache HTTPD module:
metricbeat.modules: - module: system metricsets: - cpu - filesystem - memory - network - process enabled: true period: 10s processes: ['.*'] cpu_ticks: false - module: apache metricsets: ["status"] enabled: true period: 1s hosts: ["http://127.0.0.1"]
To configure Metricbeat:
-
Define the Metricbeat modules that you want to enable. For each module, specify the metricsets that you want to collect. See Configuring Metricbeat for more details about configuring modules.
If you accept the default configuration without specifying additional modules, Metricbeat will collect system metrics only.
-
If you are sending output directly to Elasticsearch (and not using Logstash), set the IP address and port where Metricbeat can find the Elasticsearch installation:
output.elasticsearch: hosts: ["192.168.1.42:9200"]
If you are sending output to Logstash, make sure you Configure the Logstash output instead.
-
If you plan to use the sample Kibana dashboards provided with Metricbeat, configure the Kibana endpoint:
setup.kibana: host: "localhost:5601"
Where
host
is the hostname and port of the machine where Kibana is running, for example,localhost:5601
.If you specify a path after the port number, you need to include the scheme and port:
http://localhost:5601/path
. -
If you’ve secured Elasticsearch and Kibana, you need to specify credentials in the config file before you run the commands that set up and start Metricbeat. For example:
output.elasticsearch: hosts: ["myEShost:9200"] username: "elastic" password: "elastic" setup.kibana: host: "mykibanahost:5601" username: "elastic" password: "elastic"
The
username
andpassword
settings for Kibana are optional. If you don’t specify credentials for Kibana, Metricbeat uses theusername
andpassword
specified for the Elasticsearch output.Also see the security-related options described in Set up the Kibana endpoint and Configure the Elasticsearch output.
To test your configuration file, change to the directory where the
Metricbeat binary is installed, and run Metricbeat in the foreground with
the following options specified: ./metricbeat test config -e
. Make sure your
config files are in the path expected by Metricbeat (see Directory layout),
or use the -c
flag to specify the path to the config file.
Before starting metricbeat, you should look at the configuration options in the configuration file. For more information about these options, see Configuring Metricbeat.