| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 | [role="xpack"][[how-monitoring-works]]== How monitoring works++++<titleabbrev>How it works</titleabbrev>++++Each monitored {stack} component is considered unique in the cluster based onits persistent UUID, which is written to the <<path-settings,`path.data`>>directory when the node or instance starts.Monitoring documents are just ordinary JSON documents built by monitoring each{stack} component at a specified collection interval. If you want to alter howthese documents are structured or stored, refer to <<config-monitoring-indices>>.You can use {agent} or {metricbeat} to collect monitoring data and to ship itdirectly to the monitoring cluster.To learn how to collect monitoring data, refer to:* One of the following topics depending on how you want to collect monitoringdata from {es}:** <<configuring-elastic-agent>>: Uses a single agent togather logs and metrics. Can be managed from a central location in {fleet}.** <<configuring-metricbeat>>: Uses a lightweight {beats}shipper to gather metrics. May be preferred if you have an existing investmentin {beats} or are not yet ready to use {agent}.** <<collecting-monitoring-data>>: Uses internal exporters togather metrics. Not recommended. If you have previously configured legacycollection methods, you should migrate to using {agent} or {metricbeat}.* {kibana-ref}/xpack-monitoring.html[Monitoring {kib}]* {logstash-ref}/configuring-logstash.html[Monitoring {ls}]* {enterprise-search-ref}/monitoring.html[Monitoring {ents}]* Monitoring {beats}:** {auditbeat-ref}/monitoring.html[{auditbeat}]** {filebeat-ref}/monitoring.html[{filebeat}]** {functionbeat-ref}/monitoring.html[{functionbeat}]** {heartbeat-ref}/monitoring.html[{heartbeat}]** {metricbeat-ref}/monitoring.html[{metricbeat}]** {packetbeat-ref}/monitoring.html[{packetbeat}]** {winlogbeat-ref}/monitoring.html[{winlogbeat}]* {apm-guide-ref}/monitor-apm.html[Monitoring APM Server]* {fleet-guide}/monitor-elastic-agent.html[Monitoring {agent}s]{fleet}-managed agents) or{fleet-guide}/elastic-agent-monitoring-configuration.html[Configure monitoring for standalone {agent}s]
 |