summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@higgsboson.tk>2017-01-11 22:27:52 +0100
committerGitHub <noreply@github.com>2017-01-11 22:27:52 +0100
commit62708c29f88c2ad70430158798c57cf0676219bf (patch)
treee0c4dbf84f5dff93b3de513d79829102888bb1a5 /nixos/modules/services/monitoring
parent4488203d0c01671ef2b73e858c316865953bb3c0 (diff)
parent10e2d88f6c528e2945306d22b5fc5a53e60ba228 (diff)
downloadnixlib-62708c29f88c2ad70430158798c57cf0676219bf.tar
nixlib-62708c29f88c2ad70430158798c57cf0676219bf.tar.gz
nixlib-62708c29f88c2ad70430158798c57cf0676219bf.tar.bz2
nixlib-62708c29f88c2ad70430158798c57cf0676219bf.tar.lz
nixlib-62708c29f88c2ad70430158798c57cf0676219bf.tar.xz
nixlib-62708c29f88c2ad70430158798c57cf0676219bf.tar.zst
nixlib-62708c29f88c2ad70430158798c57cf0676219bf.zip
Merge pull request #21570 from michaelpj/services/arbtt
arbtt service: init
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/arbtt.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/arbtt.nix b/nixos/modules/services/monitoring/arbtt.nix
new file mode 100644
index 000000000000..27d59e367d5c
--- /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 ];
+}