# alertmanager.yml
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 30s
group_interval: 5m
repeat_interval: 3h
receiver: 'sms'
receivers:
- name: 'sms'
webhook_configs:
- url: 'http://xxx'
send_resolved: true
import requests
import json
def send_sms(mobile, content):
url = 'http://106.ihuyi.com/webservice/sms.php?method=Submit'
payload = {
'account':'xxxxxxxx',
'password':'xxxxxxxxxxxx',
'mobile':mobile,
'content':content,
'format':'json',
}
headers = {
"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"
}
response = requests.post(url, headers=headers, data=data)
res = json.loads(response.content.decode())
if res['code'] == 2:
print('短信发送成功')
else:
print('短信发送失败')
* APIID和APIKEY请登录互亿无线管理后台,"验证码通知短信 > 概览”获取。
# prometheus.yml
rule_files:
- 'alert.rules.yml'
alerting:
alertmanagers:
- static_configs:
- targets: ['alertmanager:9093']
# alert.rules.yml
groups:
- name: example
rules:
- alert: HighErrorRate
expr: job:request_error_rate:rate5m > 0.5
for: 5m
labels:
severity: warning
annotations:
summary: 'High error rate detected'
description: 'The error rate is above 0.5'
# prometheus.yml
alerting:
alertmanagers:
- static_configs:
- targets: ['alertmanager:9093']
$ alertmanager
150,000家
企业客户
20年
行业经验
2V1
2对1客户支持