-
Notifications
You must be signed in to change notification settings - Fork 0
/
VM_Computer.cl
53 lines (33 loc) · 1.59 KB
/
VM_Computer.cl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#Gets the Virtual Machine data. Run this query in Azure Workspace Analytics
#Get VM data
VMComputer
| project Computer,DisplayName,DnsNames,Ipv4Addresses,OperatingSystemFamily,Cpus,AzureResourceGroup,AzureSize
#Get Operating system details
VMComputer
| summarize by Computer, OperatingSystemFamily, OperatingSystemFullName
#KQL Query to get the Azure VM Server properties
VMComputer
| summarize by Computer, AzureSize, Cpus,PhysicalMemoryMB,OperatingSystemFullName
#KQL Query to get IPv4 Address, IPv4 Default Gateway, and IPv4 Subnet Mask of the VM
VMComputer
| summarize by Computer, tostring(Ipv4Addresses), tostring(Ipv4DefaultGateways), tostring(Ipv4SubnetMasks)
//Get Disk space details,
InsightsMetrics
| where Namespace == "LogicalDisk"
| extend Tags = todynamic(Tags)
| extend Drive = tostring(Tags["vm.azm.ms/mountId"])
| extend diskSizeGB = Tags["vm.azm.ms/diskSizeMB"]/1024.0
| summarize avg_FreeSpacePercentage = avgif(Val, Name == 'FreeSpacePercentage'),avg_FreeSpaceGB = avgif(Val, Name == 'FreeSpaceMB') /1024,take_any(diskSizeGB) by Computer, Drive
// Or use these below query
InsightsMetrics
| where Origin == "vm.azm.ms"
and Namespace == "LogicalDisk" and Name == "FreeSpacePercentage"
| extend Disk=tostring(todynamic(Tags)["vm.azm.ms/mountId"])
| summarize Disk_Free_Space = avg(Val) by Computer, Disk, _ResourceId
| project Computer, Disk, Disk_Free_Space
//Get Process in a particual vm
VMProcess
| where Computer contains "VM1"
// KQL Query to get the VMProcess Executable Name and its Display Name and Group
VMProcess
| project ExecutableName, DisplayName, Group, ProductName