meldestelle/config/docker/monitoring/prometheus/prometheus.yaml
Stefan Mogeritsch 78cda88ae6
All checks were successful
Build and Publish Docker Images / build-and-push (., backend/infrastructure/gateway/Dockerfile, api-gateway, api-gateway) (push) Successful in 9m22s
Build and Publish Docker Images / build-and-push (., backend/services/ping/Dockerfile, ping-service, ping-service) (push) Successful in 8m53s
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Successful in 2m34s
Build and Publish Docker Images / build-and-push (., config/docker/keycloak/Dockerfile, keycloak, keycloak) (push) Successful in 2m10s
infra: integrate Keycloak monitoring, update alertmanager config, and finalize docs cleanup
Added a Prometheus scrape job for Keycloak metrics. Updated Alertmanager to use Mailpit for local testing. Completed documentation consolidation and marked cleanup-related tasks as done in the master roadmap.
2026-03-05 13:16:43 +01:00

73 lines
2.2 KiB
YAML

# ===================================================================
# Prometheus Configuration for Meldestelle
# Features: Consul Service Discovery, Spring Boot Actuator support
# ===================================================================
global:
scrape_interval: 15s
evaluation_interval: 15s
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- "alertmanager:9093"
rule_files:
- "/etc/prometheus/rules/alerts.yaml"
scrape_configs:
# 1. Prometheus Self-Monitoring
- job_name: 'prometheus'
static_configs:
- targets: [ 'localhost:9090' ]
# 2. Consul Self-Monitoring
- job_name: 'consul'
metrics_path: '/v1/agent/metrics'
params:
format: [ 'prometheus' ]
static_configs:
- targets: [ 'consul:8500' ]
# 3. Keycloak Metrics (statisches Target)
- job_name: 'keycloak'
metrics_path: '/metrics'
static_configs:
- targets: [ 'keycloak:8080' ]
# 4. Spring Boot Services via Consul Discovery.
# Das ist die Magie: Prometheus fragt Consul nach allen Services.
# Wenn ein Service das Tag 'metrics' oder 'spring-boot' hat (oder einfach alle), wird er scraped.
- job_name: 'consul-services'
consul_sd_configs:
- server: 'consul:8500'
services: [ ] # Leere Liste = Alle Services
relabel_configs:
# Nur Services scrapen, die NICHT consul selbst sind (das haben wir oben schon)
- source_labels: [ __meta_consul_service ]
regex: consul
action: drop
# Setze den Pfad auf /actuator/prometheus für Spring Boot Apps
# Optional: Man kann das auch über Consul Tags steuern
- source_labels: [ __meta_consul_service ]
target_label: __metrics_path__
replacement: /actuator/prometheus
# Übernehme den Service-Namen als 'application' Label
- source_labels: [ __meta_consul_service ]
target_label: application
# Behalte die Instanz (IP: Port)
- source_labels: [ __meta_consul_address, __meta_consul_service_port ]
separator: ':'
target_label: instance
# Job 5: Postgres Exporter (Statisch, da kein Consul-Client im Image)
- job_name: 'postgres-exporter'
static_configs:
- targets: [ 'postgres-exporter:9187' ]