Guest User

alert

a guest
Jun 10th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.31 KB | None | 0 0
  1. docker-compose.yml: Сервисы запущены и работают.
  2. "version: '3'
  3. services:
  4.   prometheus:
  5.     image: prom/prometheus:latest
  6.     container_name: prometheus
  7.     ports:
  8.      - 9090:9090
  9.     volumes:
  10.      - ./prometheus/conf:/etc/prometheus
  11. #      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
  12.       - ./alertmanager/alert_rules.yml:/alertmanager/alert_rules.yml
  13.     command:
  14.      - '--config.file=/etc/prometheus/prometheus.yml'
  15.       - '--storage.tsdb.path=/prometheus'
  16.  
  17.   alertmanager:
  18.     image: prom/alertmanager:latest
  19.     container_name: alertmanager
  20.     ports:
  21.      - 9093:9093
  22.     volumes:
  23.      - ./alertmanager/:/etc/alertmanager/
  24.     command:
  25.      - '--config.file=/etc/alertmanager/alertmanager.yml'
  26.       - '--storage.path=/alertmanager'
  27. "
  28. prometheus.yml: Всего пару таргетов. Алертменеджер и блекбокс для теста.
  29. "
  30. global:
  31.   scrape_interval: 15s
  32.   scrape_timeout: 10s
  33.   evaluation_interval: 15s
  34. alerting:
  35.   alertmanagers:
  36.   - static_configs:
  37.     - targets:
  38.      - 10.10.5.187:9093
  39.     scheme: http
  40.     timeout: 10s
  41.     api_version: v1
  42. rule_files:
  43.  - "/alertmanager/alert_rules.yml:/alertmanager/alert_rules.yml"
  44. scrape_configs:
  45.   - job_name: 'blackbox'
  46.     metrics_path: /probe
  47.     params:
  48.       module: [http_2xx]
  49.     static_configs:
  50.       - targets:
  51.        - "google.com"
  52.     relabel_configs:
  53.       - source_labels: [address]
  54.         target_label: param_target
  55.       - source_labels: [__param_target]
  56.         target_label: instance
  57.       - target_label: __address
  58.         replacement: localhost:9115
  59. "
  60. alert.rules: Тут стандартное правило которое я использовал.
  61. "
  62. groups:
  63. - name: example
  64.   rules:
  65.   # Alert for any instance that is unreachable for >1 minutes.
  66.   - alert: InstanceDown
  67.     expr: up == 0
  68.     for: 1m
  69. "
  70. alertmanager.yml: Тут описываю адреса, куда слать письма.
  71. "
  72. route:
  73.   group_by: [Alertname]
  74.   # Send all notifications to me.
  75.   receiver: email-me
  76.  
  77. receivers:
  78. - name: email-me
  79.   email_configs:
  80.   - to: anyemail.com
  81.     from: [email protected]
  82.     smarthost: smtp.gmail.com:587
  83.     auth_username: "[email protected]"
  84.     auth_identity: "[email protected]"
  85.     auth_password: "password"
  86. "
Add Comment
Please, Sign In to add comment