Home

CPU utilization for VMs in past 3 months in different time zone (PST) for Specific working hours

%3CLINGO-SUB%20id%3D%22lingo-sub-736160%22%20slang%3D%22en-US%22%3ECPU%20utilization%20for%20VMs%20in%20past%203%20months%20in%20different%20time%20zone%20(PST)%20for%20Specific%20working%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-736160%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Team%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20a%20help%20in%20getting%20the%20average%20CPU%20utilization%20for%20VMs%20in%20last%203%20months%20in%20different%20time%20zone%20(PST)%20only%20for%20specific%20time%20range.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20have%20written%20the%20query%20to%20fetch%20the%20average%20CPU%20utilization%20for%20last%203%20months%20and%20i%20set%20the%20time%20range%20in%20portal%20option.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3EHeartbeat%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20SubscriptionId%20!%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E''%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BTenantId%2C%20SubscriptionId%2C%20Computer%2C%20ResourceGroup%3Dtolower(ResourceGroup)%2C%20ResourceId%3Dtolower(ResourceId)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20ResourceGroup%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22azrg-oc-ame-tds-vm%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ejoin%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bkind%3Dinner%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPerf%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20(ObjectName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22Processor%22%3C%2FSPAN%3E%20%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20CounterName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22%25%20Processor%20Time%22%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%20CPUAvg%20%3D%20(avg(CounterValue))%20%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%20Computer%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eon%3C%2FSPAN%3E%3CSPAN%3E%20Computer%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eproject%3C%2FSPAN%3E%3CSPAN%3E%20Computer%2C%20CPUAvg%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehow%20can%20i%20filter%20the%20CPU%20utilization%20only%20for%2012%20hours%5Cday%20in%20PST%20time%20zone%20for%20last%20three%20months.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-736160%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECustom%20Logs%20and%20Custom%20Fields%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-736572%22%20slang%3D%22en-US%22%3ERe%3A%20CPU%20utilization%20for%20VMs%20in%20past%203%20months%20in%20different%20time%20zone%20(PST)%20for%20Specific%20working%20hour%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-736572%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F319881%22%20target%3D%22_blank%22%3E%40Syed_Aman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELine%201%2C%20change%20to%20how%20many%20days%20to%20go%20back%26nbsp%3B%20-%20I%20used%207days%3C%2FP%3E%0A%3CP%3ELine%209%20%26amp%3B%2010%20-%20I%20assumed%20working%20hours%20of%26nbsp%3B%209%3A00%20thru%2017%3A00%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20goBackDays%20%3D%207d%3B%0AHeartbeat%0A%7C%20where%20SubscriptionId%20!%3D%20''%0A%7C%20summarize%20by%20TenantId%2C%20SubscriptionId%2C%20Computer%2C%20ResourceGroup%3Dtolower(ResourceGroup)%2C%20ResourceId%3Dtolower(ResourceId)%0A%2F%2F%7C%20where%20ResourceGroup%20%3D%3D%20%22azrg-oc-ame-tds-vm%22%0A%7C%20join%20kind%3Dinner%0A(%0APerf%0A%7C%20extend%20startOfHours%20%3D%20startofday(now()%20-goBackDays)%20%2B%209hr%20%20%20%2F%2F%20from%209am%2C%20nn%20days%20ago%0A%7C%20extend%20endOfHours%20%3D%20%20%20startofday(now())%20%20%20%20%20%2B%2017hr%20%20%20%20%20%20%20%20%20%20%2F%2F%20to%205pm%20%0A%7C%20where%20TimeGenerated%20between%20(startOfHours%20..%20endOfHours)%0A%7C%20where%20(ObjectName%20%3D%3D%20%22Processor%22%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22)%0A%7C%20summarize%20CPUAvg%20%3D%20(avg(CounterValue))%2C%20startHr%20%3D%20min(startOfHours)%2C%20endHr%20%3D%20max(endOfHours)%20by%20Computer%0A)%0Aon%20Computer%0A%7C%20project%20Computer%20%2C%20CPUAvg%2C%20startHr%2C%20endHr%3C%2FPRE%3E%0A%3CP%3ERun%20and%20test%20it%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fportal.loganalytics.io%2FDemo%3Fq%3DH4sIAAAAAAAAA2VSwW7bMAy9G%252FA%252FvAUYKqN2gx2Gohh82DKgyWUNtm532WJct5Fo0HLSFP34yV4ax6sAHcRHPj4%252BakseFX%252FT5dN3fWiR49p8iaMlafEFaR9Hr9g%252FkBB%252BdUVbSt34mt3K4EOOi4sebTtrtdQvhOKAe3La%252BZVJ%252F0tPsWDbdJ4kxU9quZOSboW7Jve85T2JmkSTMWtl3qWsTBJH8%252FmbsEkl8hwz%252FSJVxmWmLWXetNnOznqlj1w7PNXO5LVzJHGk4mhNsukxevbkDFof5r7bLANh78Xw5I3RB%252BV4rxJko1UJLnHzIADmc2yELW60TeEcTG%252BkrviMN9yRFe94E%252FTnEp%252BuB8LjCbye8bmxGLdwX1u6paBeezIoyO%252BJHNRE99XVWb9krFV3xSOV%252FkewZbBpLVxS27LMoIPGBXcuLOgEf8QpYWg7S6brXqx%252Ff91VYR6ld5U6Vv%252FR246SsL9B0VICbGs30RfAIO8fpJ%252FVmdT%252BB739kzgK7didvV%252FRCPcDnGJIjyJO7Y7UfwHEpNnZ1QIAAA%253D%253D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGo%20to%20Log%20Analytics%20and%20Run%20Query%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-737621%22%20slang%3D%22en-US%22%3ERe%3A%20CPU%20utilization%20for%20VMs%20in%20past%203%20months%20in%20different%20time%20zone%20(PST)%20for%20Specific%20working%20hour%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-737621%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3B%20Thanks%20a%20lot%20for%20the%20below%20query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20had%20tested%20it%20in%20my%20environment%20but%20it%20is%20giving%20me%20the%20data%20in%20local%20timezone%20(IST)%20and%20i%20need%20to%20retrive%20the%20data%20for%20PST%20time%20zone%20from%20March%20to%20June%202019.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20changing%20the%20setting%20in%20Azure%20log%20Analytics%20workspace%20for%20timezone%20to%20UTC-%207%3A00%20Pacific%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20it%20is%20still%20giving%20the%20output%20in%20local%20timezone.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-737632%22%20slang%3D%22en-US%22%3ERe%3A%20CPU%20utilization%20for%20VMs%20in%20past%203%20months%20in%20different%20time%20zone%20(PST)%20for%20Specific%20working%20hour%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-737632%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3B%20Thanks%20a%20lot%20for%20the%20below%20query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20had%20tested%20it%20in%20my%20environment%20but%20it%20is%20giving%20me%20the%20data%20in%20local%20timezone%20(IST)%20and%20i%20need%20to%20retrieve%20the%20data%20for%20PST%20time%20zone%20from%20March%20to%20June%202019.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20changing%20the%20setting%20in%20Azure%20log%20Analytics%20work%20space%20for%20timezone%20to%20UTC-%207%3A00%20Pacific%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20it%20is%20still%20giving%20the%20output%20in%20local%20timezone.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-738368%22%20slang%3D%22en-US%22%3ERe%3A%20CPU%20utilization%20for%20VMs%20in%20past%203%20months%20in%20different%20time%20zone%20(PST)%20for%20Specific%20working%20hour%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-738368%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F319881%22%20target%3D%22_blank%22%3E%40Syed_Aman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fportal.loganalytics.io%2FDemo%3Fq%3DH4sIAAAAAAAAA3VSTU%252FjMBS8R8p%252FmK2EcEQA7WFVoVUOuwXRXqDaFu5O%252FNoGar%252FIcShF%252FPi1S0lIK3yJnBnPx7PX5LDkv7J4vpbbGhmG6nccjUlal5N0cfSOzYosYdbkdWHLypVsJgo%252FMpyeBrRutJa2fCPkW8zJSOMmKj2gpxixrhpHNsU%252FqrmxBd1abqrM8Zo3ZEXvb9KxJuqIMlFJMH7i0uC5NCorjSEbRyKOpmQXAaNXR0bhYT6qnW9yvxj7k6HdbssLJbfC8EYkOO%252FKJzjD1coCuLzEwrLGldQpjIEKo5FL7kv7TyeMI%252BkEYZ3h53CnuV9e2jF%252BVRrdaOelplvyHaQjhZzchshAHKa%252FuOi7Jp2CuM%252BfqHB3UhOyDIOp5YLqmu0A0ocdcWP87Fv4BC1hZz5I%252Bjc5mj78eVn6VkK%252BLMX%252B9KNcN5T4q9mFGlsP69IcpvS4T%252FiBylfRDxyeSPcQerXjyGdg08JfRj2dzQPVu%252BhqFqw%252B79G74BzD1TfcG7%252BH537kQcetLIdptV5I943bbvsS6bF3emzxH1yPZ%252FRDAwAA%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGo%20to%20Log%20Analytics%20and%20Run%20Query%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3Elet%20goBackDays%20%3D%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EHeartbeat%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20SubscriptionId%20!%3D%20%3C%2FSPAN%3E%3CSPAN%3E''%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%20%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%20TenantId%2C%20SubscriptionId%2C%20Computer%2C%20ResourceGroup%3Dtolower(ResourceGroup)%2C%20ResourceId%3Dtolower(ResourceId)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ejoin%3C%2FSPAN%3E%3CSPAN%3E%20kind%3Dinner%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E(%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EPerf%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20UTCstartOfHours%20%3D%20startofday(now()%20-goBackDays)%20%2B%20%3C%2FSPAN%3E%3CSPAN%3E9%3C%2FSPAN%3E%3CSPAN%3Ehr%20%3C%2FSPAN%3E%3CSPAN%3E%2F%2F%20from%209am%2C%20nn%20days%20ago%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20UTCendOfHours%20%3D%20startofday(now())%20%2B%20%3C%2FSPAN%3E%3CSPAN%3E17%3C%2FSPAN%3E%3CSPAN%3Ehr%20%3C%2FSPAN%3E%3CSPAN%3E%2F%2F%20to%205pm%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20TimeGenerated%20between%20(UTCstartOfHours%20..%20UTCendOfHours)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20(ObjectName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22Processor%22%3C%2FSPAN%3E%20%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20CounterName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22%25%20Processor%20Time%22%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%20CPUAvg%20%3D%20(avg(CounterValue))%2C%20startHr%20%3D%20min(UTCstartOfHours)%2C%20endHr%20%3D%20max(UTCendOfHours)%20%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%20Computer%2C%20TimeGenerated%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Eon%3C%2FSPAN%3E%3CSPAN%3E%20Computer%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20PSTTimestampStart%20%3D%20startHr%20-%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Eh%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20PSTTimestampEnd%20%3D%20endHr%20-%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Eh%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eproject%3C%2FSPAN%3E%3CSPAN%3E%20Computer%20%2C%20CPUAvg%2C%20startHr%2C%20endHr%2C%20PSTTimestampStart%2C%20PSTTimestampEnd%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Syed_Aman
Occasional Contributor

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 CPU utilization for last 3 months and i set the time range in portal option.

 

Heartbeat
| where SubscriptionId != ''
| summarize by TenantId, SubscriptionId, Computer, ResourceGroup=tolower(ResourceGroup), ResourceId=tolower(ResourceId)
| where ResourceGroup == "azrg-oc-ame-tds-vm"
| join kind=inner
(
Perf
| where (ObjectName == "Processor" and CounterName == "% Processor Time")
| summarize CPUAvg = (avg(CounterValue)) by Computer
)
on Computer
| project Computer, CPUAvg

 

 

how can i filter the CPU utilization only for 12 hours\day in PST time zone for last three months.

 

Thanks in advance.

4 Replies

@Syed_Aman 

 

Line 1, change to how many days to go back  - I used 7days

Line 9 & 10 - I assumed working hours of  9:00 thru 17:00 

 

let goBackDays = 7d;
Heartbeat
| where SubscriptionId != ''
| summarize by TenantId, SubscriptionId, Computer, ResourceGroup=tolower(ResourceGroup), ResourceId=tolower(ResourceId)
//| where ResourceGroup == "azrg-oc-ame-tds-vm"
| join kind=inner
(
Perf
| extend startOfHours = startofday(now() -goBackDays) + 9hr   // from 9am, nn days ago
| extend endOfHours =   startofday(now())     + 17hr          // to 5pm 
| where TimeGenerated between (startOfHours .. endOfHours)
| where (ObjectName == "Processor" and CounterName == "% Processor Time")
| summarize CPUAvg = (avg(CounterValue)), startHr = min(startOfHours), endHr = max(endOfHours) by Computer
)
on Computer
| project Computer , CPUAvg, startHr, endHr

Run and test it here:

Go to Log Analytics and Run Query

 

 

 

 

@Clive Watson  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.

Highlighted

@Clive Watson  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 retrieve the data for PST time zone from March to June 2019.

 

I tried changing the setting in Azure log Analytics work space for timezone to UTC- 7:00 Pacific time.

 

But it is still giving the output in local timezone.

@Syed_Aman 

 

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
 
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies