This topic explains how to create a Metrics Forwarder for Pivotal Cloud Foundry (PCF) service instance and bind it to your app. For general information, see Managing Service Instances with the cf CLI.


Create a Service Instance

Every app and service in PCF is scoped to a space. This means that an app can use a service only if an instance of the service exists in the same space.

Confirm Service Availability

For apps to use a service, the service must be available in the Marketplace. To confirm you have installed Metrics Forwarder for PCF:

  1. Run cf marketplace from the command line.
  2. If the output lists metrics-forwarder in the service column, Metrics Forwarder for PCF is available. If the service is not available, install it.

See the following example:

$ cf marketplace
Getting services from marketplace in org my-org / space my-space as
service             plans      description

metrics-forwarder   unlimited  Custom metrics service

Create a Service Instance

To create an instance of the Metrics Forwarder for PCF service, run cf create-service metrics-forwarder unlimited SERVICE-INSTANCE-NAME, replacing SERVICE-INSTANCE-NAME with a name of your choice. After you create the service instance, this name appears under service in the output of the cf services command.

See the following example:

$ cf create-service metrics-forwarder unlimited my-instance
Creating service my-instance in org my-org / space my-space as OK
$ cf services
Getting services in org my-org / space my-space as OK name service plan bound apps last operation my-instance metrics-forwarder unlimited create succeeded

You can create only one instance in a space. If you attempt to create more than one instance in a space, you receive an error response.

Bind a Service Instance to Your App

For an app to use a service, you must bind it to a service instance. Do this after you push or re-push the app using cf push. You can bind the Metrics Forwarder for PCF service instance to more than one app. The number of apps bound to a single service instance does not affect the service instance.

To bind an app to a Metrics Forwarder instance, run cf bind-service APP-NAME SERVICE-INSTANCE-NAME, replacing APP-NAME with the name of the app you want to use the Metrics Forwarder service for and SERVICE-INSTANCE-NAME with the name you provided when you ran cf create-service.

See the following example:

$ cf bind-service my-app my-instance
Binding service my-instance to my-app in org my-org / space my-space as OK TIP: Use 'cf push' to ensure your env variable changes take effect
check-circle-line exclamation-circle-line close-line
Scroll to top icon