gpt4 book ai didi

prometheus - 如何在 prometheus 配置文件中指定完整的 URL?

转载 作者:行者123 更新时间:2023-12-05 03:00:40 27 4
gpt4 key购买 nike

我想监控一个已经用 apache-toact 8 部署的应用程序,例如 url 是 hostip:port/login.jsp 但在 prometheus 配置文件中我们只能提到 hostip:port ,我可以在哪里指定额外的 login.jsp 路径,以便它监视特定的应用程序。

我已经尝试更改 mertic_path ,但遇到了一些无效的有效 token 错误。

配置文件:

global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093

rule_files:
- 'promrules.yml'


scrape_configs:
- job_name: 'prometheus'

# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.

static_configs:
- targets: ['localhost:9090']

- job_name: 'bank'
#metrics_path: /login.jsp
static_configs:
- targets: ['<hostip>:<port>']

最佳答案

使用 metrics_path 的最小示例配置如下所示:

- job_name: my-service
metrics_path: "/custom-metrics-endpoint"
static_configs:
- targets:
- localhost:9090

如果遇到 yaml 解析错误,请在路径两边加上引号。

关于prometheus - 如何在 prometheus 配置文件中指定完整的 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56631623/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com