Browse Source

Basic monitoring

main
Dustin Frisch 1 year ago
parent
commit
227c0c4a88
No known key found for this signature in database GPG Key ID: B4C3BF012D9B26BE
  1. 1
      machines/manager/default.nix
  2. 16
      machines/manager/docs.nix
  3. 53
      machines/manager/monitoring.nix
  4. 5
      shared/default.nix

1
machines/manager/default.nix

@ -22,6 +22,7 @@ with lib;
./mpi.nix ./mpi.nix
./slurm.nix ./slurm.nix
./docs.nix ./docs.nix
./monitoring.nix
]; ];
deployment = { deployment = {

16
machines/manager/docs.nix

@ -7,17 +7,13 @@ with lib;
../../docs/module.nix ../../docs/module.nix
]; ];
services.nginx = {
virtualHosts = {
"${config.networking.domain}" = {
default = true;
services.nginx.virtualHosts."${config.networking.domain}" = {
default = true;
serverAliases = [
"doku.${config.networking.domain}"
];
serverAliases = [
"doku.${config.networking.domain}"
];
locations."/".root = config.system.build.docs;
};
};
locations."/".root = config.system.build.docs;
}; };
} }

53
machines/manager/monitoring.nix

@ -0,0 +1,53 @@
{ pkgs, lib, config, nodes, ... }:
with lib;
{
services.grafana = {
enable = true;
settings.server = {
addr = "127.0.0.1";
inherit (config.networking) domain;
root_url = "%(protocol)s://%(domain)s:%(http_port)s/grafana/";
serve_from_sub_path = true;
};
# provision = {
# enable = true;
# datasources.path = ./grafana/datasources.yaml
# };
};
services.prometheus = {
enable = true;
webExternalUrl = "http://${config.networking.domain}/prometheus";
scrapeConfigs = mapAttrsToList
(name: node: {
job_name = name;
static_configs = [
{
targets = [
"${name}:${toString node.config.services.prometheus.exporters.node.port}"
];
}
];
})
nodes;
};
services.nginx.virtualHosts.${config.networking.domain} = {
locations."/grafana" = {
proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}";
proxyWebsockets = true;
};
locations."/prometheus" = {
proxyPass = "http://127.0.0.1:${toString config.services.prometheus.port}";
proxyWebsockets = true;
};
};
}

5
shared/default.nix

@ -53,5 +53,10 @@
services.haveged.enable = true; services.haveged.enable = true;
services.prometheus.exporters = {
node.enable = true;
ipmi.enable = true;
};
system.stateVersion = "22.11"; system.stateVersion = "22.11";
} }
Loading…
Cancel
Save