8.13. Configuring Retention Policy for Prometheus MetricsΒΆ
The Prometheus service used for monitoring the cluster runs and stores its data on the management node. By default, Prometheus metrics are stored for 7 days. This retention period can be insufficient for troubleshooting purposes. You can increase this period in the Prometheus configuration file as follows:
On the management node, open the
/etc/sysconfig/prometheus
file to edit, set the needed retention period for theSTORAGE_RETENTION
option, and save your changes. For example:STORAGE_RETENTION="--storage.tsdb.retention.time=30d"
Restart the Prometheus service:
systemctl restart prometheus.service
In case high availability is enabled in the storage cluster, repeat these steps for the other two management nodes.
However, with a long retention period, the root partition where the data is stored may run out of free space. To prevent this, you can define the maximum size for the Prometheus metrics. The oldest data will be removed first. To change the time retention policy to the size retention policy, do as follows:
On the management node, open the
/etc/sysconfig/prometheus
file to edit, change the flag for theSTORAGE_RETENTION
option, and save your changes. For example:STORAGE_RETENTION="--storage.tsdb.retention.size=10GB"
Restart the Prometheus service:
systemctl restart prometheus.service
In case high availability is enabled in the storage cluster, repeat these steps for the other two management nodes.