Skip to content

Instantly share code, notes, and snippets.

@apuravchauhan
Created August 30, 2020 13:39
Show Gist options
  • Save apuravchauhan/87498407085e8f0a5077467ea6b1760a to your computer and use it in GitHub Desktop.
Save apuravchauhan/87498407085e8f0a5077467ea6b1760a to your computer and use it in GitHub Desktop.
groups:
- name: Spring-boot
rules:
- alert: 5xx-over-2%
expr: sum(rate(orders_5xx_total[1m]))/sum(rate({__name__=~"orders_*.xx_total"}[1m])) *100 > 1
for: 15s
labels:
severity: critical
techteam: apurav
annotations:
summary: '{{ $labels }} {{ $value }} % breach'
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 1h
receiver: 'web.hook'
receivers:
- name: 'web.hook'
webhook_configs:
- url: 'http://localhost:8082/alert-hook'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- localhost:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "alert-rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'spring-boot-test'
metrics_path: /actuator/prometheus
static_configs:
- targets: ['localhost:8082']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment