service/node-exporter: seperate from prometheus

This commit is contained in:
Felix Buehler 2023-06-04 18:08:55 +02:00
parent 797261aad1
commit 21c5160a1d
3 changed files with 78 additions and 41 deletions

View file

@ -85,19 +85,6 @@ in
inherit (cfg) retentionTime;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9100;
listenAddress = "127.0.0.1";
};
systemd = {
enable = true;
listenAddress = "127.0.0.1";
};
};
globalConfig = {
scrape_interval = cfg.scrapeInterval;
};
@ -131,27 +118,11 @@ in
};
}];
}
{
job_name = "node";
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
labels = {
instance = config.networking.hostName;
};
}];
}
{
job_name = "systemd";
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.systemd.port}" ];
labels = {
instance = config.networking.hostName;
};
}];
}
];
};
my.services.node-exporter.enable = true;
services.grafana.provision = {
datasources.settings.datasources = [
{
@ -167,21 +138,11 @@ in
}
];
dashboards.settings.providers = [
{
name = "Node Exporter";
options.path = pkgs.grafana-dashboards.node-exporter;
disableDeletion = true;
}
{
name = "Prometheus";
options.path = pkgs.grafana-dashboards.prometheus;
disableDeletion = true;
}
{
name = "Systemd";
options.path = pkgs.grafana-dashboards.node-systemd;
disableDeletion = true;
}
];
};