2023-06-03 01:33:51 +03:00
|
|
|
{ config, lib, ... }:
|
2022-08-04 00:36:11 +03:00
|
|
|
|
2023-05-10 00:13:30 +03:00
|
|
|
let
|
|
|
|
nodeFor = nodeType: builtins.head config.services.monitoring.nodes.${nodeType};
|
|
|
|
|
|
|
|
meshIpFor = nodeType: config.vars.mesh.${nodeFor nodeType}.meshIp;
|
2023-06-03 01:33:51 +03:00
|
|
|
|
|
|
|
meshIpForNode = name: config.vars.mesh.${name}.meshIp;
|
2023-05-10 00:13:30 +03:00
|
|
|
in
|
|
|
|
|
2022-08-04 00:36:11 +03:00
|
|
|
{
|
2023-06-05 00:06:53 +03:00
|
|
|
imports = [
|
|
|
|
./options.nix
|
|
|
|
];
|
|
|
|
|
2022-08-04 00:36:11 +03:00
|
|
|
links = {
|
2023-05-26 17:26:24 +03:00
|
|
|
prometheus-ingest = {
|
|
|
|
protocol = "http";
|
|
|
|
ipv4 = meshIpFor "server";
|
|
|
|
};
|
2022-08-04 00:36:11 +03:00
|
|
|
};
|
2023-06-03 01:33:51 +03:00
|
|
|
hostLinks = lib.genAttrs config.services.monitoring.nodes.grafana (name: {
|
|
|
|
grafana = {
|
|
|
|
protocol = "http";
|
|
|
|
ipv4 = meshIpForNode name;
|
|
|
|
};
|
|
|
|
});
|
2022-08-04 00:36:11 +03:00
|
|
|
services.monitoring = {
|
|
|
|
nodes = {
|
2023-11-04 02:24:34 +02:00
|
|
|
client = [ "checkmate" "grail" "thunderskin" "VEGAS" "prophet" ];
|
2023-11-05 01:12:19 +02:00
|
|
|
blackbox = [ "checkmate" "grail" "prophet" ];
|
2023-06-03 01:33:51 +03:00
|
|
|
grafana = [ "VEGAS" "prophet" ];
|
2024-08-03 01:56:13 +03:00
|
|
|
logging = [ "VEGAS" "grail" ];
|
2024-08-23 03:50:18 +03:00
|
|
|
tracing = [ "VEGAS" "grail" ];
|
2023-05-10 00:13:30 +03:00
|
|
|
server = [ "VEGAS" ];
|
2022-08-04 00:36:11 +03:00
|
|
|
};
|
|
|
|
nixos = {
|
|
|
|
client = ./client.nix;
|
2023-05-27 14:44:31 +03:00
|
|
|
blackbox = ./blackbox.nix;
|
2024-07-08 23:00:00 +03:00
|
|
|
grafana = [
|
|
|
|
./grafana-ha.nix
|
|
|
|
./provisioning/dashboards.nix
|
|
|
|
];
|
2023-05-10 00:13:30 +03:00
|
|
|
logging = ./logging.nix;
|
2024-08-23 03:50:18 +03:00
|
|
|
tracing = ./tracing.nix;
|
2023-05-10 00:13:30 +03:00
|
|
|
server = [
|
|
|
|
./server.nix
|
|
|
|
];
|
2022-08-04 00:36:11 +03:00
|
|
|
};
|
2024-08-23 03:50:18 +03:00
|
|
|
meshLinks = {
|
|
|
|
logging.loki.link.protocol = "http";
|
|
|
|
tracing = {
|
|
|
|
tempo.link.protocol = "http";
|
|
|
|
tempo-otlp-http.link.protocol = "http";
|
|
|
|
tempo-otlp-grpc.link.protocol = "grpc";
|
|
|
|
tempo-zipkin-http.link.protocol = "http";
|
|
|
|
};
|
|
|
|
};
|
2022-08-04 00:36:11 +03:00
|
|
|
};
|
2023-11-03 00:15:09 +02:00
|
|
|
|
2024-08-03 03:33:20 +03:00
|
|
|
garage = config.lib.forService "monitoring" {
|
2023-11-06 21:53:06 +02:00
|
|
|
keys = {
|
2024-08-03 01:37:06 +03:00
|
|
|
loki-ingest.locksmith = {
|
|
|
|
nodes = config.services.monitoring.nodes.logging;
|
|
|
|
format = "envFile";
|
|
|
|
};
|
|
|
|
loki-query.locksmith = {
|
|
|
|
nodes = config.services.monitoring.nodes.logging;
|
|
|
|
format = "envFile";
|
|
|
|
};
|
2024-08-23 03:50:18 +03:00
|
|
|
tempo-ingest.locksmith = {
|
|
|
|
nodes = config.services.monitoring.nodes.tracing;
|
|
|
|
format = "envFile";
|
|
|
|
};
|
|
|
|
tempo-query.locksmith = {
|
|
|
|
nodes = config.services.monitoring.nodes.tracing;
|
|
|
|
format = "envFile";
|
|
|
|
};
|
2023-11-06 21:53:06 +02:00
|
|
|
};
|
|
|
|
buckets = {
|
2024-08-03 01:37:06 +03:00
|
|
|
loki-chunks.allow = {
|
|
|
|
loki-ingest = [ "read" "write" ];
|
|
|
|
loki-query = [ "read" ];
|
|
|
|
};
|
2024-08-23 03:50:18 +03:00
|
|
|
tempo-chunks.allow = {
|
|
|
|
tempo-ingest = [ "read" "write" ];
|
|
|
|
tempo-query = [ "read" ];
|
|
|
|
};
|
2023-11-06 21:53:06 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-23 03:50:18 +03:00
|
|
|
ways = let
|
|
|
|
query = consulService: {
|
|
|
|
inherit consulService;
|
2024-08-23 01:32:44 +03:00
|
|
|
internal = true;
|
|
|
|
extras.extraConfig = ''
|
|
|
|
proxy_read_timeout 3600s;
|
|
|
|
'';
|
|
|
|
};
|
2024-08-23 03:50:18 +03:00
|
|
|
ingest = consulService: {
|
|
|
|
inherit consulService;
|
2024-08-03 01:12:15 +03:00
|
|
|
internal = true;
|
|
|
|
extras.extraConfig = ''
|
|
|
|
client_max_body_size 4G;
|
|
|
|
proxy_read_timeout 3600s;
|
|
|
|
'';
|
|
|
|
};
|
2024-08-23 03:50:18 +03:00
|
|
|
in config.lib.forService "monitoring" {
|
|
|
|
monitoring = {
|
|
|
|
consulService = "grafana";
|
|
|
|
extras.locations."/".proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
monitoring-logs = query "loki";
|
|
|
|
monitoring-traces = query "tempo";
|
|
|
|
ingest-logs = ingest "loki";
|
|
|
|
ingest-traces-otlp = ingest "tempo-ingest-otlp-grpc" // { grpc = true; };
|
2024-07-04 18:31:59 +03:00
|
|
|
};
|
2022-08-04 00:36:11 +03:00
|
|
|
}
|