Calculate prometheus disk space

Posted on Mon 01 August 2022 in Network • 1 min read

Calculate

needed_disk_space = retention_time_seconds * ingested_samples_per_second * bytes_per_sample

Source

30 days (secs): 2592000
ingested_samples_per_second: rate(prometheus_tsdb_head_samples_appended_total[2h])
bytes_per_sample: rate(prometheus_tsdb_compaction_chunk_size_bytes_sum[2h]) / rate(prometheus_tsdb_compaction_chunk_samples_sum[2h])

PromQL

(( 30*24*60*60 ) * rate(prometheus_tsdb_head_samples_appended_total[2h]) * ( rate(prometheus_tsdb_compaction_chunk_size_bytes_sum[2h]) / rate(prometheus_tsdb_compaction_chunk_samples_sum[2h]))) / 1024 / 1024 / 1024