docs/reference/metricbeat/running-on-cloudfoundry.md
You can use Metricbeat on Cloud Foundry to retrieve and ship metrics.
% However, version {{version.stack}} of Metricbeat has not yet been released, no build is currently available for this version.
To connect to loggregator and receive the logs, Metricbeat requires credentials created with UAA. The uaac command creates the required credentials for connecting to loggregator.
uaac client add metricbeat --name metricbeat --secret changeme --authorized_grant_types client_credentials,refresh_token --authorities doppler.firehose,cloud_controller.admin_read_only
::::{warning}
Use a unique secret: The uaac command shown here is an example. Remember to replace changeme with your secret, and update the metricbeat.yml file to use your chosen secret.
::::
You deploy Metricbeat as an application with no route.
Cloud Foundry requires that 3 files exist inside of a directory to allow Metricbeat to be pushed. The commands below provide the basic steps for getting it up and running.
curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{{version.stack}}-linux-x86_64.tar.gz
tar xzvf metricbeat-{{version.stack}}-linux-x86_64.tar.gz
cd metricbeat-{{version.stack}}-linux-x86_64
curl -L -O https://raw.githubusercontent.com/elastic/beats/{{ version.stack | M.M }}/deploy/cloudfoundry/metricbeat/metricbeat.yml
curl -L -O https://raw.githubusercontent.com/elastic/beats/{{ version.stack | M.M }}/deploy/cloudfoundry/metricbeat/manifest.yml
You need to modify the metricbeat.yml file to set the api_address, client_id and client_secret.
Metricbeat comes packaged with various pre-built {{kib}} dashboards that you can use to visualize data in {{kib}}.
If these dashboards are not already loaded into {{kib}}, you must run the Metricbeat setup command. To learn how, see Load {{kib}} dashboards.
::::{important} If you are using a different output other than {{es}}, such as {{ls}}, you need to Load the index template manually and Load {{kib}} dashboards.
::::
To deploy Metricbeat to Cloud Foundry, run:
cf push
To check the status, run:
$ cf apps
name requested state instances memory disk urls
metricbeat started 1/1 512M 1G
Metric events should start flowing to Elasticsearch. The events are annotated with metadata added by the add_cloudfoundry_metadata processor.
A single instance of Metricbeat can ship more than a hundred thousand events per minute. If your Cloud Foundry deployment is producing more events than Metricbeat can collect and ship, the Firehose will start dropping events, and it will mark Metricbeat as a slow consumer. If the problems persist, Metricbeat may be disconnected from the Firehose. In such cases, you will need to scale Metricbeat to avoid losing events.
The main settings you need to take into account are:
shard_id specified in the cloudfoundry module. The Firehose will divide the events amongst all the Metricbeat instances with the same value for this setting. All instances with the same shard_id should have the same configuration.cf scale or by specifying the number of instances in the manifest.Some basic recommendations to adjust these settings when Metricbeat is not able to collect all events:
shard_id.