- Metricbeat Reference: other versions:
- Overview
- Getting started with Metricbeat
- Setting up and running Metricbeat
- Upgrading Metricbeat
- How Metricbeat works
- Configuring Metricbeat
- Specify which modules to run
- Specify general settings
- Load external configuration files
- Configure the internal queue
- Configure the output
- Specify SSL settings
- Filter and enhance the exported data
- Parse data by using ingest node
- Set up project paths
- Set up the Kibana endpoint
- Load the Kibana dashboards
- Load the Elasticsearch index template
- Configure logging
- Use environment variables in the configuration
- Autodiscover
- YAML tips and gotchas
- Regular expression support
- HTTP Endpoint
- metricbeat.reference.yml
- Modules
- Aerospike module
- Apache module
- Ceph module
- Couchbase module
- Docker module
- Dropwizard module
- Elasticsearch module
- Elasticsearch cluster_stats metricset
- Elasticsearch index metricset
- Elasticsearch index_recovery metricset
- Elasticsearch index_summary metricset
- Elasticsearch ml_job metricset
- elasticsearch ml_job MetricSet
- Elasticsearch node metricset
- Elasticsearch node_stats metricset
- Elasticsearch pending_tasks metricset
- elasticsearch pending_tasks MetricSet
- Elasticsearch shard metricset
- envoyproxy module
- Etcd module
- Golang module
- Graphite module
- HAProxy module
- HTTP module
- Jolokia module
- Kafka module
- Kibana module
- Kubernetes module
- Kubernetes apiserver metricset
- Kubernetes container metricset
- Kubernetes event metricset
- Kubernetes node metricset
- Kubernetes pod metricset
- Kubernetes state_container metricset
- Kubernetes state_deployment metricset
- Kubernetes state_node metricset
- Kubernetes state_pod metricset
- Kubernetes state_replicaset metricset
- Kubernetes state_statefulset metricset
- Kubernetes system metricset
- Kubernetes volume metricset
- kvm module
- Logstash module
- Memcached module
- MongoDB module
- Munin module
- MySQL module
- Nginx module
- PHP_FPM module
- PostgreSQL module
- Prometheus module
- RabbitMQ module
- Redis module
- System module
- System core metricset
- System cpu metricset
- System diskio metricset
- System filesystem metricset
- System fsstat metricset
- System load metricset
- System memory metricset
- System network metricset
- System process metricset
- System process_summary metricset
- System raid metricset
- System socket metricset
- System uptime metricset
- traefik module
- uwsgi module
- vSphere module
- Windows module
- ZooKeeper module
- Exported fields
- Aerospike fields
- Apache fields
- Beat fields
- Ceph fields
- Cloud provider metadata fields
- Common fields
- Couchbase fields
- Docker fields
- Docker fields
- Dropwizard fields
- Elasticsearch fields
- envoyproxy fields
- Etcd fields
- Golang fields
- Graphite fields
- HAProxy fields
- Host fields
- HTTP fields
- Jolokia fields
- Kafka fields
- Kibana fields
- Kubernetes fields
- Kubernetes fields
- kvm fields
- Logstash fields
- Memcached fields
- MongoDB fields
- Munin fields
- MySQL fields
- Nginx fields
- PHP_FPM fields
- PostgreSQL fields
- Prometheus fields
- RabbitMQ fields
- Redis fields
- System fields
- traefik fields
- uwsgi fields
- vSphere fields
- Windows fields
- ZooKeeper fields
- Monitoring Metricbeat
- Securing Metricbeat
- Troubleshooting
- Contributing to Beats
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.
When you configure Metricbeat, you need to specify which modules to run. Metricbeat uses modules to collect metrics. Each module defines the basic logic for collecting data from a specific service, such as Redis or MySQL. A module consists of metricsets that fetch and structure the data. Read How Metricbeat works to learn more.
To configure Metricbeat:
-
Enable the modules that you want to run. If you accept the default configuration without enabling additional modules, Metricbeat collects system metrics only.
You can either enable the default module configurations defined in the
modules.d
directory (recommended), or add the module configs to themetricbeat.yml
file. Themodules.d
directory contains default configurations for all available Metricbeat modules.If you are using a Docker image, see Running Metricbeat on Docker.
The following examples enable the
apache
andmysql
configs in themodules.d
directory :deb and rpm:
metricbeat modules enable apache mysql
mac:
./metricbeat modules enable apache mysql
win:
PS > .\metricbeat.exe modules enable apache mysql
See the
modules
command to learn more about this command.To change the default module configurations, modify the
.yml
files in themodules.d
directory. See Standard config options for more about available settings.See Specify which modules to run if you want to add the module configs to the
metricbeat.yml
file rather than using themodules.d
directory. -
Configure the output. Metricbeat supports a variety of outputs, but typically you’ll either send events directly to Elasticsearch, or to Logstash for additional processing.
To send output directly to Elasticsearch (without using Logstash), set the location of the Elasticsearch installation:
-
If you’re running our hosted Elasticsearch Service on Elastic Cloud, specify your Cloud ID. For example:
cloud.id: "staging:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRjZWM2ZjI2MWE3NGJmMjRjZTMzYmI4ODExYjg0Mjk0ZiRjNmMyY2E2ZDA0MjI0OWFmMGNjN2Q3YTllOTYyNTc0Mw=="
-
If you’re running Elasticsearch on your own hardware, set the host and port where Metricbeat can find the Elasticsearch installation. For example:
output.elasticsearch: hosts: ["myEShost:9200"]
To send output to Logstash, Configure the Logstash output instead. For all other outputs, see Configure the output.
-
-
If you plan to use the sample Kibana dashboards provided with Metricbeat, configure the Kibana endpoint. You can skip this step if Kibana is running on the same host as Elasticsearch.
-
If Elasticsearch and Kibana are secured, set credentials in the
metricbeat.yml
config file before you run the commands that set up and start Metricbeat.-
If you’re running our hosted Elasticsearch Service on Elastic Cloud, specify your cloud auth credentials. For example:
cloud.auth: "elastic:YOUR_PASSWORD"
-
If you’re running Elasticsearch on your own hardware, specify your Elasticsearch and Kibana credentials:
output.elasticsearch: hosts: ["myEShost:9200"] username: "filebeat_internal" password: "YOUR_PASSWORD" setup.kibana: host: "mykibanahost:5601" username: "my_kibana_user" password: "YOUR_PASSWORD"
This examples shows a hard-coded password, but you should store sensitive values in the secrets keystore.
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.If you are planning to set up the Kibana dashboards, the user must have the
kibana_user
built-in role or equivalent privileges.For more information, see Securing Metricbeat.
-
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.