monitoring - 增加 Prometheus 存储保留
问题描述
嗨,我在我的 AWS 实例上安装了 Prometheus 服务器,但数据会在 15 天后自动删除。我需要一年或几个月的数据,我的 prometheus 配置有什么需要更改的吗?或者我需要像 Thanos 这样的扩展吗,我是 Prometheus 的新手,所以请轻松回答
解决方案
- 编辑 prometheus.service 文件
vi /etc/systemd/system/prometheus.service
- 在下面添加
"--storage.tsdb.retention.time=1y"
到"ExecStart=/usr/local/bin/prometheus \"
行。
因此,配置将如下所示,保留 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
推荐阅读
- swiftui - 如何使用 SwiftUI2 网格创建“砌体式”布局?
- python - 为什么我的输出在创建 dict() 时返回“None None”?
- javascript - 尝试清除/清空/删除/设置回初始状态时,React setState 挂钩不起作用
- linux - Linux下调试.NET Core
- pandas - 如何在 pandas groubpy 对象上调用不同的聚合操作
- ios - IOS操作完成后如何释放vImage缓冲区
- reactjs - Electron React App,路径未映射到构建文件夹中的 JS 文件
- node.js - cy.task() with require('oracledb') 抛出错误
- javascript - 如何从包含多个数组的 JSON 中提取所有数据?
- c# - 返回一个元组而不是抛出异常是一个坏主意吗?