一.与Alertmanager关联
Prometheus 把产生的告警发送给Alertmanager进行告警处理时,需要在Prometheus 使用的配置文件中添加关联Alertmanager组件的对应配置内容。
先启动Alertmanager进程,由于Prometheus 与Alertmanager在同一主机中,所以没有使用参数--web.external-url=http://0.0.0.0:9093
nohup ./alertmanager --config.file=alertmanager.yml > nohup.out&
1.编辑prometheus.yml文件加入关联Alertmanager组件的访问地址,示例如下:
# my global config global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: - 172.18.148.49:9093
2.添加Alertmanager关联 Prometheus job, 如下所示:
- job_name: 'Alertmanager' static_configs: - targets: ['172.18.148.49:9093']
配置完成后,重新启动Prometheus 服务,访问http://47.107.88.98:9090/targets?search=,此时Alertmanager已经在targets列表中了,并且是UP状态,如下所示:
标签:Alertmanager,global,关联,Prometheus,every,targets From: https://www.cnblogs.com/MrHSR/p/16788764.html