Merge pull request #30216 from bachp/minio-exporter

Minio exporter
This commit is contained in:
Jörg Thalheim 2017-10-08 15:09:32 +01:00 committed by GitHub
commit 28db3ad7ae
5 changed files with 301 additions and 0 deletions

View File

@ -375,6 +375,7 @@
./services/monitoring/prometheus/collectd-exporter.nix
./services/monitoring/prometheus/fritzbox-exporter.nix
./services/monitoring/prometheus/json-exporter.nix
./services/monitoring/prometheus/minio-exporter.nix
./services/monitoring/prometheus/nginx-exporter.nix
./services/monitoring/prometheus/node-exporter.nix
./services/monitoring/prometheus/snmp-exporter.nix

View File

@ -0,0 +1,117 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.prometheus.minioExporter;
in {
options = {
services.prometheus.minioExporter = {
enable = mkEnableOption "prometheus minio exporter";
port = mkOption {
type = types.int;
default = 9290;
description = ''
Port to listen on.
'';
};
listenAddress = mkOption {
type = types.nullOr types.str;
default = null;
example = "0.0.0.0";
description = ''
Address to listen on for web interface and telemetry.
'';
};
minioAddress = mkOption {
type = types.str;
example = "https://10.0.0.1:9000";
default = if config.services.minio.enable then "http://localhost:9000" else null;
description = ''
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 = "BKIKJAA5BMMU2RHO6IBB";
description = ''
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 <literal>config.services.minio.accessKey</literal>.
'';
} // optionalAttrs (config.services.minio.enable && config.services.minio.accessKey != "") {
default = config.services.minio.accessKey;
});
minioAccessSecret = mkOption ({
type = types.str;
description = ''
The calue 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 <literal>config.services.minio.secretKey</literal>.
'';
} // optionalAttrs (config.services.minio.enable && config.services.minio.secretKey != "") {
default = config.services.minio.secretKey;
});
minioBucketStats = mkOption {
type = types.bool;
default = false;
description = ''
Collect statistics about the buckets and files in buckets.
It requires more computation, use it carefully in case of large buckets..
'';
};
extraFlags = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Extra commandline options when launching the minio exporter.
'';
};
openFirewall = mkOption {
type = types.bool;
default = false;
description = ''
Open port in firewall for incoming connections.
'';
};
};
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = optional cfg.openFirewall cfg.port;
systemd.services.prometheus-minio-exporter = {
description = "Prometheus exporter for Minio server metrics";
unitConfig.Documentation = "https://github.com/joe-pll/minio-exporter";
wantedBy = [ "multi-user.target" ];
after = optional config.services.minio.enable "minio.service";
serviceConfig = {
DynamicUser = true;
Restart = "always";
PrivateTmp = true;
WorkingDirectory = /tmp;
ExecStart = ''
${pkgs.prometheus-minio-exporter}/bin/minio-exporter \
-web.listen-address ${optionalString (cfg.listenAddress != null) cfg.listenAddress}:${toString cfg.port} \
-minio.server ${cfg.minioAddress} \
-minio.access-key ${cfg.minioAccessKey} \
-minio.access-secret ${cfg.minioAccessSecret} \
${optionalString cfg.minioBucketStats "-minio.bucket-stats"} \
${concatStringsSep " \\\n " cfg.extraFlags}
'';
};
};
};
}

View File

@ -0,0 +1,26 @@
{ stdenv, lib, buildGoPackage, fetchFromGitHub }:
buildGoPackage rec {
name = "minio-exporter-${version}";
version = "0.1.0";
rev = "v${version}";
goPackagePath = "github.com/joe-pll/minio-exporter";
src= fetchFromGitHub {
inherit rev;
owner = "joe-pll";
repo = "minio-exporter";
sha256 = "14lz4dg0n213b6xy12fh4r20k1rcnflnfg6gjskk5zr8h7978hjx";
};
goDeps = ./deps.nix;
meta = with stdenv.lib; {
description = "A Prometheus exporter for Minio cloud storage server";
homepage = https://github.com/joe-pll/minio-exporter;
license = licenses.asl20;
maintainers = with maintainers; [ bachp ];
platforms = platforms.unix;
};
}

View File

