Configure Prometheus to gather GAS metrics

A Prometheus server can collect metrics from various sources. To gather metrics from the Genero Application Server, you must configure Prometheus to target the appropriate GAS port or URL.

All configurations for Prometheus are defined in the prometheus.yml file. For more information on installing or configuring Prometheus, refer to the Prometheus documentation (external link).

Scrape configurations

In the prometheus.yml file, you can specify multiple 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 are examples for UNIX® and Windows configurations. The configurations are basically identical apart from the metrics_path field, which will depend on the web server connector used by the GAS.
Unix
-job_name: 'unix'

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

     # metrics_path defaults to '/metrics'
     # scheme defaults to 'http'.
     scheme: "https"
     metrics_path: "/gas/metrics"
     tls_config:
       insecure_skip_verify: true
     static_configs:
       -targets: ["iris:9443","papaye:9443"]
Where:
  1. scrape_interval of 5 seconds is used for testing purposes; the default is typically 15 seconds.
  2. scheme must be set to "https" if the web server uses HTTPS; otherwise, it defaults to HTTP.
  3. The metrics_path depends on the web server used. For Apache/NGINX server, the connector is typically configured as /gas
  4. The insecure_skip_verify field under tls_config option should 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 are two hosts: iris and payaye, both listening on port 9443.
Windows
-job_name: 'windows'

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

     # metrics_path defaults to '/metrics'
     # scheme defaults to 'http'.
     scheme: "https"
     metrics_path: "/GAS_QAAPP_NIGHTLY/metrics"
     tls_config:
       insecure_skip_verify: true
     static_configs:
      -targets: ["julia:443"]
Where:
  1. scrape_interval of 5 seconds is used for testing purposes; the default is typically 15 seconds.
  2. scheme must be set to "https" if the web server uses HTTPS; otherwise, it defaults to HTTP.
  3. The metrics_path depends on the web server used. For IIS on Windows, the connector is configured based on the IIS application pool configuration, GAS_QAAPP_NIGHTLY in our example.
  4. The insecure_skip_verify field under tls_config option should be set to "true" in development to avoid connection rejection if self-signed certificates are used.
  5. The targets field contains 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.