I have a prometheus.yml config file that monitors a cluster of servers. The config file looks something like this:
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
I hate to specify each target in the config file. Is there a way we can write a regex for the targets, something like server-{01..32}.example.com:9000
instead of specifying each server in the list.
I tried different ways to do it, but none worked for me.