diff options
author | Silvan Mosberger <infinisil@icloud.com> | 2018-11-10 15:15:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-10 15:15:21 +0100 |
commit | 9c984b06c4b4b49a7b883ef6dd03dff23ab11301 (patch) | |
tree | 846a538ad8df74c245d938879b60bbde4f9eb3e3 /nixos | |
parent | e468a1091bd37f4e3b79a2fc42846e0089a4a2c4 (diff) | |
parent | 5b30cd77db41a5ef96cca35ff2f4fa10a1577d20 (diff) | |
download | nixlib-9c984b06c4b4b49a7b883ef6dd03dff23ab11301.tar nixlib-9c984b06c4b4b49a7b883ef6dd03dff23ab11301.tar.gz nixlib-9c984b06c4b4b49a7b883ef6dd03dff23ab11301.tar.bz2 nixlib-9c984b06c4b4b49a7b883ef6dd03dff23ab11301.tar.lz nixlib-9c984b06c4b4b49a7b883ef6dd03dff23ab11301.tar.xz nixlib-9c984b06c4b4b49a7b883ef6dd03dff23ab11301.tar.zst nixlib-9c984b06c4b4b49a7b883ef6dd03dff23ab11301.zip |
Merge pull request #38514 from disassembler/grafana-reporter
grafana-reporter: init at 2.0.1
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/grafana-reporter.nix | 66 |
2 files changed, 67 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 3d5479c31f01..2fbde1c451ce 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/services/monitoring/grafana-reporter.nix b/nixos/modules/services/monitoring/grafana-reporter.nix new file mode 100644 index 000000000000..149026d20188 --- /dev/null +++ b/nixos/modules/services/monitoring/grafana-reporter.nix @@ -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}"; + }; + }; + }; +} |