SOLVED

Query to use percentage of values

Copper Contributor

Hello guys,

I'm beginner in Azure and I started a project in Azure Log Analytics.
I sent different values in a Custom Log from a Logic App (HTTP Request).

aprhn_0-1583935345858.png

 


I have two values "cpu_used" and "cpu_limit" (Number type) and I want to create a query like :


Display when "cpu_used" is at 80% of "cpu_limit".

I tried many possibilities but I don't understand how to make this.

I don't understand anyway how to works summary percentile().

aprhn_1-1583935688835.png

The value doesn't change.

 

Thanks you in advance for your advises

 

Regards,

2 Replies
best response confirmed by aprhn (Copper Contributor)
Solution

@aprhn 

 

You should be able to do the math with KQL.  This is fake but should give you the idea 

 

Go to Log Analytics and run query

// example
Perf
| where ObjectName == "Processor" and InstanceName == "_Total"
| project CounterName , CounterValue , Computer
| summarize IdlePct = sumif(CounterValue, CounterName == "% Idle Time" ), UserTime = sumif(CounterValue, CounterName == "% User Time" ) by Computer
| summarize percentage = (sum(UserTime) / sum(IdlePct)) * 100
 
 

Hello Clive,

Thanks you ! I adapted your query and works fine :).

Regards,

Aurélien

1 best response

Accepted Solutions
best response confirmed by aprhn (Copper Contributor)
Solution

@aprhn 

 

You should be able to do the math with KQL.  This is fake but should give you the idea 

 

Go to Log Analytics and run query

// example
Perf
| where ObjectName == "Processor" and InstanceName == "_Total"
| project CounterName , CounterValue , Computer
| summarize IdlePct = sumif(CounterValue, CounterName == "% Idle Time" ), UserTime = sumif(CounterValue, CounterName == "% User Time" ) by Computer
| summarize percentage = (sum(UserTime) / sum(IdlePct)) * 100
 
 

View solution in original post