[role="xpack"] [[how-monitoring-works]] == How monitoring works ++++ How it works ++++ Each monitored {stack} component is considered unique in the cluster based on its persistent UUID, which is written to the <> 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 how these documents are structured or stored, refer to <>. You can use {agent} or {metricbeat} to collect monitoring data and to ship it directly 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 monitoring data from {es}: ** <>: Uses a single agent to gather logs and metrics. Can be managed from a central location in {fleet}. ** <>: Uses a lightweight {beats} shipper to gather metrics. May be preferred if you have an existing investment in {beats} or are not yet ready to use {agent}. ** <>: Uses internal exporters to gather metrics. Not recommended. If you have previously configured legacy collection 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}] ** {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]