[[dashboard-monitoring-with-elastic-agent]]
=== Collect {ls} monitoring data for dashboards
[subs="attributes"]
++++
<titleabbrev>Collect monitoring data for dashboards</titleabbrev>
++++

{agent} collects monitoring data from your {ls} instance, sends it directly to your monitoring cluster, and shows the data in {ls} dashboards.

You can enroll {agent} in {fleet-guide}/install-fleet-managed-elastic-agent.html[{fleet}] for management from a central location, or you can run {fleet-guide}/install-standalone-elastic-agent.html[{agent} standalone].

**Prerequisites**

Complete these steps as you prepare to collect and ship monitoring data for dashboards:

[[disable-default-db]]
.Disable default collection of {ls} monitoring metrics
[%collapsible]
====
include::monitoring-prereq-disable-default.asciidoc[]
====

[[define-cluster__uuid-db]]
.Specify the target cluster_uuid (optional)
[%collapsible]
====
include::monitoring-prereq-define-cluster.asciidoc[]
====

[[create-user-db]]
.Create a monitoring user (standalone agent only)
[%collapsible]
====
include::monitoring-prereq-create-user.asciidoc[]
====

[discrete]
[[install-and-configure-db]]
=== Install and configure {agent}

Install and configure {agent} to collect {ls} monitoring data for dashboards.
We'll walk you through the process in these steps:

* <<add-logstash-integration-ead>>
* <<add-agent-to-fleet-ead>>
* <<view-assets-ead>>
* <<view-data-dashboard>>

Check out {fleet-guide}/elastic-agent-installation.html[Installing {agent}] in the _Fleet and Elastic Agent Guide_ for more info.

[discrete]
[[add-logstash-integration-ead]]
==== Add the {agent} {ls} integration to monitor host logs and metrics

. Go to the {kib} home page, and click **Add integrations**.
+
--
[role="screenshot"]
image::images/kibana-home.png[{kib} home page]
--

. In the query bar, search for **{ls}** and select the integration to see more
details.

. Click **Add {ls}**.

. Configure the integration name and add a description (optional).

. Configure the integration to collect logs. 
* Make sure that **Logs** is turned on if you want to collect logs from your {ls} instance. Be sure that the required settings are correctly configured.
* Under **Logs**, modify the log paths to match your {ls} environment.

. Configure the integration to collect metrics.
* Make sure that **Metrics (Technical Preview)** is turned on, and **Metrics (Stack Monitoring)** is turned off.
* Under **Metrics (Technical Preview)**, make sure the {ls} URL setting
points to your {ls} instance URLs. +
By default, the integration collects {ls}
monitoring metrics from `https://localhost:9600`. If that host and port number are not
correct, update the `Logstash URL` setting. If you configured {ls} to use encrypted
communications and/or a username and password, you must access it via HTTPS, and expand the **Advanced Settings** options, and fill in with the appropriate values for your {ls} instance.

. Click **Save and continue**. +
This step takes a minute or two to complete. When
it's done, you'll have an agent policy that contains a system integration policy
for the configuration you just specified.
. In the popup, click **Add {agent} to your hosts** to open the **Add agent**
flyout.
+
TIP: If you accidentally close the popup, go to **{fleet} > Agents** and click
**Add agent**.


[discrete]
[[add-agent-to-fleet-ead]]

=== Install and run an {agent} on your machine
// Include section about installing agents
include::monitoring-install.asciidoc[tag=install-agent-widget]

[discrete]
[[view-assets-ead]]
=== View assets
// Include section about viewing assets
include::monitoring-view.asciidoc[]

[discrete]
[[view-data-dashboard]]
=== Monitor {ls} logs and metrics

From the list of assets, open the **[Metrics {ls}] {ls} overview** dashboard to view overall performance. Then follow the navigation panel to further drill down into {ls} performance.
+
[role="screenshot"]
image::images/integration-dashboard-overview.png[The {ls} Overview dashboard in {kib} with various metrics from your monitored {ls}]

You can hover over any visualization to adjust its settings, or click the
**Edit** button to make changes to the dashboard. To learn more, refer to
{kibana-ref}/dashboard.html[Dashboard and visualizations].
