feat(etna): replace prometheus with victoriametrics

This commit is contained in:
uku 2024-07-29 22:55:37 +02:00
parent b8d7062228
commit 4c9b7ac9e2
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
2 changed files with 35 additions and 29 deletions

View file

@ -21,5 +21,11 @@
X11Forwarding = false; X11Forwarding = false;
}; };
}; };
prometheus.exporters.node = {
enable = true;
port = 9091;
enabledCollectors = ["systemd"];
};
}; };
} }

View file

@ -1,4 +1,7 @@
{ {config, ...}: let
vmcfg = config.services.victoriametrics;
pmcfg = config.services.prometheus;
in {
cfTunnels."grafana.uku3lig.net" = "http://localhost:2432"; cfTunnels."grafana.uku3lig.net" = "http://localhost:2432";
services.grafana = { services.grafana = {
@ -11,37 +14,34 @@
}; };
}; };
services.prometheus = { services.victoriametrics = {
enable = true; enable = true;
port = 9090; listenAddress = "127.0.0.1:9090";
retentionPeriod = 5 * 12; # 5 years !!!!
};
globalConfig.scrape_interval = "15s"; services.vmagent = {
exporters = {
node = {
enable = true; enable = true;
port = 9091; remoteWrite.url = "http://${vmcfg.listenAddress}/api/v1/write";
enabledCollectors = ["systemd"]; prometheusConfig = {
}; global.scrape_interval = "15s";
};
scrapeConfigs = [ scrape_configs = [
{ {
job_name = "scrape-node"; job_name = "node";
static_configs = [ static_configs = [{targets = ["localhost:${builtins.toString pmcfg.exporters.node.port}"];}];
{
targets = ["localhost:9091"];
}
];
} }
{ {
job_name = "scrape-api-rs"; job_name = "victoriametrics";
static_configs = [ static_configs = [{targets = ["${builtins.toString vmcfg.listenAddress}"];}];
{
targets = ["localhost:5001"];
} }
];
{
job_name = "api-rs";
static_configs = [{targets = ["localhost:5001"];}];
} }
]; ];
}; };
};
} }