Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

This page describes the steps to set up a Prometheus monitoring server to obtain metrics data from your deployment.

Prerequisites

The following must be completed before setting up Prometheus:

Setup with example Prometheus configuration file

  1. Go to the extracted Prometheus directory.

    cd prometheus-*
  2. Create a yaml file named prometheus_mz.yaml as follows.

    # my global config
    global:
      scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
      evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
      # scrape_timeout is set to the global default (10s).
    # A scrape configuration containing exactly one endpoint to scrape:
    # Here it's Prometheus itself.
    scrape_configs:
      # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
      #- job_name: 'prometheus'
      #  # metrics_path defaults to '/metrics'
      #  # scheme defaults to 'http'.
      #  static_configs:
      #  - targets: ['localhost:9090']
      - job_name: 'mz'
        static_configs:
        - targets: ['localhost:8888'] # port defined in the topo STR config
          labels:
            pico: 'platform'
        - targets: ['localhost:9090'] # port defined in the topo STR config
          labels:
            pico: 'ec1'

Configuring JMX exporter for Platform server

To enable Prometheus to scrape metrics from your Platform, you need to configure the JMX exporter. The JMX exporter will expose and export all the metrics from your Platform, allowing Prometheus server to collect them.

In the platform.xml file for your Platform, set the platform.export.jmx.enabled value to true to enable the Prometheus server to scrape JMX metrics from the Platform. Additionally, you can configure the port for the JMX exporter by setting platform.export.jmx.port to your desired port number. This allows the JMX exporter to expose metrics on the specified port.

To configure the JMX exporter,

  1. Create a yaml file named jmxExport.yml as follows.
    For more information on the yaml file, refer to jmx_exporter/docs at main · prometheus/jmx_exporter (github.com).

    startDelaySeconds: 0
    ssl: false
    lowercaseOutputName: false
    lowercaseOutputLabelNames: false
  2. Add the following jvmargs to the platform topo configuration.

    $ mzsh topo set topo://container:main1/pico:platform/obj:config.jvmargs.args \
    '["-javaagent:common/lib/jmx_prometheus_javaagent.jar=8888:<path>/jmxExporter.yaml"]'
  3. Restart the Platform.

    $ mzsh restart platform

Starting a Prometheus

To start the Prometheus, use the following command:

$ cd prometheus-*
$ ./prometheus --config.file=prometheus_mz.yml --web.listen-address=:10090

Info!

By default, Prometheus listens on port 9090, which may conflict with the default port of EC1. You can change the listening port using the --web.listen-address argument as shown above.

  • No labels