이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Part III. Accessing Prometheus


Note

For this release, Prometheus is only supported for Fuse on OpenShift. For documentation about Prometheus on OpenShift Container Platform, go to: https://access.redhat.com/documentation/en-us/openshift_container_platform/3.9/html/installation_and_configuration/install-config-cluster-metrics#openshift-prometheus

Important

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 https://access.redhat.com/support/offerings/techpreview/.

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: https://github.com/openshift/ansible-service-broker
  • When you start OpenShift, use the --service-catalog option.

2. Installing Prometheus

The Ansible Playbook Bundle uses an image of Prometheus: https://github.com/ansibleplaybookbundle/prometheus-apb

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

    wget https://raw.githubusercontent.com/openshift/ansible-service-broker/master/
               scripts/run_latest_build.sh
    
    chmod +x run_latest_build.sh
    
    ./run_latest_build.sh
    Copy to Clipboard Toggle word wrap
  2. To give the developer account permissions to install, run the following commands:

    oc create -n ansible-service-broker -f https://raw.githubusercontent.com/ansibleplaybookbundle/ansible-playbook-bundle/apb-1.1.6-1/templates/openshift-permissions.template.yaml
    Copy to Clipboard Toggle word wrap
    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
    Copy to Clipboard Toggle word wrap

    The Prometheus APB should appear.

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

For information about getting started with Prometheus, go to: https://prometheus.io/docs/prometheus/latest/getting_started/

3. Configuring Prometheus

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

Expand
Table 3. Prometheus Environment Variables
Environment VariableDescriptionDefault

AB_PROMETHEUS_HOST

The host address to bind.

0.0.0.0

AB_PROMETHEUS_OFF

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

Prometheus is enabled.

AB_PROMETHEUS_PORT

The Port to use.

9779

AB_JMX_EXPORTER_CONFIG

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

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

AB_JMX_EXPORTER_OPTS

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 ( https://raw.githubusercontent.com/jboss-fuse/application-templates/master/prometheus/prometheus-config.yml) 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 https://raw.githubusercontent.com/jboss-fuse/application-templates/master/prometheus/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:

    env:
        name: AB_JMX_EXPORTER_CONFIG
    value: “my-prometheus-config.yml”
    Copy to Clipboard Toggle word wrap

    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:

https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.6/html/monitoring_alerts_and_reporting/integrating_prometheus_alerts

맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat