Each Elasticsearch node, Logstash node, Kibana instance, and Beat is considered unique in the
cluster based on its persistent UUID, which is written to the
path.data directory when the node or instance starts.
Monitoring documents are just ordinary JSON documents built by monitoring each Elastic Stack component at some collection interval. If you want to alter the templates for these indices, see Configuring indices for monitoring.
Each component in the Elastic Stack is responsible for monitoring itself and then forwarding those documents to the production cluster for both routing and indexing (storage). The routing and indexing processes in Elasticsearch are handled by what are called collectors and exporters. In the past, collectors and exporters were considered to be part of a monitoring "agent", but that term is generally not used anymore.
To learn how to collect monitoring data, see: