summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/prometheus/default.nix
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2019-09-21 14:50:08 +0200
committerLinus Heckemann <git@sphalerite.org>2020-09-25 13:44:13 +0200
commit5c0a2e8c60660b341843883988d28f49b65d795e (patch)
treee7d6451501437f708226aed3066fee3540629c0f /nixos/modules/services/monitoring/prometheus/default.nix
parent1179840f9a88b8a548f4b11d1a03aa25a790c379 (diff)
downloadnixpkgs-5c0a2e8c60660b341843883988d28f49b65d795e.tar
nixpkgs-5c0a2e8c60660b341843883988d28f49b65d795e.tar.gz
nixpkgs-5c0a2e8c60660b341843883988d28f49b65d795e.tar.bz2
nixpkgs-5c0a2e8c60660b341843883988d28f49b65d795e.tar.lz
nixpkgs-5c0a2e8c60660b341843883988d28f49b65d795e.tar.xz
nixpkgs-5c0a2e8c60660b341843883988d28f49b65d795e.tar.zst
nixpkgs-5c0a2e8c60660b341843883988d28f49b65d795e.zip
nixos/prometheus: add retentionTime
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus/default.nix')
-rw-r--r--nixos/modules/services/monitoring/prometheus/default.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix
index d7e06484b69..bc23606edf1 100644
--- a/nixos/modules/services/monitoring/prometheus/default.nix
+++ b/nixos/modules/services/monitoring/prometheus/default.nix
@@ -49,8 +49,8 @@ let
     "--web.listen-address=${cfg.listenAddress}:${builtins.toString cfg.port}"
     "--alertmanager.notification-queue-capacity=${toString cfg.alertmanagerNotificationQueueCapacity}"
     "--alertmanager.timeout=${toString cfg.alertmanagerTimeout}s"
-  ] ++
-  optional (cfg.webExternalUrl != null) "--web.external-url=${cfg.webExternalUrl}";
+  ] ++ optional (cfg.webExternalUrl != null) "--web.external-url=${cfg.webExternalUrl}"
+    ++ optional (cfg.retentionTime != null)  "--storage.tsdb.retention.time=${cfg.retentionTime}";
 
   filterValidPrometheus = filterAttrsListRecursive (n: v: !(n == "_module" || v == null));
   filterAttrsListRecursive = pred: x:
@@ -624,6 +624,15 @@ in {
         errors, despite a correct configuration.
       '';
     };
+
+    retentionTime = mkOption {
+      type = types.nullOr types.str;
+      default = null;
+      example = "15d";
+      description = ''
+        How long to retain samples in storage.
+      '';
+    };
   };
 
   config = mkIf cfg.enable {