Forum Discussion
Syed_Aman
Jul 03, 2019Copper Contributor
CPU utilization for VMs in past 3 months in different time zone (PST) for Specific working hours
Hi Team, I need a help in getting the average CPU utilization for VMs in last 3 months in different time zone (PST) only for specific time range. i have written the query to fetch the average...
Syed_Aman
Jul 04, 2019Copper Contributor
CliveWatson Thanks a lot for the below query.
I had tested it in my environment but it is giving me the data in local timezone (IST) and i need to retrive the data for PST time zone from March to June 2019.
I tried changing the setting in Azure log Analytics workspace for timezone to UTC- 7:00 Pacific time.
But it is still giving the output in local timezone.
CliveWatson
Jul 04, 2019Former Employee
Go to Log Analytics and Run Query
let goBackDays = 7d;
Heartbeat
| where SubscriptionId != ''
| summarize by TenantId, SubscriptionId, Computer, ResourceGroup=tolower(ResourceGroup), ResourceId=tolower(ResourceId)
| join kind=inner
(
Perf
| extend UTCstartOfHours = startofday(now() -goBackDays) + 9hr // from 9am, nn days ago
| extend UTCendOfHours = startofday(now()) + 17hr // to 5pm
| where TimeGenerated between (UTCstartOfHours .. UTCendOfHours)
| where (ObjectName == "Processor" and CounterName == "% Processor Time")
| summarize CPUAvg = (avg(CounterValue)), startHr = min(UTCstartOfHours), endHr = max(UTCendOfHours) by Computer, TimeGenerated
)
on Computer
| extend PSTTimestampStart = startHr - 7h
| extend PSTTimestampEnd = endHr - 7h
| project Computer , CPUAvg, startHr, endHr, PSTTimestampStart, PSTTimestampEnd