From 21a46a66bb654b4e3aca21115eae868f9e0a7838 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Wed, 6 Nov 2019 04:56:41 -0800 Subject: [PATCH] monitoring: Set instance to friendly name for each node we're monitoring So that you get eg. "charm" instead of "IP:PORT" --- monitoring/prometheus.jsonnet | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/monitoring/prometheus.jsonnet b/monitoring/prometheus.jsonnet index 3c58d9d..bc2f274 100644 --- a/monitoring/prometheus.jsonnet +++ b/monitoring/prometheus.jsonnet @@ -1,5 +1,6 @@ -local hosts = [ -]; +local hosts = { + // name: "host:port" +}; local services = [ "restreamer", "downloader", @@ -16,14 +17,22 @@ local services = [ scrape_interval: "15s", }, scrape_configs: [ - {job_name: "prometheus", static_configs: [{targets: ["localhost:9090"]}]}, + { + job_name: "prometheus", + static_configs: [ + {targets: ["localhost:9090"], labels: {instance: "prometheus"}} + ], + }, ] + [ { job_name: service, metrics_path: "/metrics/%s" % service, - static_configs: [{ - targets: hosts, - }], + static_configs: [ + { + targets: [hosts[host]], + labels: {instance: host}, + } for host in std.objectFields(hosts) + ], } for service in services ],