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

11 months ago
  1. { pkgs, lib, config, nodes, ... }:
  2. with lib;
  3. {
  4. services.grafana = {
  5. enable = true;
  6. settings.server = {
  7. addr = "127.0.0.1";
  8. inherit (config.networking) domain;
  9. root_url = "%(protocol)s://%(domain)s:%(http_port)s/grafana/";
  10. serve_from_sub_path = true;
  11. };
  12. # provision = {
  13. # enable = true;
  14. # datasources.path = ./grafana/datasources.yaml
  15. # };
  16. };
  17. services.prometheus = {
  18. enable = true;
  19. webExternalUrl = "http://${config.networking.domain}/prometheus";
  20. scrapeConfigs = mapAttrsToList
  21. (name: node: {
  22. job_name = name;
  23. static_configs = [
  24. {
  25. targets = [
  26. "${name}:${toString node.config.services.prometheus.exporters.node.port}"
  27. ];
  28. }
  29. ];
  30. })
  31. nodes;
  32. };
  33. services.nginx.virtualHosts.${config.networking.domain} = {
  34. locations."/grafana" = {
  35. proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}";
  36. proxyWebsockets = true;
  37. };
  38. locations."/prometheus" = {
  39. proxyPass = "http://127.0.0.1:${toString config.services.prometheus.port}";
  40. proxyWebsockets = true;
  41. };
  42. };
  43. }