From 3c6d78537b6486d2eb9aba60c0ce25b5bd683db2 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Mon, 19 Aug 2024 17:32:31 +0800 Subject: [PATCH] feat: change promehteus's state dir --- hosts/idols-aquamarine/prometheus/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hosts/idols-aquamarine/prometheus/default.nix b/hosts/idols-aquamarine/prometheus/default.nix index 9cba073e..8326443b 100644 --- a/hosts/idols-aquamarine/prometheus/default.nix +++ b/hosts/idols-aquamarine/prometheus/default.nix @@ -4,6 +4,12 @@ myvars, ... }: { + # Workaround for prometheus to store data in another place + systemd.tmpfiles.rules = [ + "D /data/apps/prometheus2 0751 prometheus prometheus - -" + "L+ /var/lib/prometheus2 - - - - /data/apps/prometheus2" + ]; + # https://prometheus.io/docs/prometheus/latest/configuration/configuration/ services.prometheus = { enable = true; @@ -13,7 +19,7 @@ webExternalUrl = "http://prometheus.writefor.fun"; extraFlags = [ - "--storage.tsdb.retention.time=45d" + "--storage.tsdb.retention.time=30d" # https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations "--web.enable-remote-write-receiver" ];