-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.yaml
More file actions
95 lines (87 loc) · 3.93 KB
/
sample.yaml
File metadata and controls
95 lines (87 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#================================================================#
# Healthy-API God-Mode Configuration Example #
#================================================================#
services:
# Service 1: Critical API with complex nested conditions
- name: "Production Gateway"
url: "https://api.my-company.com/health"
condition_id: "complex-nested-check"
check_period: 30
sleep_on_fail: 60
threshold: 3
notify_on_recovery: true
targets:
- notifier_id: "slack-alerts"
recipients: ["https://hooks.slack.com/services/T000/B000/XXXX"]
- notifier_id: "on-call-sms"
recipients: ["+1234567890"]
# Service 2: A simple website check with custom user agent
- name: "Main Website"
url: "https://www.my-company.com"
condition_id: "fast-200-ok"
check_period: 60
user_agent: "HealthyAPI-Monitor/2.0"
targets:
- notifier_id: "team-email"
recipients: ["dev-team@my-company.com"]
#================================================================#
# Notification Channel Configuration #
#================================================================#
notifiers:
# ------ Webhooks (Slack/Discord/Custom) ------
webhook:
- id: "slack-alerts"
method: POST
headers:
Content-Type: "application/json"
json:
# Generic fallback
text: "⚠️ Alert for {{.Metadata.ServiceName}}"
templates:
network_error: '{"text": "🔌 *Network Alert* {{.Metadata.ServiceName}}\n- Time: {{.Metadata.Timestamp}}\n{{.Metadata.Reason}}"}'
http_error: '{"text": "❌ *HTTP Alert* {{.Metadata.ServiceName}}\n- Time: {{.Metadata.Timestamp}}\n{{.Metadata.Reason}}"}'
slow_response: '{"text": "⏱️ *Latency Alert* {{.Metadata.ServiceName}}\n- Time: {{.Metadata.Timestamp}}\n{{.Metadata.Reason}}"}'
condition_failed: '{"text": "🔍 *Validation Alert* {{.Metadata.ServiceName}}\n- Time: {{.Metadata.Timestamp}}\n{{.Metadata.Reason}}"}'
recovery: '{"text": "✅ *Recovery* {{.Metadata.ServiceName}}\n- Time: {{.Metadata.Timestamp}}\n- Status: Service is now Healthy"}'
default: '{"text": "🔔 *Status Update* {{.Metadata.ServiceName}}\n- Time: {{.Metadata.Timestamp}}\n- Status: {{.Metadata.Status}}"}'
# ------ Email (SMTP) ------
smtp:
- id: "team-email"
sender: "monitoring@my-company.com"
password: "secret-password"
server: "smtp.gmail.com"
port: "587"
templates:
recovery: "Subject: ✅ Recovery {{.Metadata.ServiceName}}\n\n- Time: {{.Metadata.Timestamp}}\n- Status: Service is now Healthy"
default: "Subject: 🚨 Alert: {{.Metadata.ServiceName}}\n\n- Time: {{.Metadata.Timestamp}}\n{{.Metadata.Reason}}"
# ------ SMS (MeliPayamak) ------
meli_payamak_panel:
- id: "sms-admin"
username: "myuser"
password: "mypassword"
sender: "50001234"
templates:
recovery: "✅ Recovery: {{.Metadata.ServiceName}}\nTime: {{.Metadata.Timestamp}}\nStatus: Healthy"
default: "⚠️ Alert: {{.Metadata.ServiceName}}\nTime: {{.Metadata.Timestamp}}\n{{.Metadata.Reason}}"
#================================================================#
# Health Check Conditions #
#================================================================#
conditions:
# Simple 200 OK + Fast response
- id: "fast-200-ok"
condition:
and:
- status_code: { code: 200 }
- response_time: { max_duration: "1s" }
# Complex AND inside OR (Highly Extensible)
- id: "complex-nested-check"
condition:
or:
# Path A: Normal Operational State
- and:
- status_code: { code: 200 }
- regex: { pattern: '"status": ?"UP"' }
# Path B: Maintenance Mode (Also considered Healthy if configured so)
- and:
- status_code: { code: 503 }
- regex: { pattern: "MAINTENANCE_ACTIVE" }