From db03c54c0da8c8d6553f6317417293ad9a6d6451 Mon Sep 17 00:00:00 2001 From: Max Rydahl Andersen Date: Mon, 15 Oct 2018 00:44:06 +0200 Subject: [PATCH] add relabeling for better naming/context --- prometheus/pinghosts.yaml | 14 +++++++------- prometheus/prometheus.yml | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/prometheus/pinghosts.yaml b/prometheus/pinghosts.yaml index fc9e121..0a9b837 100644 --- a/prometheus/pinghosts.yaml +++ b/prometheus/pinghosts.yaml @@ -1,8 +1,8 @@ -- targets: - - http://google.com - - http://github.com - - https://blackdata.xam.dk:5001 - - http://192.168.1.1 - - http://192.168.1.42 - - http://192.168.1.101 +- targets: # url;humanname;routing;switch + - http://google.com;google.com;external;internetbox + - http://github.com;github.com;external;internetbox + - https://blackdata.xam.dk:5001;blackdata.xam.dk;external;internetbox + - http://192.168.1.1;internetbox;local;internetbox + - http://192.168.1.42;blackdata;local;orbirouter-attic + - http://192.168.1.101;orbirouter;local;orbirouter diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index 98f81a8..43a94bd 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -46,9 +46,23 @@ scrape_configs: - pinghosts.yaml relabel_configs: - source_labels: [__address__] - target_label: __param_target - - source_labels: [__param_target] + regex: '(.*);(.*);(.*);(.*)' #first is the url, thus unique for instance target_label: instance + replacement: $1 + - source_labels: [__address__] + regex: '(.*);(.*);(.*);(.*)' #second is humanname to use in charts + target_label: humanname + replacement: $2 + - source_labels: [__address__] + regex: '(.*);(.*);(.*);(.*)' #third state whether this is testing external or internal network + target_label: routing + replacement: $3 + - source_labels: [__address__] + regex: '(.*);(.*);(.*);(.*)' #fourth is which switch/router the device is connected to. + target_label: switching + replacement: $4 + - source_labels: [instance] + target_label: __param_target - target_label: __address__ replacement: ping:9115 # The blackbox exporter's real hostname:port.