summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Peyton Jones <michaelpj@gmail.com>2017-01-01 16:45:26 +0000
committerMichael Peyton Jones <michaelpj@gmail.com>2017-01-01 18:59:01 +0000
commit10e2d88f6c528e2945306d22b5fc5a53e60ba228 (patch)
tree17aea9ed6385a07419301072dbd9aa7fa1e76ed6
parentc58b4cf69394c406b963c9b141b45886d68e9593 (diff)
downloadnixpkgs-10e2d88f6c528e2945306d22b5fc5a53e60ba228.tar
nixpkgs-10e2d88f6c528e2945306d22b5fc5a53e60ba228.tar.gz
nixpkgs-10e2d88f6c528e2945306d22b5fc5a53e60ba228.tar.bz2
nixpkgs-10e2d88f6c528e2945306d22b5fc5a53e60ba228.tar.lz
nixpkgs-10e2d88f6c528e2945306d22b5fc5a53e60ba228.tar.xz
nixpkgs-10e2d88f6c528e2945306d22b5fc5a53e60ba228.tar.zst
nixpkgs-10e2d88f6c528e2945306d22b5fc5a53e60ba228.zip
arbtt service: init
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/monitoring/arbtt.nix63
2 files changed, 64 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index be09fb80e0a..54a70d6fcea 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -293,6 +293,7 @@
   ./services/misc/uhub.nix
   ./services/misc/zookeeper.nix
   ./services/monitoring/apcupsd.nix
+  ./services/monitoring/arbtt.nix
   ./services/monitoring/bosun.nix
   ./services/monitoring/cadvisor.nix
   ./services/monitoring/collectd.nix
diff --git a/nixos/modules/services/monitoring/arbtt.nix b/nixos/modules/services/monitoring/arbtt.nix
new file mode 100644
index 00000000000..27d59e367d5
--- /dev/null
+++ b/nixos/modules/services/monitoring/arbtt.nix
@@ -0,0 +1,63 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.arbtt;
+in {
+  options = {
+    services.arbtt = {
+      enable = mkOption {
+        type = types.bool;
+        default = false;
+        example = true;
+        description = ''
+          Enable the arbtt statistics capture service.
+        '';
+      };
+
+      package = mkOption {
+        type = types.package;
+        default = pkgs.haskellPackages.arbtt;
+        defaultText = "pkgs.haskellPackages.arbtt";
+        example = literalExample "pkgs.haskellPackages.arbtt";
+        description = ''
+          The package to use for the arbtt binaries.
+        '';
+      };
+
+      logFile = mkOption {
+        type = types.str;
+        default = "%h/.arbtt/capture.log";
+        example = "/home/username/.arbtt-capture.log";
+        description = ''
+          The log file for captured samples.
+        '';
+      };
+
+      sampleRate = mkOption {
+        type = types.int;
+        default = 60;
+        example = 120;
+        description = ''
+          The sampling interval in seconds.
+        '';
+      };
+    };
+  };
+
+  config = mkIf cfg.enable {
+    systemd.user.services.arbtt = {
+      description = "arbtt statistics capture service";
+      wantedBy = [ "multi-user.target" ];
+
+      serviceConfig = {
+        Type = "simple";
+        ExecStart = "${cfg.package}/bin/arbtt-capture --logfile=${cfg.logFile} --sample-rate=${toString cfg.sampleRate}";
+        Restart = "always";
+      };
+    };
+  };
+
+  meta.maintainers = [ maintainers.michaelpj ];
+}