@ -0,0 +1,156 @@
# This file was generated by go2nix.
[
{
goPackagePath = "github.com/alecthomas/template";
fetch = {
type = "git";
url = "https://github.com/alecthomas/template";
rev = "a0175ee3bccc567396460bf5acd36800cb10c49c";
sha256 = "0qjgvvh26vk1cyfq9fadyhfgdj36f1iapbmr5xp6zqipldz8ffxj";
};
}
{
goPackagePath = "github.com/alecthomas/units";
fetch = {
type = "git";
url = "https://github.com/alecthomas/units";
rev = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a";
sha256 = "1j65b91qb9sbrml9cpabfrcf07wmgzzghrl7809hjjhrmbzri5bl";
};
}
{
goPackagePath = "github.com/beorn7/perks";
fetch = {
type = "git";
url = "https://github.com/beorn7/perks";
rev = "4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9";
sha256 = "1hrybsql68xw57brzj805xx2mghydpdiysv3gbhr7f5wlxj2514y";
};
}
{
goPackagePath = "github.com/go-ini/ini";
fetch = {
type = "git";
url = "https://github.com/go-ini/ini";
rev = "c787282c39ac1fc618827141a1f762240def08a3";
sha256 = "0c784qichlpqdk1zwafislskchr7f4dl7fy3g3w7xg2w63xpd7r0";
};
}
{
goPackagePath = "github.com/golang/protobuf";
fetch = {
type = "git";
url = "https://github.com/golang/protobuf";
rev = "130e6b02ab059e7b717a096f397c5b60111cae74";
sha256 = "0zk4d7gcykig9ld8f5h86fdxshm2gs93a2xkpf52jd5m4z59q26s";
};
}
{
goPackagePath = "github.com/matttproud/golang_protobuf_extensions";
fetch = {
type = "git";
url = "https://github.com/matttproud/golang_protobuf_extensions";
rev = "c12348ce28de40eed0136aa2b644d0ee0650e56c";
sha256 = "1d0c1isd2lk9pnfq2nk0aih356j30k3h1gi2w0ixsivi5csl7jya";
};
}
{
goPackagePath = "github.com/minio/go-homedir";
fetch = {
type = "git";
url = "https://github.com/minio/go-homedir";
rev = "21304a94172ae3a09dee2cd86a12fb6f842138c7";
sha256 = "1kvz91gvdrpzddlpcbf0a2kf75bfqzd40kwzq29jwhf1y5ii6cq4";
};
}
{
goPackagePath = "github.com/minio/minio-go";
fetch = {
type = "git";
url = "https://github.com/minio/minio-go";
rev = "cb3571b7d8d904c4714033deb984d0a0b66955be";
sha256 = "165filzwslnqdgsp8wf5k1zm8wcpnsffsaffw25igy0ik8swr06w";
};
}
{
goPackagePath = "github.com/minio/minio";
fetch = {
type = "git";
url = "https://github.com/minio/minio";
rev = "60cc6184d253efee4a3120683517028342229e21";
sha256 = "0n2l163v45jraylv43jwqm0cxin68vw8cw7k21qniahhr46y4dqf";
};
}
{
goPackagePath = "github.com/prometheus/client_golang";
fetch = {
type = "git";
url = "https://github.com/prometheus/client_golang";
rev = "353b8c3f3776541879f9abfd8fa8b1ae162ab394";
sha256 = "068fk3bdfsaij37973c66065w2cn46ahwjs44pw9v1mqk8bsrn3a";
};
}
{
goPackagePath = "github.com/prometheus/client_model";
fetch = {
type = "git";
url = "https://github.com/prometheus/client_model";
rev = "6f3806018612930941127f2a7c6c453ba2c527d2";
sha256 = "1413ibprinxhni51p0755dp57r9wvbw7xgj9nmdaxmhzlqhc86j4";
};
}
{
goPackagePath = "github.com/prometheus/common";
fetch = {
type = "git";
url = "https://github.com/prometheus/common";
rev = "2f17f4a9d485bf34b4bfaccc273805040e4f86c8";
sha256 = "0r1dyipnd7n9vp4p6gs1y4v7ggq4avj06pr90l4qrjll55h281js";
};
}
{
goPackagePath = "github.com/prometheus/procfs";
fetch = {
type = "git";
url = "https://github.com/prometheus/procfs";
rev = "e645f4e5aaa8506fc71d6edbc5c4ff02c04c46f2";
sha256 = "18hwygbawbqilz7h8fl25xpbciwalkslb4igqn4cr9d8sqp7d3np";
};
}
{
goPackagePath = "github.com/sirupsen/logrus";
fetch = {
type = "git";
url = "https://github.com/sirupsen/logrus";
rev = "89742aefa4b206dcf400792f3bd35b542998eb3b";
sha256 = "0hk7fabx59msg2y0iik6xvfp80s73ybrwlcshbm9ds91iqbkcxi6";
};
}
{
goPackagePath = "golang.org/x/crypto";
fetch = {
type = "git";
url = "https://go.googlesource.com/crypto";
rev = "76eec36fa14229c4b25bb894c2d0e591527af429";
sha256 = "1c57fdg70vhf7pigiwb2xdap6ak0c0s2pzaj9pq000aqfw54i4s8";
};
}
{
goPackagePath = "golang.org/x/sys";
fetch = {
type = "git";
url = "https://go.googlesource.com/sys";
rev = "314a259e304ff91bd6985da2a7149bbf91237993";
sha256 = "0vya62c3kmhmqx6awlxx8hc84987xkym9rhs0q28vlhwk9kczdaa";
};
}
{
goPackagePath = "gopkg.in/alecthomas/kingpin.v2";
fetch = {
type = "git";
url = "https://gopkg.in/alecthomas/kingpin.v2";
rev = "1087e65c9441605df944fb12c33f0fe7072d18ca";
sha256 = "18llqzkdqf62qbqcv2fd3j0igl6cwwn4dissf5skkvxrcxjcmmj0";
};
}
]

View File

@ -11792,6 +11792,7 @@ with pkgs;
prometheus-haproxy-exporter = callPackage ../servers/monitoring/prometheus/haproxy-exporter.nix { };
prometheus-json-exporter = callPackage ../servers/monitoring/prometheus/json-exporter.nix { };
prometheus-mesos-exporter = callPackage ../servers/monitoring/prometheus/mesos-exporter.nix { };
prometheus-minio-exporter = callPackage ../servers/monitoring/prometheus/minio-exporter { };
prometheus-mysqld-exporter = callPackage ../servers/monitoring/prometheus/mysqld-exporter.nix { };
prometheus-nginx-exporter = callPackage ../servers/monitoring/prometheus/nginx-exporter.nix { };
prometheus-node-exporter = callPackage ../servers/monitoring/prometheus/node-exporter.nix { };