Skip to content

Commit 603d714

Browse files
committed
examples for __meta_inventor_sd_module
1 parent 0b0ff4e commit 603d714

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,50 @@ scrape_configs:
6464

6565
## Custom discovered labels
6666

67-
* `__meta_inventor_sd_module`: contains element of `modules: []`, useful fo relabeling to add `__param_module`
67+
* `__meta_inventor_sd_module`: contains element of `modules: []`, useful for relabeling to add `__param_module`
68+
69+
Data file with modules for [exporter_exporter](https://github.com/QubitProducts/exporter_exporter) example:
70+
```json
71+
{
72+
"static_config": {
73+
"targets": ["host.local:9999"],
74+
"labels": {
75+
"__inventor_sd_metrics_path": "/proxy",
76+
"__inventor_sd_job": "inventor-exporter-proxy",
77+
"datacenter": "the-dc"
78+
},
79+
"modules": ["node_exporter","ipmi_exporter"],
80+
"target_group": "inventor-default"
81+
}
82+
}
83+
```
6884

85+
Prometheus SD config with
86+
[relabel_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) example
87+
```yaml
88+
scrape_configs:
89+
- job_name: http_sd_mygroup
90+
http_sd_configs:
91+
- url: http://127.0.0.1:9101/group?name=mygroup
92+
# if SD_TOKEN env variable is set
93+
headers:
94+
- "x-sd-token: REDACTED"
95+
relabel_configs:
96+
# discovered label
97+
- source_labels: [ __meta_inventor_sd_module ]
98+
target_label: __param_module
99+
# labels from data file
100+
- source_labels: [ __inventor_sd_metrics_path ]
101+
target_label: __metrics_path__
102+
- source_labels: [ __inventor_sd_job ]
103+
target_label: job
104+
```
105+
106+
This produces scrape jobs with `module` parameter:
107+
```
108+
http://host.local:9999/proxy&module=node_exporter
109+
http://host.local:9999/proxy&module=ipmi_exporter
110+
```
69111
70112
## API Methods
71113

0 commit comments

Comments
 (0)