Categorygithub.com/bosh-prometheus/cf_exporter
repositorypackage
0.10.1
Repository: https://github.com/bosh-prometheus/cf_exporter.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

Cloud Foundry Prometheus Exporter Build Status

A Prometheus exporter for Cloud Foundry administrative information. Please refer to the FAQ for general questions about this exporter.

Architecture overview

Installation

Binaries

Download the already existing binaries for your platform:

$ ./cf_exporter <flags>

From source

Using the standard go install (you must have Go already installed in your local machine):

$ go install github.com/bosh-prometheus/cf_exporter
$ cf_exporter <flags>

Docker

To run the cf exporter as a Docker container, run:

$ docker run -p 9193:9193 boshprometheus/cf-exporter <flags>

Cloud Foundry

The exporter can be deployed to an already existing Cloud Foundry environment:

$ git clone https://github.com/bosh-prometheus/cf_exporter.git
$ cd cf_exporter

Modify the included application manifest file to include your Cloud Foundry properties. Then you can push the exporter to your Cloud Foundry environment:

$ cf push

BOSH

This exporter can be deployed using the Prometheus BOSH Release.

Usage

UAA Client

In order to connect to the Cloud Foundry API a client-id and client-secret must be provided. The client-id must have the cloud_controller.admin authority.

For example, to create a new client-id and client-secret with the right permissions:

uaac target https://<YOUR UAA URL> --skip-ssl-validation
uaac token client get <YOUR ADMIN CLIENT ID> -s <YOUR ADMIN CLIENT SECRET>
uaac client add prometheus-cf \
  --name prometheus-cf \
  --secret prometheus-cf-client-secret \
  --authorized_grant_types client_credentials,refresh_token \
  --authorities cloud_controller.admin

Flags

Flag / Environment VariableRequiredDefaultDescription
cf.api_url
CF_EXPORTER_CF_API_URL
YesCloud Foundry API URL
cf.username
CF_EXPORTER_CF_USERNAME
[1]Cloud Foundry Username (must be an administrator user)
cf.password
CF_EXPORTER_CF_PASSWORD
[1]Cloud Foundry Password
cf.client-id
CF_EXPORTER_CF_CLIENT_ID
[1]Cloud Foundry Client ID (must have the cloud_controller.admin or cloud_controller.admin_read_only scope)
cf.client-secret
CF_EXPORTER_CF_CLIENT_SECRET
[1]Cloud Foundry Client Secret
cf.deployment-name
CF_EXPORTER_CF_DEPLOYMENT_NAME
YesCloud Foundry Deployment Name to be reported as a metric label
cf.api-v3-enabled
CF_EXPORTER_CF_API_V3_ENABLED
NoFalseEnable Cloud Foundry API V3 calls
events.query
CF_EXPORTER_EVENTS_QUERY
NoWhen the Events filter is enabled and this value is set, this query is sent to the CloudController to limit the number of results returned. Syntax is exactly as documented at the Cloud Foundry API
filter.collectors
CF_EXPORTER_FILTER_COLLECTORS
NoComma separated collectors to filter. If not set, all collectors except Events will be enabled (Applications, Buildpacks,Events, IsolationSegments, Organizations, Routes, SecurityGroups, ServiceBindings, ServiceInstances, ServicePlans, Services, Spaces, Stacks). IsolationSegments collector requires cf.api-v3-enabled enabled
metrics.namespace
CF_EXPORTER_METRICS_NAMESPACE
NocfMetrics Namespace
metrics.environment
CF_EXPORTER_METRICS_ENVIRONMENT
YesEnvironment label to be attached to metrics
skip-ssl-verify
CF_EXPORTER_SKIP_SSL_VERIFY
NofalseDisable SSL Verify
web.listen-address
CF_EXPORTER_WEB_LISTEN_ADDRESS
No:9193Address to listen on for web interface and telemetry
web.telemetry-path
CF_EXPORTER_WEB_TELEMETRY_PATH
No/metricsPath under which to expose Prometheus metrics
web.auth.username
CF_EXPORTER_WEB_AUTH_USERNAME
NoUsername for web interface basic auth
web.auth.password
CF_EXPORTER_WEB_AUTH_PASSWORD
NoPassword for web interface basic auth
web.tls.cert_file
CF_EXPORTER_WEB_TLS_CERTFILE
NoPath to a file that contains the TLS certificate (PEM format). If the certificate is signed by a certificate authority, the file should be the concatenation of the server's certificate, any intermediates, and the CA's certificate
web.tls.key_file
CF_EXPORTER_WEB_TLS_KEYFILE
NoPath to a file that contains the TLS private key (PEM format)

