Monitoring CPU & GPU allocation for pods and vms

Copper Contributor

Hi,

I'd like to monitor the creation of vms or AKS with large CPUs and/or with GPUs.

However, all info I seem to find regarding this is only about how to monitor CPU utlliization. 

How can I see with what cpu a resource has been created?

1 Reply

@Daniel_Iten 

First you need to send the Azure Activity logs to Log Analytics:
https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log?tabs=powershell#send-to...

Once that is done and you have the data you can use this query to gather the SKU the VM has been created with on a schedule:

AzureActivity
| where TimeGenerated > ago(7d)
| where ResourceProviderValue =~ "MICROSOFT.COMPUTE" and OperationNameValue =~ "MICROSOFT.COMPUTE/VIRTUALMACHINES/WRITE" and ActivitySubstatusValue =~ "Created"
| extend machinesku = tostring(parse_json(tostring(parse_json(tostring(parse_json(tostring(parse_json(Properties).responseBody)).properties)).hardwareProfile)).vmSize)
| project _ResourceId, machinesku

 

Reference links:

https://www.shudnow.io/2020/03/06/retrieving-activity-log-data-from-azure-log-analytics-part-2/

https://github.com/Azure/Azure-Sentinel/blob/master/Hunting%20Queries/AzureActivity/PortOpenedForAzu...