配置 Alertmanager
最后更新于:2022-04-02 03:00:31
[TOC]
## 配置 AlertManager
### 修改 prometheus.yml
```
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "192.168.0.229:9093"
```
### 设置 alertmanager.yml
设置 alertmanager 命令的 alertmanager.yml
```
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://192.168.0.229:8010/test.php'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']
```
### 启动 AlertManager
```
./alertmanager
```
### 测试
```
cat /dev/zero>/dev/null
```
查看是否收到webhook
';