|
| 1 | +[[configuring-elastic-agent]] |
| 2 | +== Collecting {es} monitoring data with {agent} |
| 3 | + |
| 4 | +[subs="attributes"] |
| 5 | +++++ |
| 6 | +<titleabbrev>Collecting monitoring data with {agent}</titleabbrev> |
| 7 | +++++ |
| 8 | + |
| 9 | +In 8.5 and later, you can use {agent} to collect data about {es} and ship it to |
| 10 | +the monitoring cluster, rather than <<configuring-metricbeat,using {metricbeat}>> |
| 11 | +or routing it through exporters as described in <<collecting-monitoring-data>>. |
| 12 | + |
| 13 | +[discrete] |
| 14 | +=== Prerequisites |
| 15 | + |
| 16 | +* (Optional) Create a monitoring cluster as described in <<monitoring-production>>. |
| 17 | + |
| 18 | +* Create a user on the production cluster that has the |
| 19 | +`remote_monitoring_collector` {ref}/built-in-roles.html[built-in role]. |
| 20 | + |
| 21 | +[discrete] |
| 22 | +=== Add {es} monitoring data |
| 23 | + |
| 24 | +To collect {es} monitoring data, add an {es} integration to an {agent} and |
| 25 | +deploy it to the host where {es} is running. |
| 26 | + |
| 27 | +. Go to the {kib} home page and click **Add integrations**. |
| 28 | +. In the query bar, search for and select the **{es}** integration for |
| 29 | +{agent}. |
| 30 | +. Read the overview to make sure you understand integration requirements and |
| 31 | +other considerations. |
| 32 | +. Click **Add Elasticsearch**. |
| 33 | ++ |
| 34 | +TIP: If you're installing an integration for the first time, you may be prompted |
| 35 | +to install {agent}. Click **Add integration only (skip agent installation)**. |
| 36 | + |
| 37 | +. Configure the integration name and optionally add a description. Make sure you |
| 38 | +configure all required settings: |
| 39 | +.. Under **Collect Elasticsearch logs**, modify the log paths to match your {es} |
| 40 | +environment. |
| 41 | +.. Under **Collect Elasticsearch metrics**, make sure the hosts setting points to |
| 42 | +your {es} host URLs. By default, the integration collects {es} monitoring |
| 43 | +metrics from `localhost:9200`. If that host and port number are not correct, |
| 44 | +update the `hosts` setting. If you configured {es} to use encrypted |
| 45 | +communications, you must access it via HTTPS. For example, use a `hosts` setting |
| 46 | +like `https://localhost:9200`. |
| 47 | +.. Expand **Advanced options**. If the Elastic {security-features} are enabled, |
| 48 | +enter the username and password of a user that has the |
| 49 | +`remote_monitoring_collector` role. |
| 50 | +.. Specify the scope: |
| 51 | +** Specify `cluster` if each entry in the hosts list indicates a single |
| 52 | +endpoint for a distinct {es} cluster (for example, a load-balancing proxy |
| 53 | +fronting the cluster that directs requests to the master-ineligible nodes in the |
| 54 | +cluster). |
| 55 | +** Otherwise, accept the default scope, `node`. If this scope is set, you |
| 56 | +will need to install {agent} on each {es} node to collect all metrics. {agent} |
| 57 | +will collect most of the metrics from the elected master of the cluster, so you |
| 58 | +must scale up all your master-eligible nodes to account for this extra load. Do |
| 59 | +not use this `node` if you have dedicated master nodes. |
| 60 | +. Choose where to add the integration policy. Click **New hosts** to add it to |
| 61 | +new agent policy or **Existing hosts** to add it to an existing agent policy. |
| 62 | +. Click **Save and continue**. This step takes a minute or two to complete. When |
| 63 | +it's done, you'll have an agent policy that contains an integration for |
| 64 | +collecting monitoring data from {es}. |
| 65 | +. If an {agent} is already assigned to the policy and deployed to the host where |
| 66 | +{es} is running, you're done. Otherwise, you need to deploy an {agent}. To |
| 67 | +deploy an {agent}: |
| 68 | +.. Go to **{fleet} -> Agents**, then click **Add agent**. |
| 69 | +.. Follow the steps in the **Add agent** flyout to download, install, |
| 70 | +and enroll the {agent}. Make sure you choose the agent policy you created |
| 71 | +earlier. |
| 72 | +. Wait a minute or two until incoming data is confirmed. |
| 73 | +. {kibana-ref}/monitoring-data.html[View the monitoring data in {kib}]. |
0 commit comments