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
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 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: scrape_intervalof 15 seconds is the default.schememust be set to "https" if the web server uses HTTPS; otherwise, it defaults to HTTP.- The
metrics_pathfield must be configured based on the web server used. - The
insecure_skip_verifyfield undertls_configoption must 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 is one host:julialistening on port 443.