Prometheus query_range how to set start and end date and have one calculated and sum value of domains
I googled as much as I could to find and reach what I’m going to have, but I have some problems.
I downloaded libvirt_exporter on instance1.mysite.com
to have the values of how much each VM downloads and uploads.
This is my code:
import requests
response_tmp =requests.get(
'http://prom.mysite.com:9091/api/v1/query_range',
params={
'query': 'sum(increase(libvirt_domain_interface_stats_receive_bytes_total[2h]))',
'start': '2024-10-01T00:00:00.000Z', # RFC3339, UTC
'end': '2024-10-13T00:00:00.000Z', # RFC3339, UTC
'step': '60'
},
auth=('admin', 'myStrongAdminPassWord')
)#.json()['data']['result']
This is current result:
{"status":"error","errorType":"bad_data","error":"exceeded maximum resolution of 11,000 points per timeseries. Try decreasing the query resolution (?step=XX)"}
But if I change the start-end to a newer start date like 2024-10-12T00:00:00.000Z
, it is something like this:
{
"status": "success",
"data": {
"resultType": "matrix",
"result": [
{
"metric": {
"domain": "instance-0000017d",
"instance": "instance1.mysite.com:9177",
"job": "libvirt_exporter",
"target_device": "tapc1aedd0e-fd"
},
"values": [
[1728722820, "13668737203.838501"
],
[1728722880, "20305044171.814877"
],
[1728722940, "26668580969.595806"
],
[1728723000, "33146620341.0449"
],
[1728723060, "40289211402.494484"
],
[1728723120, "46987842952.288124"
],
[1728723180, "53823854756.43225"
]
]
}
]
}
}
But as I understood, the increase
function does this: 13668737203.838501 + 20305044171.814877 + 26668580969.595806 + 33146620341.0449 + 40289211402.494484 + 46987842952.288124 + 53823854756.43225
, but I see all the values.
I’m going to have 234889891797.5089
which is the sum of all above numbers.
Would you please help me regarding this?