about summary refs log tree commit diff
path: root/hosts/common/server/prometheus.nix
blob: 1c7c9068888fd04b4ef05c1ef38f19aa46751466 (plain) (blame)
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
{ config, pkgs, lib, ... }:

let
  # Scrape a list of static targets for a job.
  staticScrape = (job_name: targets: {
    inherit job_name;
    static_configs = [{ inherit targets; }];
  });
in
{
  services.prometheus = {
    enable = true;

    globalConfig.scrape_interval = "15s";

    extraFlags = [
      # 3 years of retention
      "--storage.tsdb.retention=1095d"
      "--web.enable-admin-api"
    ];

    scrapeConfigs = [
      (staticScrape "node" [
        "rtr:9100"
        "tahoe:9100"
      ])
    ];
  };
}