Created
July 26, 2022 02:00
-
-
Save binura-g/b3f4820396a7dd9e45c95fa80cc09b38 to your computer and use it in GitHub Desktop.
Kusto-AKS Pod CPU Usage Graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let _Namespace = "Your namespace"; | |
let _ServiceName = "Your Deployment name"; | |
let _ContainerName = "Specific Container name"; // Only required if you have multiple containers running (eg. Sidecar) | |
KubePodInventory | |
| where isnotempty(Computer) // eliminate unscheduled pods | |
| where PodStatus in ('Running') | |
| where ServiceName has _ServiceName | |
| where ContainerName has _ContainerName | |
| where Namespace == _Namespace | |
| extend ContainerIdentifier=tostring(split(ContainerName, '/')[1]) | |
| extend InstanceName=strcat(ClusterId, '/', PodUid, '/', ContainerIdentifier) | |
| distinct Name, InstanceName | |
| join kind=inner | |
(Perf | |
| where ObjectName == 'K8SContainer' | |
| where CounterName == "cpuUsageNanoCores") | |
on InstanceName | |
| project CpuUsage=(CounterValue / 1e+9), TimeGenerated, Name | |
| render timechart; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment