Monitoring multiple federated instances with Prometheus

 Today we will be learning about the Prometheus federation. if you are new to Prometheus, You can go through this blog to learn about instrumenting Prometheus in an application and this blog for configuration of Prometheus server. We will understand when and why to use Prometheus and implement it.

  1. Configuring a child Prometheus.
global:
scrape_interval: 15s
external_labels:
monitor: 'my-app-monitor'
# Scraping the application
- job_name: 'my-application'
scrape_interval: 5s
metrics_path: /metrics
static_configs:
- targets: ['<my-app-service>:<port>'] #add configuration for you app IP, domain name . service name for apps running in kubernetes
scrape_configs:
- job_name: 'my-app-federation'
scrape_interval: 20s
scrape_timeout: 20s

metrics_path: /federate
honor_labels: true

params:
match[]:
- '{__name__=~"job:.*"}'
static_configs:
- targets: ['child-prometheus1:9090'] #Child prometheus
- targets: ['child-prometheus2:9090']
- targets: ['child-prometheus3:9090']

Comments

Popular posts from this blog

Loki, Grafana, and Promtail integration using Docker

Getting Started | Infrastructure as Code(IaC) with examples.