英文:
Need guidance for prometheus memory utilization query
问题
I am using the prometheus query '100 - ((node_memory_MemAvailable_bytes{job="jobname"} * 100) / node_memory_MemTotal_bytes{job="jobname"})' to get the memory utilization and it is working fine.
以上查询用于获取内存利用率,它正常工作。
The above query is giving the result for current memory utilization.
上述查询提供当前内存利用率的结果。
I need to reconstruct the query to get the memory utilization for last 1 hour. For example, if the memory utilization reaches more than 10 MB at 9.15 am and the current memory utilization is 2 MB at 10 am, now I need to check whether the memory utilization is more than 9 MB between 9 am to 10 am.
我需要重构查询,以获取过去1小时内存利用率。例如,如果内存利用率在上午9:15达到10 MB以上,并且当前内存利用率在上午10点为2 MB,现在我需要检查9点到10点之间内存利用率是否超过9 MB。
Kindly guide me how to construct the prometheus query for it, I think it is something like, '(100 - ((node_memory_MemAvailable_bytes{job="jobname"} * 100) / node_memory_MemTotal_bytes{job="jobname"}))>9[1H]'
请指导我如何构建用于此目的的Prometheus查询,我认为它类似于 '(100 - ((node_memory_MemAvailable_bytes{job="jobname"} * 100) / node_memory_MemTotal_bytes{job="jobname"}))>9[1H]'。
英文:
> I am using the prometheus query '100 - ((node_memory_MemAvailable_bytes{job="jobname"} * 100) / node_memory_MemTotal_bytes{job="jobname"})' to get the memory utilization and it is working fine.
>
> The above query is giving the result for current memory utilization.
>
> I need to reconstruct the query to get the memory utilization for last 1 hour.For example, if the memory utilization reaches more than 10 MB at 9.15 am and the current memory utilization is 2 MB at 10 am, now i need to check whether the memory utilization is more than 9 MB between 9 am to 10 am
>
> kindly guide me how to construct the prometheus query for it, i think it is something like,
'(100 - ((node_memory_MemAvailable_bytes{job="jobname"} * 100) / node_memory_MemTotal_bytes{job="jobname"}))>9[1H]'
答案1
得分: 4
以下是您要翻译的内容:
"Probably you need SLI value answering the question: how much time the jobname
used more than 90% of memory over the last hour? Then the following PromQL query should answer the question:
((1 - node_memory_MemAvailable_bytes{job="jobname"} /
node_memory_MemTotal_bytes{job="jobname"}) >bool 0.9)[1h:1m]
)
The returned value will be in the range [0..1]
, where 0
means 0% (i.e. memory usage didn't exceed 90% during the last hour), while 1
means 100% (i.e. memory usage was higher than 90% all the time during the last hour).
The query uses the following PromQL features:
英文:
Probably you need SLI value answering the question: how much time the jobname
used more than 90% of memory over the last hour? Then the following PromQL query should answer the question:
avg_over_time(
((1 - node_memory_MemAvailable_bytes{job="jobname"} /
node_memory_MemTotal_bytes{job="jobname"}) >bool 0.9)[1h:1m]
)
The returned value will be in the range [0..1]
, where 0
means 0% (i.e. memory usage didn't exceed 90% during the last hour), while 1
means 100% (i.e. memory usage was higher than 90% all the time during the last hour).
The query uses the following PromQL features:
答案2
得分: 0
100 - ((node_memory_MemAvailable_bytes{job="jobname"} * 100) / node_memory_MemTotal_bytes{job="jobname"})[30m:1m]
这将列出每1分钟的内存利用率数值。
英文:
> 100 - ((node_memory_MemAvailable_bytes{job="jobname"} * 100) / node_memory_MemTotal_bytes{job="jobname"})[30m:1m]
>
> This will list the memory utilization values for every 1 minute
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论