NixOS configuration for HPC cluster https://docs.hpc.informatik.hs-fulda.de/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

53 lines
1.2 KiB

{ 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;
};
};
}