prometheus - 如何在 prometheus 配置文件中指定完整的 URL?
问题描述
我想监控一个使用 apache-tomact 8 部署的应用程序,例如 url 是 hostip:port/login.jsp 但在 prometheus 配置文件中我们只能提到 hostip:port ,我可以在哪里指定额外的登录。 jsp 路径,以便它监视该特定应用程序。
我已经尝试更改 mertic_path ,但遇到了一些无效的有效令牌错误。
配置文件:
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 解析错误,请在路径周围使用引号。
推荐阅读
- spring-boot - 在 Azure 应用洞察中禁用特定的上下文路径
- python - 在 rasa 中运行自定义操作时遇到错误
- sql - 连接字符串测试失败:Outsystems
- angular - 如何在不更改浏览器设置的情况下在 Angular 中显示另存为对话框
- mongodb - mongodb 中的安全数据库
- java - How not to get the colletion in @ManyToMany in hibernate/springboot?
- laravel - I want to calculate the total work_time of DB
- java - Spring Boot 和 Logback 中不同 Classloader 加载的类
- python-3.x - 为什么更新后我的全局变量还是一样
- python - 在 for 循环中使用 if...else 返回一个字符串