Hello,
If you are looking to see which of the connected VMs are having the Virtual Machines Insights enabled in Azure Monitor, you can run the following Kusto Query on the Workspace where the VMs are connected:
Heartbeat
| where Solutions contains "VMInsights"
| distinct Computer, OSType
When an agent is sending its heartbeat to the Workspace, beside other information, it will also provide a list of the solutions that are enabled on that agent.
That's why when you see VMInsights present in that Solutions property of the Heartbeat, it means that the agent was also enabled with VM Insights from Azure Monitor.
Hope it helps!
BR,
George