【发布时间】:2020-02-01 06:27:38
【问题描述】:
我在 Kubernetes 中运行 Prometheus 并遇到一些 kube 状态指标连接错误。尝试检查日志,但无法在日志中看到连接失败。是否可以启用 Prometheus 的详细日志记录?
【问题讨论】:
-
你的问题不清楚。 “指标连接错误”是什么意思?普罗米修斯不能刮到目标?如果是这样,您将获得的不仅仅是目标的状态页面。
标签: prometheus
我在 Kubernetes 中运行 Prometheus 并遇到一些 kube 状态指标连接错误。尝试检查日志,但无法在日志中看到连接失败。是否可以启用 Prometheus 的详细日志记录?
【问题讨论】:
标签: prometheus
只需在 prometheus 的启动命令中添加 --log.level=debug 即可。像这样的:
spec:
template:
spec:
containers:
- args:
- --log.level=debug
【讨论】:
如果您使用的是 docker-compose,此配置将启用 prometheus 中的调试日志记录:
services:
prom:
image: prom/prometheus:latest
command: --config.file=/etc/prometheus/prometheus.yml --log.level=debug
volumes:
- /mypath/prometheus.yml:/etc/prometheus/prometheus.yml
然后您可以检查日志
docker-compose logs -f prom
【讨论】: