summaryrefslogtreecommitdiff
path: root/modules/xnet/monitoring/default.nix
blob: 87ae7249584786438cab497838f5a6aba5c1d045 (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
{ config, ... }:
let
  inherit (config.networking) hostName;
  inherit (config.services.prometheus) exporters;
in
{
  imports = [ ./grafana.nix ./prometheus.nix ];

  exporters = {
    node = {
      enable = true;
      enabledCollectors = [ "processes" "systemd" ];
    };

    systemd = {
      enable = true;
      extraFlags = [
        "--systemd.collector.enable-ip-accounting"
        "--systemd.collector.enable-restart-count"
      ];
    };
  };

  services.prometheus.scrapeConfigs = [
    {
      job_name = "node";
      static_configs = [{
        targets = [ "${hostName}:${toString exporters.node.port}" ];
      }];
    }
    {
      job_name = "systemd";
      static_configs = [{
        targets = [ "${hostName}:${toString exporters.systemd.port}" ];
      }];
    }
  ];
}