Forum Discussion
Perf counter
Hi Sunil, you didn't give a whole lot to go on, so I made some assumptions. This will get the % of memory in use over the last 24 hours bin by 1 hour and join it with CPU over the last 24 hours also bin by 24 hours.
//get % of memory last 24 hours bin time generated 1 hour
let AvgMem = Perf
| where ObjectName == "Memory"
and CounterName == "% Committed Bytes In Use"
and TimeGenerated < now(24h)
| summarize avg(CounterValue) by bin(TimeGenerated, 1h), Computer
| project AvgMemory=avg_CounterValue, Computer, TimeGenerated;
//end memory
//get % of CPU used 24 hours bin time generated 1 hour
let CPU = Perf
| where ObjectName == "Processor"
and InstanceName == "_Total"
and TimeGenerated < now(24h)
| summarize avg(CounterValue) by bin(TimeGenerated, 1h), Computer
| project AvgCPU = avg_CounterValue, Computer, TimeGenerated;
//end cpu
//Join CPU query with AvgMem query on Computer name column
CPU | join (AvgMem) on Computer
| project Computer, AvgCPU, AvgMemory, TimeGenerated
if you find you don't the counters i've used or you want to try different ones you can use the below to find out what counters you currently have in your environment.
Perf | distinct ObjectName, CounterName
sorry I forgot, once you're happy with the query and the data you can export the data to CSV as shown in the screen grab. or you can connect PowerBI.
- Sunil BommalaAug 30, 2018Copper Contributor
Thx for reply. I am looking for help with the query itself.
let startTimestamp = ago(1d);
Perf
| where ContainerName == "platformservices" and CounterName == "% Processor Time"
'where' operator: Failed to resolve column or scalar expression named 'ContainerName' Support id: 6676cddc-3db3-46ec-bab9-76aeddf5b402
- GouravINAug 31, 2018Brass Contributor
Hi There,
You can only get below things in Perf query as per schema of this query synatx. I am not sure if you can get any custom thing apart from this.
TenantId
Computer
ObjectName
CounterName
InstanceName
CounterValue
TimeGenerated [Central Time (US and Canada)]
SourceSystem - Aug 30, 2018
It looks like it can’t find the field “ContainerName” Make sure the case is correct and ContainerName is part of the Perf Schema.