【问题标题】:"no token found" when scraping from Promethues从 Prometheus 抓取时“找不到令牌”
【发布时间】:2017-12-15 16:56:17
【问题描述】:

我正在使用 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 会说:

【问题讨论】:

    标签: kubernetes prometheus


    【解决方案1】:

    {"状态":"UP"}

    Prometheus 要求数据为其格式,不能处理其他任意数据。你得到的错误是一个解析错误。

    您应该使用 client library 检测您的代码,并让它以 Prometheus 文本格式公开数据。

    【讨论】:

      猜你喜欢
      • 2018-10-31
      • 1970-01-01
      • 2021-01-17
      • 1970-01-01
      • 2018-12-15
      • 2022-11-12
      • 2015-07-20
      • 1970-01-01
      • 2012-01-09
      相关资源
      最近更新 更多