Skip to main content

Command Palette

Search for a command to run...

Prometheus in Federate mode

Updated
•1 min read•View as Markdown
Prometheus in Federate mode
A

DevOps Engineer trying to learn everything from CI/CD to Monitoring/Observability.

Prometheus Federation is a feature that allows multiple Prometheus servers to work together to collect and aggregate metrics. This is particularly useful in large, distributed environments where you may have multiple Prometheus instances running across different clusters or geographic locations.

The prometheus which scrapes other prometheus is called global prometheus and the configuration looks like below:

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'federate'
    honor_labels: true
    metrics_path: '/federate'
    params:
      'match[]':
        - '{job="example"}'
    static_configs:
      - targets:
        - 'remote-prometheus-server:9090'

Note: remote-prometheus-server -> prometheus running on remote server.

Official Documentation: https://prometheus.io/docs/prometheus/latest/federation/