On Tuesday, 17 March 2020 03:33:40 UTC, Yagyansh S. Kumar wrote:
>
> And that would mean making 10 different jobs to probe those 10 URLs. Right?
>
>
No: you can set __param_module differently for targets in the same job.
A simple way is to use the file_sd file to add labels to groups of targets
(each group can be a single target):
- labels:
module: mod1
targets:
- foo.example.com
- labels:
module: mod2
targets:
- bar.example.com
#... etc
And a simple relabel config:
relabel_configs:
- source_labels: [module]
target_label: __param_module
(Note: you *could* just set the __param_module label directly in the
targets file. However this is dangerous if you ever probe the same host
with two different blackbox modules; you need some stored distinguishing
label to keep the timeseries separate. In any case, the label giving the
probe module used is useful for history and dashboards)
If the above targets config is still too verbose for you, then you can used
something like this:
- targets:
- foo.example.com;mod1
- bar.example.com;mod2
with some more sophisticated relabeling (untested):
relabel_configs:
# Split "foo;bar" into instance="foo" module="bar"
- source_labels: [__address__]
regex: '(.+);(.+)'
target_label: instance
replacement: '${1}'
- source_labels: [__address__]
regex: '(.+);(.+)'
target_label: module
replacement: '${2}'
# Fallback: bare "foo" becomes instance="foo" module="some_default"
- source_labels: [__address__]
regex: '([^;]+)'
target_label: instance
replacement: '${1}'
- source_labels: [__address__]
regex: '([^;]+)'
target_label: module
replacement: 'icmp'
# copy instance to __param_target and module to __param_module
- source_labels: [instance]
target_label: __param_target
- source_labels: [module]
target_label: __param_module
# send scrape to blackbox_exporter
- target_label: __address__
replacement: 127.0.0.1:9115
HTH, Brian.
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/60e07a4a-6209-4061-98a6-0d202988ac45%40googlegroups.com.