summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorJaka Hudoklin <jakahudoklin@gmail.com>2015-11-17 17:17:01 +0100
committerJaka Hudoklin <jakahudoklin@gmail.com>2015-11-17 17:17:01 +0100
commit0667fe29c9d12db579e9ae3deb95c800e03a3b31 (patch)
treea148f008402602474c9fc0d200b3721ae3a53c12 /nixos/modules/services/monitoring
parentdfd1f14ca59003b69a94f75e507f7fdfee6016fa (diff)
parentaa4bad4c178c40976836aa0c9066c47dd6885418 (diff)
downloadnixlib-0667fe29c9d12db579e9ae3deb95c800e03a3b31.tar
nixlib-0667fe29c9d12db579e9ae3deb95c800e03a3b31.tar.gz
nixlib-0667fe29c9d12db579e9ae3deb95c800e03a3b31.tar.bz2
nixlib-0667fe29c9d12db579e9ae3deb95c800e03a3b31.tar.lz
nixlib-0667fe29c9d12db579e9ae3deb95c800e03a3b31.tar.xz
nixlib-0667fe29c9d12db579e9ae3deb95c800e03a3b31.tar.zst
nixlib-0667fe29c9d12db579e9ae3deb95c800e03a3b31.zip
Merge pull request #11061 from offlinehacker/nixos/heapster/add
heapster module: init
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/heapster.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/heapster.nix b/nixos/modules/services/monitoring/heapster.nix
new file mode 100644
index 000000000000..74b8c9ccd3ed
--- /dev/null
+++ b/nixos/modules/services/monitoring/heapster.nix
@@ -0,0 +1,57 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.heapster;
+in {
+  options.services.heapster = {
+    enable = mkOption {
+      description = "Whether to enable heapster monitoring";
+      default = false;
+      type = types.bool;
+    };
+
+    source = mkOption {
+      description = "Heapster metric source";
+      example = "kubernetes:https://kubernetes.default";
+      type = types.string;
+    };
+
+    sink = mkOption {
+      description = "Heapster metic sink";
+      example = "influxdb:http://localhost:8086";
+      type = types.string;
+    };
+
+    extraOpts = mkOption {
+      description = "Heapster extra options";
+      default = "";
+      type = types.string;
+    };
+
+    package = mkOption {
+      description = "Package to use by heapster";
+      default = pkgs.heapster;
+      type = types.package;
+    };
+  };
+
+  config = mkIf cfg.enable {
+    systemd.services.heapster = {
+      wantedBy = ["multi-user.target"];
+      after = ["cadvisor.service" "kube-apiserver.service"];
+
+      serviceConfig = {
+        ExecStart = "${cfg.package}/bin/heapster --source=${cfg.source} --sink=${cfg.sink} ${cfg.extraOpts}";
+        User = "heapster";
+      };
+    };
+
+    users.extraUsers = singleton {
+      name = "heapster";
+      uid = config.ids.uids.heapster;
+      description = "Heapster user";
+    };
+  };
+}