Skip to content

Commit 9899c78

Browse files
committed
updated README.md, and relabel_configs to let grafana graph be smoth
1 parent b4d62c1 commit 9899c78

4 files changed

Lines changed: 21 additions & 6 deletions

File tree

basic-prometheus-file_sd_config-cluster/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,3 @@ written to stdout
176176

177177
### Author
178178
[Serguei Kouzmine](kouzmine_serguei@yahoo.com)
179-

basic-prometheus-file_sd_config-cluster/prometheus/prometheus.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,30 @@ scrape_configs:
88
- files:
99
- /etc/prometheus/dynamic_targets.json
1010
refresh_interval: 15s
11+
1112
relabel_configs:
13+
# Forward the target URL (with ts) as a param to json_exporter
14+
- source_labels: [__meta_filepath]
15+
target_label: source_file
16+
1217
- source_labels: [target]
1318
target_label: __param_target
14-
- source_labels: [module]
15-
target_label: __param_module
16-
- target_label: __address__
17-
replacement: exporter:7979
19+
20+
# Keep the actual scrape address
21+
- source_labels: [__address__]
22+
target_label: __address__
23+
24+
# Strip `?ts=...` from the "instance" label to stabilize the time series identity
1825
- source_labels: [target]
26+
regex: (http://[^?]+)\?ts=.*$
1927
target_label: instance
20-
28+
replacement: $1
29+
action: replace
30+
31+
# Same for the "target" label (optional if you graph on this)
32+
- source_labels: [target]
33+
regex: (http://[^?]+)\?ts=.*$
34+
target_label: target
35+
replacement: $1
36+
action: replace
2137

-24.3 KB
Loading
44.6 KB
Loading

0 commit comments

Comments
 (0)