Configuring Prometheus data retention
You can control how long Prometheus stores monitoring data and how much disk space it consumes by configuring retention settings in the Prometheus service specification. Prometheus is the component responsible for storing metrics; therefore, retention policies must be applied to the Prometheus spec.
Before you begin
- Prometheus is deployed and managed by Cephadm.
- You have cluster administrator privileges.
- Prometheus is running.
ceph orch ls | grep prometheus
Procedure
Example
The following example configures Prometheus to retain monitoring data for one year or up to 100 GB.
service_type: prometheus service_name: prometheus placement: count: 1 spec: retention_time: "1y" retention_size: "100GB"
Prometheus automatically deletes older data when either the time-based or size-based threshold is reached.
Prometheus now enforces the configured retention policy. If Prometheus was already deployed before applying the updated specification, redeployment ensures that the new settings take effect.