about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/scaphandre.nix
blob: 3b6ebf65b0903a6330e5fd45c58b74f4cc814b17 (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
30
31
32
33
{ config
, lib
, pkgs
, options
}:

let
  logPrefix = "services.prometheus.exporter.scaphandre";
  cfg = config.services.prometheus.exporters.scaphandre;
in {
  port = 8080;
  extraOpts = {
    telemetryPath = lib.mkOption {
      type = lib.types.str;
      default = "/metrics";
      description = lib.mdDoc ''
        Path under which to expose metrics.
      '';
    };
  };

  serviceOpts = {
    serviceConfig = {
      ExecStart = ''
        ${pkgs.scaphandre}/bin/scaphandre prometheus \
          --address ${cfg.listenAddress} \
          --port ${toString cfg.port} \
          --suffix ${cfg.telemetryPath} \
          ${lib.concatStringsSep " \\\n  " cfg.extraFlags}
      '';
    };
  };
}