Prometheus is configured to scrape availability metric at 5 minutes duration.
My requirement is that I want to get a series of data for past 7 days something like as shown below:
Day. Availability
Mar 6, 99.6
Mar 7, 98.0
Mar 8, 99.8
Mar 9, 100.0
Mar 10, 99.9
Mar 11, 99.3
Mar 12, 99.5
The values in the second column are nothing but the avg of availability values for that particular day.
Could you please help me with the query to achieve this result?
You could use something like
avg_over_time(up{job="node", instance=~"node:.*"} [1d]).Note, that this returns timeseries containing average value of you initial metric (
up{job="node", instance=~"node:.*"in my case), and not 7 values.If you want to see only 7 values - you'll have to configure it on receiving side. In case of grafana, for example, you could use Query option 'min interval' set to
1d.