feat: add prometheus

This commit is contained in:
Ivan R. 2024-03-04 20:34:12 +05:00
parent 2e511cc4de
commit 8215ffde8a
No known key found for this signature in database
GPG key ID: 56C7BAAE859B302C
3 changed files with 26 additions and 2 deletions

View file

@ -28,6 +28,7 @@
./programs/yggdrasil.nix ./programs/yggdrasil.nix
./programs/grafana.nix ./programs/grafana.nix
./programs/prometheus.nix
]; ];
nix = { nix = {

View file

@ -16,11 +16,11 @@
}; };
}; };
services.nginx.virtualHosts."grafana.comfycamp.space" = { services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = {
useACMEHost = "comfycamp.space"; useACMEHost = "comfycamp.space";
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:55010"; proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };

View file

@ -0,0 +1,23 @@
{ config, ... }: {
services.prometheus = {
enable = true;
port = 55011;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 55012;
};
};
scrapeConfigs = [
{
job_name = "node";
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
];
};
}