about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/minio.nix
blob: e24d4f766e30eeccb48aa11dd68ea54f5e1da622 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ config, lib, pkgs, options, ... }:

with lib;

let
  cfg = config.services.prometheus.exporters.minio;
in
{
  port = 9290;
  extraOpts = {
    minioAddress = mkOption {
      type = types.str;
      example = "https://10.0.0.1:9000";
      description = lib.mdDoc ''
        The URL of the minio server.
        Use HTTPS if Minio accepts secure connections only.
        By default this connects to the local minio server if enabled.
      '';
    };

    minioAccessKey = mkOption {
      type = types.str;
      example = "yourMinioAccessKey";
      description = lib.mdDoc ''
        The value of the Minio access key.
        It is required in order to connect to the server.
        By default this uses the one from the local minio server if enabled
        and `config.services.minio.accessKey`.
      '';
    };

    minioAccessSecret = mkOption {
      type = types.str;
      description = lib.mdDoc ''
        The value of the Minio access secret.
        It is required in order to connect to the server.
        By default this uses the one from the local minio server if enabled
        and `config.services.minio.secretKey`.
      '';
    };

    minioBucketStats = mkOption {
      type = types.bool;
      default = false;
      description = lib.mdDoc ''
        Collect statistics about the buckets and files in buckets.
        It requires more computation, use it carefully in case of large buckets..
      '';
    };
  };
  serviceOpts = {
    serviceConfig = {
      ExecStart = ''
        ${pkgs.prometheus-minio-exporter}/bin/minio-exporter \
          -web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
          -minio.server ${cfg.minioAddress} \
          -minio.access-key ${escapeShellArg cfg.minioAccessKey} \
          -minio.access-secret ${escapeShellArg cfg.minioAccessSecret} \
          ${optionalString cfg.minioBucketStats "-minio.bucket-stats"} \
          ${concatStringsSep " \\\n  " cfg.extraFlags}
      '';
    };
  };
}