Use internal collection to send monitoring data

edit

Use internal collectors to send Beats monitoring data directly to your monitoring cluster. Or as an alternative to internal collection, use Use Metricbeat collection. The benefit of using internal collection instead of Metricbeat is that you have fewer pieces of software to install and maintain.

  1. Create an API key or user that has appropriate authority to send system-level monitoring data to Elasticsearch. For example, you can use the built-in apm_system user or assign the built-in apm_system role to another user. For more information on the required privileges, see Create a monitoring user. For more information on how to use API keys, see Grant access using API keys.
  2. Add the monitoring settings in the APM Server configuration file. If you configured the Elasticsearch output and want to send APM Server monitoring events to the same Elasticsearch cluster, specify the following minimal configuration:

    monitoring:
      enabled: true
      elasticsearch:
        api_key:  id:api_key 
        username: apm_system
        password: somepassword

    Specify one of api_key or username/password.

    If you want to send monitoring events to an Elastic Cloud monitoring cluster, you can use two simpler settings. When defined, these settings overwrite settings from other parts in the configuration. For example:

    monitoring:
      enabled: true
      cloud.id: 'staging:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRjZWM2ZjI2MWE3NGJmMjRjZTMzYmI4ODExYjg0Mjk0ZiRjNmMyY2E2ZDA0MjI0OWFmMGNjN2Q3YTllOTYyNTc0Mw=='
      cloud.auth: 'elastic:{pwd}'

    If you configured a different output, such as Logstash or you want to send APM Server monitoring events to a separate Elasticsearch cluster (referred to as the monitoring cluster), you must specify additional configuration options. For example:

    monitoring:
      enabled: true
      cluster_uuid: PRODUCTION_ES_CLUSTER_UUID 
      elasticsearch:
        hosts: ["https://example.com:9200", "https://example2.com:9200"] 
        api_key:  id:api_key 
        username: apm_system
        password: somepassword

    This setting identifies the Elasticsearch cluster under which the monitoring data for this APM Server instance will appear in the Stack Monitoring UI. To get a cluster’s cluster_uuid, call the GET / API against that cluster.

    This setting identifies the hosts and port numbers of Elasticsearch nodes that are part of the monitoring cluster.

    Specify one of api_key or username/password.

    If you want to use PKI authentication to send monitoring events to Elasticsearch, you must specify a different set of configuration options. For example:

    monitoring:
      enabled: true
      cluster_uuid: PRODUCTION_ES_CLUSTER_UUID
      elasticsearch:
        hosts: ["https://example.com:9200", "https://example2.com:9200"]
        username: ""
        ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
        ssl.certificate: "/etc/pki/client/cert.pem"
        ssl.key: "/etc/pki/client/cert.key"

    You must specify the username as "" explicitly so that the username from the client certificate (CN) is used. See SSL output settings for more information about SSL settings.

  3. Start APM Server.
  4. View the monitoring data in Kibana.