admin管理员组文章数量:1405314
I have installed Prometheus in a vim using apt install prometheus. I want to configure storage location and retention size. Here is the excerpt from the documentation
Prometheus has several flags that configure local storage. The most important are:
--storage.tsdb.path: Where Prometheus writes its database. Defaults to data/.
--storage.tsdb.retention.time: How long to retain samples in storage. If neither this flag nor storage.tsdb.retention.size is set, the retention time defaults to 15d. Supported units: y, w, d, h, m, s, ms.
--storage.tsdb.retention.size: The maximum number of bytes of storage blocks to retain
I have tried editing the prometheus.yml file and I keep getting an error "unable to unmarshall". Here is what I have tried.
global:
storage:
tsdb:
path: "/data/prometheus"
retention:
time: "30d"
size: "50GB"
I have also tried out side of the global directive. I can't figure out how to configure the storage. Is this the right place to configure this? Or do I edit the systemd file and add them as arguments?
Thanks
I have installed Prometheus in a vim using apt install prometheus. I want to configure storage location and retention size. Here is the excerpt from the documentation
Prometheus has several flags that configure local storage. The most important are:
--storage.tsdb.path: Where Prometheus writes its database. Defaults to data/.
--storage.tsdb.retention.time: How long to retain samples in storage. If neither this flag nor storage.tsdb.retention.size is set, the retention time defaults to 15d. Supported units: y, w, d, h, m, s, ms.
--storage.tsdb.retention.size: The maximum number of bytes of storage blocks to retain
I have tried editing the prometheus.yml file and I keep getting an error "unable to unmarshall". Here is what I have tried.
global:
storage:
tsdb:
path: "/data/prometheus"
retention:
time: "30d"
size: "50GB"
I have also tried out side of the global directive. I can't figure out how to configure the storage. Is this the right place to configure this? Or do I edit the systemd file and add them as arguments?
Thanks
Share Improve this question asked Mar 22 at 22:21 DaxcorDaxcor 1453 silver badges11 bronze badges1 Answer
Reset to default 2I have tried editing the prometheus.yml file and I keep getting an error "unable to unmarshall".
Or do I edit the systemd file and add them as arguments?
Prometheus manages configuration in two ways:
- immutable configs via command line flags
- scraping and rules configuration via configuration file (prometheus.yml)
To configure Prometheus storage options, which is immutable, you can pass the configuration via command line when starting prometheus:
./prometheus --storage.tsdb.path=/data/prometheus --storage.tsdb.retention.time=30d --storage.tsdb.retention.size=50GB
If you are running Prometheus via systemd, simply alter the ExecStart
command in prometheus.service
file to something like the following:
....
[Service]
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/opt/prometheus/prometheus \
--storage.tsdb.path=/data/prometheus \
--storage.tsdb.retention.time=30d \
--storage.tsdb.retention.size=50GB
...
Here is the list of all configuration that are immutable, and need to be configure via command line.
本文标签: configurationHow to configure prometheus storage optionsStack Overflow
版权声明:本文标题:configuration - How to configure prometheus storage options - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744302017a2599628.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论