monitoring - Prometheus:是否可以在配置文件中为 job_name>static_configs>targets 编写正则表达式
问题描述
我有一个监控服务器集群的 prometheus.yml 配置文件。配置文件看起来像这样:
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
scrape_timeout: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: minio
metrics_path: /minio/prometheus/metrics
scheme: http
static_configs:
- targets: [ "server-01.example.com:9000", "server-02.example.com:9000", "server-03.example.com:9000", "server-04.example.com:9000" ]
# Upto 32 such servers in the cluster server-{01..32}.example.com:9000
我讨厌在配置文件中指定每个目标。有没有办法可以为目标编写正则表达式,server-{01..32}.example.com:9000
而不是指定列表中的每个服务器。我尝试了不同的方法来做到这一点,但没有一个对我有用。
解决方案
推荐阅读
- html - CSS对齐按钮
- wpf - WPF Powershell 应用程序在 Invoke-PowerBIRestMethod 上挂起
- python - 当我编写代码 db.Column(db.String(15), nullable=False) 时,Pycharm 正在为 Column(flask_sqlalchemy) 创建问题
- java - 用于在线游戏的 Java 机器人
- php - fire base sdk for php 显示 new Factory() 错误
- r - R Markdown - 不要在 HTML 输出中显示文本
- nginx - NGINX SSI LAST_MODIFIED 不起作用但应该?
- node.js - 从谷歌存储桶中读取多个文件并使用 nodejs 加载到 BQ
- laravel - Yajra 数据表卡在 VPS 的处理上
- python - 在 python 中创建一个将数组名称作为参数的函数。我收到错误“未解决的引用”,然后是我尝试传递的参数