summaryrefslogtreecommitdiff
path: root/hosts/chaski/services/grafana.nix
blob: 7de2f699f5f7908171f4b97d24ec7d53fa2a07a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ config, pkgs, ... }:

{
  services.prometheus = {
    enable = true;
    port = 9001;
    scrapeConfigs = [ {
      job_name = "lmucast-docker";
      static_configs = [ {
        targets = [ "cast.itunes.uni-muenchen.de:9101" ];
      } ];
    } ];
  };

  services.grafana = {
    enable = true;
    port = 5000;
    addr = "[::]";
    rootUrl = "https://scrape.stuebinm.eu/";
    auth.anonymous.enable = true;

   provision = {
      enable = true;
      datasources = [ {
        name = "lmucast";
        type = "prometheus";
        url = "http://localhost:9001";
      } ];
    };
  };

  services.nginx.enable = true;
  services.nginx.virtualHosts."scrape.stuebinm.eu" = {
    locations."/" = {
      proxyPass = "http://localhost:5000";
      proxyWebsockets = true;
    };
    enableACME = true;
    forceSSL = true;
  };

  networking.firewall.allowedTCPPorts = [ 80 443 ];
}