Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Part III. Accessing Prometheus


For this release, Prometheus is only supported for Fuse on OpenShift. For documentation about Prometheus on OpenShift Container Platform, go to:


Prometheus on OpenShift Container Platform is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs), might not be functionally complete, and Red Hat does not recommend to use them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information on Red Hat Technology Preview features support scope, see

You can use Prometheus to monitor and store Fuse on OpenShift data by exposing an endpoint with your Fuse application’s data to Prometheus format. Prometheus stores the data so that you can use a graphical tool, such as Grafana, to visualize and run queries on the data.

1. OpenShift setup

To use Prometheus to monitor Fuse on OpenShift you must:

  • Install the Ansible Service Broker (ASB), which requires OpenShift v3.9 or later. To install the Ansible Service Broker, follow the instructions here:
  • When you start OpenShift, use the --service-catalog option.

2. Installing Prometheus

The Ansible Playbook Bundle uses an image of Prometheus:

  1. To install the Ansible Playbook Bundle (APB), run these commands:

    chmod +x
  2. To give the developer account permissions to install, run the following commands:

    oc create -n ansible-service-broker -f
    oc export cm/broker-config -n ansible-service-broker | sed 's/sandbox_role: .*/sandbox_role: \"admin\"/' | oc replace -f - cm/broker-config -n ansible-service-broker

    The Prometheus APB should appear.

  3. Follow the provided instructions. Optionally, you can install Grafana.

For information about getting started with Prometheus, go to:

3. Configuring Prometheus

You can set the following environment variables in OpenShift in order to configure your application’s Prometheus agent:

Table 3. Prometheus Environment Variables

Environment VariableDescriptionDefault


The host address to bind.


If set, disables the activation of Prometheus (echoes an empty value).

Prometheus is enabled.


The Port to use.



Uses the file (including path) as the Prometheus configuration file.

The /opt/prometheus/prometheus-config.yml file with Camel metrics


Additional options to append to the JMX exporter configuration.

Not applicable.

4. Controlling the metrics that Prometheus monitors and collects

By default, Prometheus uses a configuration file ( that includes all possible metrics exposed by Camel.

If you have custom metrics within your application that you want Prometheus to monitor and collect (for example, the number of orders that your application processes), you can use your own configuration file. Note that the metrics that you can identify are limited to those supplied in JMX.

To use a custom configuration file to expose JMX beans that are not covered by the default configuration, follow these steps:

  1. Create a custom Prometheus configuration file. You can use the contents of the default file (prometheus-config.yml as a guide for the format.

    You can use any name for the custom configuration file, for example: my-prometheus-config.yml

  2. Add your prometheus configuration file (for example, my-prometheus-config.yml) to your application’s src/main/fabric8-includes directory.
  3. Create a src/main/fabric8/deployment.xml file within your application and add an entry for the AB_JMX_EXPORTER_CONFIG environment variable with its value set to your configuration file. For example:

    value: “my-prometheus-config.yml”

    This environment variable applies to your application at the pod level.

  4. Rebuild and deploy your application.

5. Viewing Prometheus metrics with Grafana

Grafana is an analytics platform that allows you to query, visualize, alert on and understand your metrics using dashboards.

To view Prometheus metrics with Grafana, you need to:

6. Generating alerts

For an example of using Prometheus for OpenShift to generate alerts, see the Red Hat Cloud Forms Monitoring, Alerts, and Reporting guide: