summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/prometheus/default.nix
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2020-09-25 17:11:27 +0200
committerGitHub <noreply@github.com>2020-09-25 17:11:27 +0200
commitbb33cdd44b8a6cb38ecc3c8ba61b671e11df9041 (patch)
treeb14b3dd72f73cde93777c57e12118a61964e9a28 /nixos/modules/services/monitoring/prometheus/default.nix
parent2d94370264e5963ec94bcd8603a7c3a99249362e (diff)
parent5c0a2e8c60660b341843883988d28f49b65d795e (diff)
downloadnixpkgs-bb33cdd44b8a6cb38ecc3c8ba61b671e11df9041.tar
nixpkgs-bb33cdd44b8a6cb38ecc3c8ba61b671e11df9041.tar.gz
nixpkgs-bb33cdd44b8a6cb38ecc3c8ba61b671e11df9041.tar.bz2
nixpkgs-bb33cdd44b8a6cb38ecc3c8ba61b671e11df9041.tar.lz
nixpkgs-bb33cdd44b8a6cb38ecc3c8ba61b671e11df9041.tar.xz
nixpkgs-bb33cdd44b8a6cb38ecc3c8ba61b671e11df9041.tar.zst
nixpkgs-bb33cdd44b8a6cb38ecc3c8ba61b671e11df9041.zip
Merge pull request #98738 from mayflower/prometheus-retention
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 bfd4951ef48..98aaa9c0f03 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 {