Este contenido no está disponible en el idioma seleccionado.

Chapter 16. Enabling Prometheus metrics


Prometheus is an open-source systems and service monitoring and alerting toolkit that you can use to monitor services deployed in a standalone Apache Karaf container. Prometheus collects and stores metrics from configured services at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if a specified condition becomes true.

Important

Red Hat support for Prometheus is limited to the setup and configuration recommendations provided in Red Hat product documentation.

Prometheus uses “exporters” that are installed and configured on the clients to expose an endpoint to Prometheus format. This endpoint is an HTTP interface that provides a list of metrics and the current values of the metrics. Prometheus periodically scrapes each target-defined endpoint and writes the collected data to its database. Prometheus gathers data over an extended time, rather than just for the currently running session. Prometheus stores the data so that you can graphically visualize and run queries on the data.

16.1. Enabling the export of metrics from a standalone Apache Karaf container

Prometheus uses a configuration file ( https://raw.githubusercontent.com/jboss-fuse/application-templates/master/prometheus/prometheus-config.yml) which includes metrics exposed by Camel.

Note

The metrics that you can identify are limited to those supplied in JMX.

You must deploy a Fuse application in order for Apache Camel metrics to be generated.

Procedure

To enable the export of Prometheus metrics from a standalone Apache Karaf container using the command line:

  1. Open a command prompt and make sure you are in the etc/ directory of your Apache Karaf installation.
  2. Type the following command to create the Prometheus configuration file from the example file in the etc/ directory:

    cp prometheus-config.yml-example prometheus-config.yml
  3. The exporter is only available when you use the fuse or fuse.bat command to start Fuse: run bin/fuse on Linux/Unix or bin\fuse.bat on Windows.
  4. When Fuse has restarted, you can view the exposed metrics by opening a web browser at: http://localhost:9779
Note

Optionally you can change the default values of the KARAF_PROMETHEUS_PORT and KARAF_PROMETHEUS_CONFIG configuration variables from the command line.

16.2. Configuring the Prometheus server to scrape exposed metrics from the Apache Karaf container

To enable the Prometheus server to scrape metrics from the Apache Karaf container, the endpoint which exposes the metrics must be added to the targets property of the Prometheus configuration file.

Procedure

  1. Navigate to the /prometheus.yml configuration file in the Prometheus installation directory.
  2. Add the Apache Karaf endpoint to scrape:

    scrape_configs:
      - job_name: 'prometheus'
    
        # metrics_path defaults to '/metrics'
        # scheme defaults to 'http'.
        static_configs:
        - targets: ['localhost:9779']
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.