[1] Either cf.username and cf.password or cf.client-id and cf.client-secret must be provided. When using cf.username and cf.password, tokens are not refreshed, so after a period of time the exporter will be unable to communicate with the CF API, so use this method only when testing the exporter. For production, it is recommended to use the cf.client-id and cf.client-secret authentication method.

Metrics

The exporter returns the following Applications metrics:

MetricDescriptionLabels
metrics.namespace_application_infoLabeled Cloud Foundry Application information with a constant 1 valueenvironment, deployment, application_id, application_name, detected_buildpack, buildpack, organization_id, organization_name, space_id, space_name, stack_id, state
metrics.namespace_application_instancesNumber of desired Cloud Foundry Application Instancesenvironment, deployment, application_id, application_name, organization_id, organization_name, space_id, space_name, state
metrics.namespace_application_instances_runningNumber of running Cloud Foundry Application Instancesenvironment, deployment, application_id, application_name, organization_id, organization_name, space_id, space_name, state
metrics.namespace_application_memory_mbCloud Foundry Application Memory (Mb)environment, deployment, application_id, application_name, organization_id, organization_name, space_id, space_name
metrics.namespace_application_disk_quota_mbCloud Foundry Application Disk Quota (Mb)environment, deployment, application_id, application_name, organization_id, organization_name, space_id, space_name
metrics.namespace_applications_scrapes_totalTotal number of scrapes for Cloud Foundry Applicationsenvironment, deployment
metrics.namespace_applications_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Applicationsenvironment, deployment
metrics.namespace_last_applications_scrape_errorWhether the last scrape of Applications metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_applications_scrape_timestampNumber of seconds since 1970 since last scrape of Applications metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_applications_scrape_duration_secondsDuration of the last scrape of Applications metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Buildpacks metrics:

MetricDescriptionLabels
metrics.namespace_buildpack_infoLabeled Cloud Foundry Buildpacks information with a constant 1 valueenvironment, deployment, buildpack_id, buildpack_name, buildpack_stack, buildpack_filename
metrics.namespace_buildpacks_scrapes_totalTotal number of scrapes for Cloud Foundry Buildpacksenvironment, deployment
metrics.namespace_buildpacks_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Buildpacksenvironment, deployment
metrics.namespace_last_buildpacks_scrape_errorWhether the last scrape of Buildpacks metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_buildpacks_scrape_timestampNumber of seconds since 1970 since last scrape of Buildpacks metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_buildpacks_scrape_duration_secondsDuration of the last scrape of Buildpacks metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Events metrics:

MetricDescriptionLabels
metrics.namespace_events_infoLabeled Cloud Foundry Events information with a constant 1 valueenvironment, deployment, type, actor, actor_type, actor_name, actor_username, actee, actee_type, actee_name, space_id, organization_id
metrics.namespace_events_scrapes_totalTotal number of scrapes for Cloud Foundry Eventsenvironment, deployment
metrics.namespace_events_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Eventsenvironment, deployment
metrics.namespace_last_events_scrape_errorWhether the last scrape of Events metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_events_scrape_timestampNumber of seconds since 1970 since last scrape of Events metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_events_scrape_duration_secondsDuration of the last scrape of Events metrics from Cloud Foundryenvironment, deployment

The exporter returns the following IsolationSegments metrics (requires cf.api-v3-enabled enabled):

MetricDescriptionLabels
metrics.namespace_isolation_segment_infoLabeled Cloud Foundry Isolation Segment information with a constant 1 valueenvironment, deployment, isolation_segment_id, isolation_segment_name
metrics.namespace_isolation_segments_scrapes_totalTotal number of scrapes for Cloud Foundry Isolation Segmentsenvironment, deployment
metrics.namespace_isolation_segments_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Isolation Segmentsenvironment, deployment
metrics.namespace_last_isolation_segments_scrape_errorWhether the last scrape of Isolation Segments metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_isolation_segments_scrape_timestampNumber of seconds since 1970 since last scrape of Isolation Segments metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_isolation_segments_scrape_duration_secondsDuration of the last scrape of Isolation Segments metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Organizations metrics:

MetricDescriptionLabels
metrics.namespace_organization_infoLabeled Cloud Foundry Organization information with a constant 1 valueenvironment, deployment, organization_id, organization_name, quota_name
metrics.namespace_organization_non_basic_services_allowedA Cloud Foundry Organization can provision instances of paid service plans? (1 for true, 0 for false)environment, deployment, organization_id, organization_name
metrics.namespace_organization_instance_memory_mb_limitMaximum amount of memory (Mb) an application instance can have in a Cloud Foundry Organizationenvironment, deployment, organization_id, organization_name
metrics.namespace_organization_total_app_instances_quotaTotal number of application instances that may be created in a Cloud Foundry Organizationenvironment, deployment, organization_id, organization_name
metrics.namespace_organization_total_app_tasks_quotaTotal number of application tasks that may be created in a Cloud Foundry Organizationenvironment, deployment, organization_id, organization_name
metrics.namespace_organization_total_memory_mb_quotaTotal amount of memory (Mb) a Cloud Foundry Organization can haveenvironment, deployment, organization_id, organization_name
metrics.namespace_organization_total_private_domains_quotaTotal number of private domains that may be created in a Cloud Foundry Organizationenvironment, deployment, organization_id, organization_name
metrics.namespace_organization_total_reserved_route_ports_quotaTotal number of routes that may be created with reserved ports in a Cloud Foundry Organizationenvironment, deployment, organization_id, organization_name
metrics.namespace_organization_total_routes_quotaTotal number of routes that may be created in a Cloud Foundry Organizationenvironment, deployment, organization_id, organization_name
metrics.namespace_organization_total_service_keys_quotaTotal number of service keys that may be created in a Cloud Foundry Organizationenvironment, deployment, organization_id, organization_name
metrics.namespace_organization_total_services_quotaTotal number of service instances that may be created in a Cloud Foundry Organizationenvironment, deployment, organization_id, organization_name
metrics.namespace_organizations_scrapes_totalTotal number of scrapes for Cloud Foundry Organizationsenvironment, deployment
metrics.namespace_organizations_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Organizationsenvironment, deployment
metrics.namespace_last_organizations_scrape_errorWhether the last scrape of Organizations metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_organizations_scrape_timestampNumber of seconds since 1970 since last scrape of Organizations metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_organizations_scrape_duration_secondsDuration of the last scrape of Organizations metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Routes metrics:

MetricDescriptionLabels
metrics.namespace_route_infoLabeled Cloud Foundry Route information with a constant 1 valueenvironment, deployment, route_id, route_host, route_path, domain_id, space_id, service_instance_id
metrics.namespace_routes_scrapes_totalTotal number of scrapes for Cloud Foundry Routesenvironment, deployment
metrics.namespace_routes_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Routesenvironment, deployment
metrics.namespace_last_routes_scrape_errorWhether the last scrape of Routes metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_routes_scrape_timestampNumber of seconds since 1970 since last scrape of Routes metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_routes_scrape_duration_secondsDuration of the last scrape of Routes metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Security Groups metrics:

MetricDescriptionLabels
metrics.namespace_security_group_infoLabeled Cloud Foundry Security Group information with a constant 1 valueenvironment, deployment, security_group_id, security_group_name
metrics.namespace_security_groups_scrapes_totalTotal number of scrapes for Cloud Foundry Security Groupsenvironment, deployment
metrics.namespace_security_groups_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Security Groupsenvironment, deployment
metrics.namespace_last_security_groups_scrape_errorWhether the last scrape of Security Groups metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_security_groups_scrape_timestampNumber of seconds since 1970 since last scrape of Security Groups metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_security_groups_scrape_duration_secondsDuration of the last scrape of Security Groups metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Services metrics:

MetricDescriptionLabels
metrics.namespace_service_infoLabeled Cloud Foundry Service information with a constant 1 valueenvironment, deployment, service_id, service_label
metrics.namespace_services_scrapes_totalTotal number of scrapes for Cloud Foundry Servicesenvironment, deployment
metrics.namespace_services_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Servicesenvironment, deployment
metrics.namespace_last_services_scrape_errorWhether the last scrape of Services metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_services_scrape_timestampNumber of seconds since 1970 since last scrape of Services metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_services_scrape_duration_secondsDuration of the last scrape of Services metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Service Bindings metrics:

MetricDescriptionLabels
metrics.namespace_service_binding_infoLabeled Cloud Foundry Service Binding information with a constant 1 valueenvironment, deployment, sservice_binding_id, application_id, service_instance_id
metrics.namespace_service_bindings_scrapes_totalTotal number of scrapes for Cloud Foundry Service Bindingsenvironment, deployment
metrics.namespace_service_bindings_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Service Bindingsenvironment, deployment
metrics.namespace_last_service_bindings_scrape_errorWhether the last scrape of Service Bindings metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_service_bindings_scrape_timestampNumber of seconds since 1970 since last scrape of Service Bindings metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_service_bindings_scrape_duration_secondsDuration of the last scrape of Service Bindings metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Service Instances metrics:

MetricDescriptionLabels
metrics.namespace_service_instance_infoLabeled Cloud Foundry Service Instance information with a constant 1 valueenvironment, deployment, service_instance_id, service_instance_name, service_plan_id, space_id, type, last_operation_type, last_operation_state
metrics.namespace_service_instances_scrapes_totalTotal number of scrapes for Cloud Foundry Service Instancesenvironment, deployment
metrics.namespace_service_instances_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Service Instancesenvironment, deployment
metrics.namespace_last_service_instances_scrape_errorWhether the last scrape of Service Instances metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_service_instances_scrape_timestampNumber of seconds since 1970 since last scrape of Service Instances metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_service_instances_scrape_duration_secondsDuration of the last scrape of Service Instances metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Service Plans metrics:

MetricDescriptionLabels
metrics.namespace_service_plan_infoLabeled Cloud Foundry Service Plan information with a constant 1 valueenvironment, deployment, service_plan_id, service_plane_name, service_id
metrics.namespace_service_plans_scrapes_totalTotal number of scrapes for Cloud Foundry Service Plansenvironment, deployment
metrics.namespace_service_plans_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Service Plansenvironment, deployment
metrics.namespace_last_service_plans_scrape_errorWhether the last scrape of Service Plans metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_service_plans_scrape_timestampNumber of seconds since 1970 since last scrape of Service Plans metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_service_plans_scrape_duration_secondsDuration of the last scrape of Service Plans metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Spaces metrics:

MetricDescriptionLabels
metrics.namespace_space_infoLabeled Cloud Foundry Space information with a constant 1 valueenvironment, deployment, space_id, space_name, organization_id, quota_name
metrics.namespace_space_non_basic_services_allowedA Cloud Foundry Space can provision instances of paid service plans? (1 for true, 0 for false)environment, deployment, space_id, space_name, organization_id
metrics.namespace_space_instance_memory_mb_limitMaximum amount of memory (Mb) an application instance can have in a Cloud Foundry Spaceenvironment, deployment, space_id, space_name, organization_id
metrics.namespace_space_total_app_instances_quotaTotal number of application instances that may be created in a Cloud Foundry Spaceenvironment, deployment, space_id, space_name, organization_id
metrics.namespace_space_total_app_tasks_quotaTotal number of application tasks that may be created in a Cloud Foundry Spaceenvironment, deployment, space_id, space_name, organization_id
metrics.namespace_space_total_memory_mb_quotaTotal amount of memory (Mb) a Cloud Foundry Space can haveenvironment, deployment, space_id, space_name, organization_id
metrics.namespace_space_total_reserved_route_ports_quotaTotal number of routes that may be created with reserved ports in a Cloud Foundry Spaceenvironment, deployment, space_id, space_name, organization_id
metrics.namespace_space_total_routes_quotaTotal number of routes that may be created in a Cloud Foundry Spaceenvironment, deployment, space_id, space_name, organization_id
metrics.namespace_space_total_service_keys_quotaTotal number of service keys that may be created in a Cloud Foundry Spaceenvironment, deployment, space_id, space_name, organization_id
metrics.namespace_space_total_services_quotaTotal number of service instances that may be created in a Cloud Foundry Spaceenvironment, deployment, space_id, space_name, organization_id
metrics.namespace_spaces_scrapes_totalTotal number of scrapes for Cloud Foundry Spacesenvironment, deployment
metrics.namespace_spaces_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Spacesenvironment, deployment
metrics.namespace_last_spaces_scrape_errorWhether the last scrape of Spaces metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_spaces_scrape_timestampNumber of seconds since 1970 since last scrape of Spaces metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_spaces_scrape_duration_secondsDuration of the last scrape of Spaces metrics from Cloud Foundryenvironment, deployment

The exporter returns the following Stacks metrics:

MetricDescriptionLabels
metrics.namespace_stack_infoLabeled Cloud Foundry Stack information with a constant 1 valueenvironment, deployment, stack_id, stack_name
metrics.namespace_stacks_scrapes_totalTotal number of scrapes for Cloud Foundry Stacksenvironment, deployment
metrics.namespace_stacks_scrape_errors_totalTotal number of scrape errors of Cloud Foundry Stacksenvironment, deployment
metrics.namespace_last_stacks_scrape_errorWhether the last scrape of Stacks metrics from Cloud Foundry resulted in an error (1 for error, 0 for success)environment, deployment
metrics.namespace_last_stacks_scrape_timestampNumber of seconds since 1970 since last scrape of Stacks metrics from Cloud Foundryenvironment, deployment
metrics.namespace_last_stacks_scrape_duration_secondsDuration of the last scrape of Stacks metrics from Cloud Foundryenvironment, deployment

Contributing

Refer to the contributing guidelines.

License

Apache License 2.0, see LICENSE.