Skip to main content

Integrate with Prometheus

This topic provides a sample configuration to set up Prometheus to scrape performance metrics for your Polaris environment.

Prerequisites

Instructions

The following is an example configuration for Prometheus to collect metrics about your Polaris environment. Add this job definition to the scrape_configs section in your prometheus.yml file and restart your Prometheus instance. For a complete specification of configuration options, refer to the Prometheus configuration documentation.

scrape_configs:
- job_name: imply

# The Metrics export API resource path.
metrics_path: '/v1/metrics/export'
scheme: https

# Replace POLARIS_API_KEY with your API key. Ensure that the API key has the AccessMetrics permission.
basic_auth:
username: apikey
password: "POLARIS_API_KEY"

# Polaris updates metrics every minute, so this interval is set to 60 seconds.
scrape_interval: 60s
honor_timestamps: true

# Replace ORGANIZATION_NAME with the name of your organization.
static_configs:
- targets: ["ORGANIZATION_NAME.api.imply.io"]

Optional: You can test this integration locally with the following Docker command. This command creates and starts a new Prometheus container, binds port 9090 from your container to your host, and mounts the prometheus.yml configuration file to the new Prometheus container.

Before running the command, create a file named prometheus.yml in your working directory and copy the configuration into that file.

docker run \
-p 9090:9090 \
-v ${PWD}/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus

Learn more

See the following topics for more information: