Configuring Prometheus to gather metrics

This topic provides an overview of how to configure Prometheus to collect metrics from various sources.

All configurations for Prometheus are defined in the prometheus.yml file of the Prometheus installation. Refer to the Prometheus documentation for more information about its configuration.

To gather metrics, configure prometheus.yml to target your FLM server as shown in the following section.

Scrape configurations

In the prometheus.yml file, you can specify several scrape configurations defining how often to collect metrics and from which targets:
  • Job name: Each configuration can have a job_name, which is a label used to identify the group of targets being scraped.
  • Targets: The targets field under static_configs is a list of endpoints that Prometheus will scrape. Each target is specified as a string in the format hostname:port.

    Since the targets are static, if you need to add or remove targets, you must modify the prometheus.yml file and restart Prometheus for the changes to take effect.

Below is an example of a prometheus.yml configuration.
-job_name: "flm"

     # Override the global default and scrape targets from this job every 15 seconds.
     scrape_interval: 15s
     scrape_timeout: 15s

     # metrics_path defaults to '/metrics'
     # scheme defaults to 'http'.
     scheme: "https"
     metrics_path: "/metrics"
     tls_config:
       insecure_skip_verify: true
     static_configs:
      -targets: ["julia:443"] 
Where:
  1. scrape_interval of 15 seconds is the default.
  2. scheme must be set to "https" if the web server uses HTTPS; otherwise, it defaults to HTTP.
  3. The metrics_path field must be configured based on the web server used.
  4. The insecure_skip_verify field under tls_config option must be set to "true" in development to avoid connection rejection if self-signed certificates are used.
  5. The targets field includes a list of endpoints that Prometheus will scrape. Each target is defined as a string in the format hostname:port. In our example, there is one host: julia listening on port 443.