grafana: registered Mimir datasource

This commit is contained in:
Tigor Hutasuhut 2024-09-07 10:41:59 +07:00
parent dda26cfc65
commit 49542ac462
2 changed files with 33 additions and 2 deletions

View file

@ -57,6 +57,7 @@ in
let
lokiConfig = config.services.loki.configuration;
tempoServer = config.services.tempo.settings.server;
mimirServer = config.services.mimir.configuration.server;
in
/*hcl*/ ''
otelcol.receiver.otlp "homeserver" {
@ -69,7 +70,7 @@ in
}
output {
// metrics = [otelcol.processor.batch.default.input]
metrics = [otelcol.processor.batch.default.input]
logs = [otelcol.processor.batch.default.input]
traces = [otelcol.processor.batch.default.input]
}
@ -77,7 +78,7 @@ in
otelcol.processor.batch "default" {
output {
// metrics = [otelcol.exporter.loki.default.input]
metrics = [otelcol.exporter.prometheus.mimir.input]
logs = [otelcol.exporter.loki.default.input]
traces = [otelcol.exporter.otlp.tempo.input]
}
@ -87,6 +88,10 @@ in
forward_to = [loki.write.default.receiver]
}
otelcol.exporter.prometheus "mimir" {
forward_to = [prometheus.remote_write.mimir.receiver]
}
loki.write "default" {
endpoint {
url = "http://${lokiConfig.server.http_listen_address}:${toString lokiConfig.server.http_listen_port}"
@ -98,6 +103,12 @@ in
endpoint = "${tempoServer.http_listen_address}:${toString tempoServer.http_listen_port}"
}
}
prometheus.remote_write "mimir" {
endpoint {
url = "http://${mimirServer.http_listen_address}:${toString mimirServer.http_listen_port}"
}
}
'';
};
}

View file

@ -96,5 +96,25 @@ in
store_gateway.sharding_ring.replication_factor = 1;
};
};
services.grafana.provision.datasources.settings.datasources =
let
server = config.services.mimir.configuration.server;
in
[
{
name = "Mimir";
type = "prometheus";
uid = "mimir";
access = "proxy";
url = "http://${server.http_listen_address}:${toString server.http_listen_port}";
basicAuth = false;
jsonData = {
httpMethod = "POST";
prometheusType = "Mimir";
timeout = 30;
};
}
];
};
}