我们已经在Kubernetes集群中使用社区helm图表设置了完整的Prometheus堆栈- Prometheus/Grafana/Alertmanager/Node Explorer/Blackbox exporter。监控堆栈部署在自己的命名空间中,我们的主软件由微服务组成,部署在默认命名空间中。警报运行良好,但是blackbox exporter没有正确地抓取指标(我猜),并定期发出误报警报。我们使用最后一个来探测我们的微服务HTTP活动/就绪端点。
我的配置(在values.yaml中)与这个问题相关,如下所示:
- alert: InstanceDown
expr: up == 0
for: 5m
annotations:
title: 'Instance {{ $labels.instance }} down'
description: '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.'
- alert: ExporterIsDown
expr: up{job="prometheus-blackbox-exporter"} == 0
for: 5m
labels:
severity: warning
annotations:
summary: "Blackbox exporter is down"
description: "Blackbox exporter is down or not being scraped correctly"
...
...
...
extraScrapeConfigs: |
- job_name: 'prometheus-blackbox-exporter'
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- http://service1.default.svc.cluster.local:8082/actuator/health/liveness
- http://service2.default.svc.cluster.local:8081/actuator/health/liveness
- http://service3.default.svc.cluster.local:8080/actuator/health/liveness
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: prometheus-blackbox-exporter:9115这两个警报每小时触发一次,但此时端点是100%可访问的。
我们使用默认的prometheus-blackbox-exporter/values.yaml文件:
config:
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
no_follow_redirects: false
preferred_ip_protocol: "ip4"5] Firing
Labels
alertname = InstanceDown
instance = http://service1.default.svc.cluster.local:8082/actuator/health/liveness
job = prometheus-blackbox-exporter
severity = critical另一种电子邮件类型
Labels
alertname = ExporterIsDown
instance = http://service1.default.svc.cluster.local:8082/actuator/health/liveness
job = prometheus-blackbox-exporter
severity = warning
Annotations
description = Blackbox exporter is down or not being scraped correctly
summary = Blackbox exporter is down我注意到的另一件奇怪的事情是,在Prometheus UI中,我没有看到这里显示的任何probe_*指标,https://lapee79.github.io/en/article/monitoring-http-using-blackbox-exporter/不确定我们做错了什么或遗漏了什么,但收到成百上千的误报电子邮件是非常恼人的。
发布于 2021-04-08 16:52:07
回答我自己的问题。看起来我键入了:
replacement: prometheus-blackbox-exporter:9115但它必须是服务名称:
replacement: stage-prometheus-blackbox-exporter:9115根据文档:
替换: localhost:9115 #黑盒导出器的真实主机名:port。对于Windows和macOS,替换为- host.docker.internal:9115
但是,对于Kubernetes,它应该是blackbox-exporter的服务名称,这并没有很好的文档记录。或者至少我没有在任何地方找到这个。
获取服务的步骤:
kubectl get svc -l app.kubernetes.io/name=prometheus-blackbox-exporterhttps://stackoverflow.com/questions/65840967
复制相似问题