Prometheus 从 Windows 抓取 - 无效的指标名称/"INVALID" 不是有效的开始令牌
Prometheus scrape from Windows - invalid metric name/"INVALID" is not a valid start token
我已经在我的 linux 节点上安装了 prometheus。我在 Windows 服务器上有一个 go 应用程序,它从应用程序导出指标。 Windows 节点的度量路径位于 /app/metrics。请注意,指标的输出采用 json 格式。
这是我的 prometheus.yml:
scrape_configs:
- job_name: 'prometheus_metrics'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter_metrics'
static_configs:
- targets: ['localhost:9100']
- job_name: 'app-qa-1'
metrics_path: /app/metrics
scheme: http
static_configs:
- targets: ['app-qa-1:1701']
当我查询指标并通过 promtool 时,我得到:
error while linting: text format parsing error in line 1: invalid metric name
在我的目标页面上,Windows 节点出现此错误:
"INVALID" is not a valid start token
这就是我的 Windows 节点的指标:
"api.engine.gateway.50-percentile": 0,
"api.engine.gateway.75-percentile": 0,
"api.engine.gateway.95-percentile": 0,
"api.engine.gateway.99-percentile": 0,
"api.engine.gateway.999-percentile": 0,
"api.engine.gateway.count": 0,
"api.engine.gateway.fifteen-minute": 0,
"api.engine.gateway.five-minute": 0,
应用程序的指标不在 Prometheus 的基于 YAML 中Exposition format。
最好的办法是确定应用程序是否可以配置为导出 Prometheus 指标(也)。
如果没有,您将需要 一个位于您的 Prometheus 服务器和应用程序之间的代理,当被 Prometheus 抓取时,它会调用应用程序的指标端点,并且将结果转换为 Exposition 格式。
据我所知,没有您可以使用的通用转换导出器。但这会很有用。您可以使用端点和转换函数对其进行配置,它会为您完成工作。
或,您需要为该应用编写自己的导出器。但是,如果当前的指标列表足以满足您的需求,那可能需要付出太多努力。
我已经在我的 linux 节点上安装了 prometheus。我在 Windows 服务器上有一个 go 应用程序,它从应用程序导出指标。 Windows 节点的度量路径位于 /app/metrics。请注意,指标的输出采用 json 格式。
这是我的 prometheus.yml:
scrape_configs:
- job_name: 'prometheus_metrics'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter_metrics'
static_configs:
- targets: ['localhost:9100']
- job_name: 'app-qa-1'
metrics_path: /app/metrics
scheme: http
static_configs:
- targets: ['app-qa-1:1701']
当我查询指标并通过 promtool 时,我得到:
error while linting: text format parsing error in line 1: invalid metric name
在我的目标页面上,Windows 节点出现此错误:
"INVALID" is not a valid start token
这就是我的 Windows 节点的指标:
"api.engine.gateway.50-percentile": 0,
"api.engine.gateway.75-percentile": 0,
"api.engine.gateway.95-percentile": 0,
"api.engine.gateway.99-percentile": 0,
"api.engine.gateway.999-percentile": 0,
"api.engine.gateway.count": 0,
"api.engine.gateway.fifteen-minute": 0,
"api.engine.gateway.five-minute": 0,
应用程序的指标不在 Prometheus 的基于 YAML 中Exposition format。
最好的办法是确定应用程序是否可以配置为导出 Prometheus 指标(也)。
如果没有,您将需要 一个位于您的 Prometheus 服务器和应用程序之间的代理,当被 Prometheus 抓取时,它会调用应用程序的指标端点,并且将结果转换为 Exposition 格式。
据我所知,没有您可以使用的通用转换导出器。但这会很有用。您可以使用端点和转换函数对其进行配置,它会为您完成工作。
或,您需要为该应用编写自己的导出器。但是,如果当前的指标列表足以满足您的需求,那可能需要付出太多努力。