prometheus config: Support mixed http and https scraping

pull/157/head
Mike Lang 5 years ago
parent 94d81d708f
commit 8a65d18f74

@ -1,7 +1,11 @@
local hosts = { local hosts_by_scheme = {
// name: ["host:port", role] http: {
// See overview.jsonnet for role explanations. // name: ["host:port", role]
mynode: ["localhost:8080", "replica"] // See overview.jsonnet for role explanations.
mynode: ["localhost:8080", "replica"]
},
https: {
},
}; };
local services = [ local services = [
"restreamer", "restreamer",
@ -22,23 +26,28 @@ local services = [
{ {
job_name: "prometheus", job_name: "prometheus",
static_configs: [ static_configs: [
{targets: ["localhost:9090"], labels: {instance: "prometheus"}} {targets: ["localhost:9090"], labels: {instance: "prometheus", service: "prometheus"}},
], ],
}, },
] + [ ] + std.flattenArrays([
{ [
job_name: service, {
metrics_path: "/metrics/%s" % service, local hosts = hosts_by_scheme[scheme],
static_configs: [ job_name: "%s-%s" % [scheme, service],
{ metrics_path: "/metrics/%s" % service,
targets: [hosts[host][0]], scheme: scheme,
labels: { static_configs: [
instance: host, {
role: hosts[host][1], targets: [hosts[host][0]],
}, labels: {
} for host in std.objectFields(hosts) instance: host,
], role: hosts[host][1],
} },
for service in services } for host in std.objectFields(hosts)
], ],
}
for service in services
]
for scheme in std.objectFields(hosts_by_scheme)
]),
} }

Loading…
Cancel
Save