Merge pull request #38514 from disassembler/grafana-reporter

grafana-reporter: init at 2.0.1
This commit is contained in:
Silvan Mosberger 2018-11-10 15:15:21 +01:00 committed by GitHub
commit 9c984b06c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 101 additions and 0 deletions

View File

@ -431,6 +431,7 @@
./services/monitoring/dd-agent/dd-agent.nix
./services/monitoring/fusion-inventory.nix
./services/monitoring/grafana.nix
./services/monitoring/grafana-reporter.nix
./services/monitoring/graphite.nix
./services/monitoring/hdaps.nix
./services/monitoring/heapster.nix

View File

@ -0,0 +1,66 @@
{ options, config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.grafana_reporter;
in {
options.services.grafana_reporter = {
enable = mkEnableOption "grafana_reporter";
grafana = {
protocol = mkOption {
description = "Grafana protocol.";
default = "http";
type = types.enum ["http" "https"];
};
addr = mkOption {
description = "Grafana address.";
default = "127.0.0.1";
type = types.str;
};
port = mkOption {
description = "Grafana port.";
default = 3000;
type = types.int;
};
};
addr = mkOption {
description = "Listening address.";
default = "127.0.0.1";
type = types.str;
};
port = mkOption {
description = "Listening port.";
default = 8686;
type = types.int;
};
templateDir = mkOption {
description = "Optional template directory to use custom tex templates";
default = "${pkgs.grafana_reporter}";
type = types.str;
};
};
config = mkIf cfg.enable {
systemd.services.grafana_reporter = {
description = "Grafana Reporter Service Daemon";
wantedBy = ["multi-user.target"];
after = ["network.target"];
serviceConfig = let
args = lib.concatSepString " " [
"-proto ${cfg.grafana.protocol}://"
"-ip ${cfg.grafana.addr}:${toString cfg.grafana.port}"
"-port :${toString cfg.port}"
"-templates ${cfg.templateDir}"
];
in {
ExecStart = "${pkgs.grafana_reporter.bin}/bin/grafana-reporter ${args}";
};
};
};
}

View File

@ -0,0 +1,32 @@
{ stdenv, buildGoPackage, fetchFromGitHub, tetex, makeWrapper }:
with stdenv.lib;
buildGoPackage rec {
name = "reporter-${version}";
version = "2.0.1";
rev = "v${version}";
goPackagePath = "github.com/IzakMarais/reporter";
nativeBuildInputs = [ makeWrapper ];
src = fetchFromGitHub {
inherit rev;
owner = "IzakMarais";
repo = "reporter";
sha256 = "0yi7nx8ig5xgkwizddl0gdicnmcdp4qgg1fdxyq04l2y3qs176sg";
};
postInstall = ''
wrapProgram $bin/bin/grafana-reporter \
--prefix PATH : ${makeBinPath [ tetex ]}
'';
meta = {
description = "PDF report generator from a Grafana dashboard";
homepage = https://github.com/IzakMarais/reporter;
license = licenses.mit;
maintainers = with maintainers; [ disassembler ];
};
}

View File

@ -13354,6 +13354,8 @@ with pkgs;
grafana = callPackage ../servers/monitoring/grafana { };
grafana_reporter = callPackage ../servers/monitoring/grafana-reporter { };
h2o = callPackage ../servers/http/h2o { };
haka = callPackage ../tools/security/haka { };