Look at topk and bottomk 
<https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators>
.

*"I thought of combining two queries( Total CPU remaining cores and Total 
Unused memory) then we will get the value and we will sort it."*

That's fine.  If you can write a PromQL expression which calculates a 
combined value for "how much used" which is meaningful to you, then you can 
rank by that.

I think that the *percentage* CPU used and percentage memory used could be 
meaningfully combined, e.g. by returning the larger of the two, or a 
weighted average.  (Suppose you have one machine with 99% CPU used and 30% 
RAM, and another with 70% CPU and 70% RAM. Which do you want to appear on 
the top of the table?)

Build up your expression in parts, using the PromQL query browser in the 
prometheus web interface.

On Monday, 26 September 2022 at 16:10:57 UTC+1 chembakay...@gmail.com wrote:

> Hello All,
>
> I have 100 instances where I install node exporter and through Prometheus, 
> I am pulling those instances metrics. Now I want to find the least used 
> instances among those based on certain parameters like Total CPU cores, CPU 
> used, Total Memory, and Memory Used.
>
> For example, we will consider some of the values of the instance as below:
>
>
> [image: cpu.PNG]
>
> generally, we will high priority on cores and then memory. There are 64 
> cores, and 48 cores.. similarly, there are 251 GB, and 125 GB of memory.
>
> Considering all these parameters we have to assign ranks in such a way 
> that these servers are least used. 
>
> I thought of combining two queries( Total CPU remaining cores and Total 
> Unused memory) then we will get the value and we will sort it. But I don't 
> think it is the correct approach.
>
> Any leads?
>
> Thanks & regards,
> Bharath Kumar.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/8a324f4c-60b0-4c7d-aaee-623b6a21718dn%40googlegroups.com.

Reply via email to