prometheus内存利用率查询需要指导
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
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]'
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
可能您需要 SLI value 回答以下问题:jobname
在过去一小时内有多少时间使用了超过 90% 的内存?那么下面的 PromQL 查询应该回答这个问题:
avg_over_time(
((1 - node_memory_MemAvailable_bytes{job="jobname"} /
node_memory_MemTotal_bytes{job="jobname"}) >bool 0.9)[1h:1m]
)
返回值将在 [0..1]
范围内,其中 0
表示 0%(即内存使用率在过去一小时内未超过 90%),而 1
表示 100%(即内存使用率在过去一小时内一直高于 90%)。
查询使用了以下 PromQL 功能:
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]'
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
可能您需要 SLI value 回答以下问题:jobname
在过去一小时内有多少时间使用了超过 90% 的内存?那么下面的 PromQL 查询应该回答这个问题:
avg_over_time(
((1 - node_memory_MemAvailable_bytes{job="jobname"} /
node_memory_MemTotal_bytes{job="jobname"}) >bool 0.9)[1h:1m]
)
返回值将在 [0..1]
范围内,其中 0
表示 0%(即内存使用率在过去一小时内未超过 90%),而 1
表示 100%(即内存使用率在过去一小时内一直高于 90%)。
查询使用了以下 PromQL 功能: