Forum Discussion
Monitor Azure Resource Only
- Jul 23, 2019
Another way is to use _ResourceId column as a way of finding which VMs are in Azure.
Currently all Azure VMs have _ResourceId so you can do:
Perf | where CounterName == "% Processor Time" and _ResourceId contains "virtualmachines"
Additionally I would like to point out that all your queries are written incorrectly. You do not filter on CounterValue. First you need to summarize and than filter the threshold on the desired value. If you will use the queries for alerts than you do not filter in the query at all as the threshold is applied via the alert configuration. If you do not follow these rules you will get false positive on alerts.
Hello Rahul_Mahajan
You can add a join to the Heartbeat table, as that has a Azure / non-Azure value. You'll need to do the same for the other two examples.
Heartbeat
| where ComputerEnvironment =="Azure"
| distinct Computer
| join (
Perf
| where CounterName == "% Processor Time"
and CounterValue > 95
and ObjectName == "Processor"
and InstanceName == "_Total"
| summarize arg_max(TimeGenerated, CounterValue) by Computer, CounterName
) on Computer
To test run it here Go to Log Analytics and Run Query