"no token found" 从普罗米修斯抓取时
"no token found" when scraping from Promethues
我正在使用 Promethues 监控我的 Kubernetes 集群。我的所有微服务都可以使用我的 HA 代理访问。
我的基本 Promethues 配置是:
- job_name: 'kubernetes_pods'
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- api_server: http://172.29.219.102:8080
role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_host_ip]
target_label: __address__
regex: (.*)
replacement: 172.29.219.110:8080
其中 172.29.219.110:8080
是我的独立 HA 代理的 IP 和端口。
我尝试使用 Prometheus 监控的端点是 /auth/health
。
当我从任何地方执行简单的 curl 命令时,我看到:
# curl http://172.29.219.110:8080/auth/health
{"status":"UP"}
但是当 Prometheus 尝试这样做时,日志显示:
level=warn ts=2017-12-15T16:40:48.301741927Z caller=scrape.go:673 component="target manager" scrape_pool=kubernetes_pods target=http://172.29.219.110:8080/auth/health msg="append failed" err="no token found"
这个端点是公开的,不需要任何身份验证。那么为什么 Promethues 会说:
{"status":"UP"}
Prometheus 要求数据符合其格式,不能处理其他任意数据。您收到的错误是一个解析错误。
您应该使用 client library 检测您的代码,并让它以 Prometheus 文本格式公开数据。
我正在使用 Promethues 监控我的 Kubernetes 集群。我的所有微服务都可以使用我的 HA 代理访问。
我的基本 Promethues 配置是:
- job_name: 'kubernetes_pods'
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- api_server: http://172.29.219.102:8080
role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_host_ip]
target_label: __address__
regex: (.*)
replacement: 172.29.219.110:8080
其中 172.29.219.110:8080
是我的独立 HA 代理的 IP 和端口。
我尝试使用 Prometheus 监控的端点是 /auth/health
。
当我从任何地方执行简单的 curl 命令时,我看到:
# curl http://172.29.219.110:8080/auth/health
{"status":"UP"}
但是当 Prometheus 尝试这样做时,日志显示:
level=warn ts=2017-12-15T16:40:48.301741927Z caller=scrape.go:673 component="target manager" scrape_pool=kubernetes_pods target=http://172.29.219.110:8080/auth/health msg="append failed" err="no token found"
这个端点是公开的,不需要任何身份验证。那么为什么 Promethues 会说:
{"status":"UP"}
Prometheus 要求数据符合其格式,不能处理其他任意数据。您收到的错误是一个解析错误。
您应该使用 client library 检测您的代码,并让它以 Prometheus 文本格式公开数据。