- Added comprehensive course structure with 11 modules - Included theoretical content, practical examples, and tasks - Multi-language code examples (Java, Rust, Node.js, Python) - Detailed analysis of architectural approaches and trade-offs - Complete caching strategies documentation - Architecture examples from real-world systems (Twitter, Netflix, Uber) - Structured navigation and learning path - Ready for educational use
77 lines
1.9 KiB
Markdown
77 lines
1.9 KiB
Markdown
# Alerting
|
|
|
|
## Навигация
|
|
- [🏠 Главная страница курса](../../../README.md)
|
|
- [📚 Модуль 5](../README.md)
|
|
|
|
---
|
|
|
|
## Принципы алертинга
|
|
|
|
### 1. Alert Fatigue Prevention
|
|
- Только важные алерты
|
|
- Группировка похожих алертов
|
|
- Эскалация по времени
|
|
|
|
### 2. Alert Classification
|
|
- **Critical** — система недоступна
|
|
- **Warning** — деградация производительности
|
|
- **Info** — информационные уведомления
|
|
|
|
## Правила оповещений Prometheus
|
|
|
|
```yaml
|
|
# alerts.yml
|
|
groups:
|
|
- name: application
|
|
rules:
|
|
- alert: HighErrorRate
|
|
expr: rate(http_requests_total{status=~"5.."}[5m]) / rate(http_requests_total[5m]) > 0.05
|
|
for: 2m
|
|
labels:
|
|
severity: critical
|
|
annotations:
|
|
summary: "High error rate detected"
|
|
description: "Error rate is {{ $value }} for {{ $labels.instance }}"
|
|
|
|
- alert: HighResponseTime
|
|
expr: histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) > 1
|
|
for: 5m
|
|
labels:
|
|
severity: warning
|
|
annotations:
|
|
summary: "High response time"
|
|
description: "95th percentile response time is {{ $value }}s"
|
|
```
|
|
|
|
## Конфигурация Alertmanager
|
|
|
|
```yaml
|
|
# alertmanager.yml
|
|
global:
|
|
smtp_smarthost: 'localhost:587'
|
|
smtp_from: 'alerts@example.com'
|
|
|
|
route:
|
|
group_by: ['alertname']
|
|
group_wait: 10s
|
|
group_interval: 10s
|
|
repeat_interval: 1h
|
|
receiver: 'web.hook'
|
|
|
|
receivers:
|
|
- name: 'web.hook'
|
|
webhook_configs:
|
|
- url: 'http://alert-webhook:5001/alerts'
|
|
|
|
- name: 'email'
|
|
email_configs:
|
|
- to: 'admin@example.com'
|
|
subject: 'Alert: {{ .GroupLabels.alertname }}'
|
|
body: |
|
|
{{ range .Alerts }}
|
|
Alert: {{ .Annotations.summary }}
|
|
Description: {{ .Annotations.description }}
|
|
{{ end }}
|
|
```
|