windows - Prometheus 从 Windows 抓取 - 无效的指标名称/“INVALID”不是有效的开始令牌
问题描述
我已经在我的 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 格式。
最好的办法是确定应用程序是否可以配置为(也)导出 Prometheus 指标。
如果没有,您将需要位于Prometheus 服务器和应用程序之间的代理,当 Prometheus 抓取该代理时,该代理会调用应用程序的指标端点并将结果转换为 Exposition 格式。
据我所知,没有可以使用的通用转换导出器。但这会很有用。您将使用端点和转换功能对其进行配置,它会为您完成工作。
或者,您需要为应用程序编写自己的导出器。但是,如果当前的指标列表足以满足您的需求,那可能需要付出太多努力。
推荐阅读
- boost - Boost.Beast 的 websocket::stream::async_read 是否应该返回“短读”错误?
- visual-c++ - 在 MFC 中使用 TaskDialogIndirect 时出现异常
- android - 为什么 Android 存在特定于 Kotlin 的依赖项
- excel - 在 ABAP 中使用密码加密或保护文件
- bash - 通过忽略分隔符前后的空格来拆分逗号分隔的字符串,并将其存储在 shell 脚本中的数组中
- python - 从新窗口、按钮和脚本到主脚本/窗口 python+tkinter 的值
- amazon-web-services - 如何使用 AWS ALB 作为入口控制器将多个服务映射到单个入口?
- javascript - 如何在nodejs中使这个子进程调用同步?
- html - HTML CSS 问题 Get 和 started 之间的空间使 get 在第一行并在第二行开始
- r - 过滤模式上的行和列中的位置