嗨,我在我的AWS实例上安装了Prometheus服务器,但是15天后数据被自动删除。我需要一年或几个月的数据,我的Prometheus配置是否需要更改?还是我需要像Thanos这样的扩展程序,我是Prometheus的新手,所以请轻松回答
编辑prometheus.service文件vi /etc/systemd/system/prometheus.service
在“ ExecStart = / usr / local / bin / prometheus”中添加下面的“ --storage.tsdb.retention.time = 1y”。
因此,该配置看起来像下面这样,可以保留1年的数据。
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.external-url=http://34.89.26.156:9090 \
--storage.tsdb.retention.time=1y
[Install]
WantedBy=multi-user.target