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
targetsfield understatic_configsis a list of endpoints that Prometheus will scrape. Each target is specified as a string in the formathostname:port.Since the targets are static, if you need to add or remove targets, you must modify the
prometheus.ymlfile 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:scrape_intervalof 5 seconds is used for testing purposes; the default is typically 15 seconds.schememust be set to "https" if the web server uses HTTPS; otherwise, it defaults to HTTP.- The
metrics_pathdepends on the web server used. For Apache/NGINX server, the connector is typically configured as /gas - The
insecure_skip_verifyfield undertls_configoption should be set to "true" in development to avoid connection rejection if self-signed certificates are used. - The
targetsfield includes a list of endpoints that Prometheus will scrape. Each target is defined as a string in the formathostname:port. In our example, there are two hosts:irisandpayaye, 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:scrape_intervalof 5 seconds is used for testing purposes; the default is typically 15 seconds.schememust be set to "https" if the web server uses HTTPS; otherwise, it defaults to HTTP.- The
metrics_pathdepends on the web server used. For IIS on Windows, the connector is configured based on the IIS application pool configuration,GAS_QAAPP_NIGHTLYin our example. - The
insecure_skip_verifyfield undertls_configoption should be set to "true" in development to avoid connection rejection if self-signed certificates are used. - The
targetsfield contains a list of endpoints that Prometheus will scrape. Each target is defined as a string in the formathostname:port. In our example, there is one host –julia– listening on port 443.