This guide assumes you are already ingesting APM data into the Elastic Stack.
In 8.0 and later, you can use Metricbeat to collect data about APM Server and ship it to a monitoring cluster. To collect and ship monitoring data:
Configure Elastic Agent to send monitoring dataedit
Enable monitoring of Elastic Agent by adding the following settings to your
Enroll Elastic Agent
elastic-agent.yml, you must re-enroll Elastic Agent for the changes to take effect.
To enroll the Elastic Agent in Fleet:
elastic-agent enroll --url <string> --enrollment-token <string> [--ca-sha256 <string>] [--certificate-authorities <string>] [--delay-enroll] [--force] [--non-interactive] [--help] [--insecure ] [--tag <string>] [global-flags]
See the Elastic Agent command reference for more information on the enroll command.
Install and configure Metricbeat to collect monitoring dataedit
- Install Metricbeat on the same server as Elastic Agent. To learn how, see Get started with Metricbeat. If you already have Metricbeat installed, skip this step.
beat-xpackmodule in Metricbeat.
For example, to enable the default configuration in the
modules.ddirectory, run the following command, using the correct command syntax for your OS:
metricbeat modules enable beat-xpack
beat-xpackmodule in Metricbeat.
When complete, your
modules.d/beat-xpack.ymlfile should look similar to this:
- module: beat xpack.enabled: true period: 10s hosts: ["http://localhost:6791"] basepath: "/processes/apm-server-default" username: remote_monitoring_user password: your_password
Do not change the
xpack.enabledboolean; these are required for stack monitoring. We recommend accepting the default
hoststo match the host:port configured in your
elastic-agent.ymlfile. In this example, that’s
To monitor multiple APM Server instances running in multiple Elastic Agents, specify a list of hosts, for example:
If you configured Elastic Agent to use encrypted communications, you must access it via HTTPS. For example, use a
APM Server metrics are exposed at
/processes/apm-server-default. Add this location as the
passwordsettings as required by your environment. If Elastic security features are enabled, you must provide a username and password so that Metricbeat can collect metrics successfully:
- Do not change the
Optional: Disable the system module in the Metricbeat.
By default, the system module is enabled. The information it collects, however, is not shown on the Stack Monitoring page in Kibana. Unless you want to use that information for other purposes, run the following command:
metricbeat modules disable system
Identify where to send the monitoring data.
In production environments, you should send your deployment logs and metrics to a dedicated monitoring deployment (referred to as the monitoring cluster). Monitoring indexes logs and metrics into Elasticsearch and these indexes consume storage, memory, and CPU cycles like any other index. By using a separate monitoring deployment, you avoid affecting your other production deployments and can view the logs and metrics even when a production deployment is unavailable.
For example, specify the Elasticsearch output information in the Metricbeat configuration file (
In this example, the data is stored on a monitoring cluster with nodes
Specify one of
If you configured the monitoring cluster to use encrypted communications, you must access it via HTTPS. For example, use a
The Elasticsearch monitoring features use ingest pipelines, therefore the cluster that stores the monitoring data must have at least one ingest node.
If the Elasticsearch security features are enabled on the monitoring cluster, you must provide a valid user ID and password so that Metricbeat can send metrics successfully:
Create a user on the monitoring cluster that has the
remote_monitoring_agentbuilt-in role. Alternatively, if it’s available in your environment, use the
passwordsettings to the Elasticsearch output information in the Metricbeat configuration file.
For more information about these configuration options, see Configure the Elasticsearch output.
- Create a user on the monitoring cluster that has the
- Start Metricbeat to begin collecting APM monitoring data.
- View the monitoring data in Kibana.