feat: change promehteus's state dir

This commit is contained in:
Ryan Yin
2024-08-19 17:32:31 +08:00
parent 7e402ed9c8
commit 3c6d78537b

View File

@@ -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"
];