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