grafana模板号:13659。下载地址 https://grafana.com/grafana/dashboards/13659-blackbox-exporter-http-prober/
安装插件,重启grafana生效。
grafana-cli plugins install grafana-piechart-panel
ruler
- alert: curlHttpStatus
expr: probe_http_status_code{job="blackbox-http"}>=400 and probe_success{job="blackbox-http"}==0
for: 2m
labels:
docker: number
annotations:
summary: '业务报警: 链接不可访问'
description: '{{$labels.instance}} 不可访问,请及时查看,当前状态码为{{$value}}'
alert
# global:
# # 每2分钟检查一次是否恢复
# resolve_timeout: 2m
# # 自定义通知模板
# templates:
# - '/etc/alertmanager/template/wechat.tmpl'
# # route用来设置报警的分发策略
# route:
# # 采用哪个标签来作为分组依据
# group_by: ['alertname']
# # 组告警等待时间。也就是告警产生后等待10s,如果有同组告警一起发出
# group_wait: 30s
# # 两组告警的间隔时间
# group_interval: 40s
# # 重复告警的间隔时间,减少相同微信告警的发送频率
# repeat_interval: 5m
# # 设置默认接收人
# receiver: 'wechat'
# receivers:
# - name: 'wechat'
# wechat_configs:
# - corp_id: 'xxx' #企业微信中 企业id
# to_party: '2' #企业微信中的接受告警 部门id
# agent_id: '1000002' #企业微信中 应用agent id
# api_secret: 'xxx' #企业微信中应用的 secret