Yes, anything is possible.  Just go ahead and write the query that does 
whatever you want.

I don't understand what logic you want to calculate this ranking value.  
It's up to you to decide on an algorithm, and then implement it in PromQL.  
Good luck.

On Wednesday, 28 September 2022 at 13:52:13 UTC+1 chembakay...@gmail.com 
wrote:

> Thanks for your reply. 
>
> But here I want to consider the CPU cores whose value is greater than 64 
> and usage is less and similar to memory whose value is highest and usage is 
> low.
>
> for example:[image: cpu_latest.PNG]
>
> The above is in the sorting order based on a weighted average of CPU and 
> memory percentages.
>
> But the first three instances' CPU cores are 32,24,24 which were less than 
> the next three instances. so I want to give priority to 64 cores than 24 or 
> 32 cores. So will it be possible to do that using any conditional operator 
> or any changes in the query?
>
> Thanks & regards,
> Bharath Kumar.
> On Tuesday, 27 September 2022 at 12:25:41 UTC+5:30 Brian Candler wrote:
>
>> 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/94278872-e596-40ad-bb3f-430fdcd6ed72n%40googlegroups.com.

Reply via email to