Forum Discussion
Daniel_Iten
Aug 08, 2022Copper Contributor
Monitoring CPU & GPU allocation for pods and vms
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?
- raindropsdevIron Contributor
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-log-analytics-workspaceOnce 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/