Grafana dashboard: Pod Metrics for Azure Kubernetes Services | Azure Monitor | Azure Container Insights 
Description: Azure Monitor Container Insights - Pod and Container Metrics

Azure Monitor for Containers sources collection of metrics as part of monitoring an AKS cluster. Out of the box, we can get dashboards for Node Level and Namespace level metrics in Grafana through App Insights and Log Analytics. This dashboard helps us to visualize pod level and container metric. 




Azure Monitor for Containers sources collection of metrics as part of monitoring an AKS cluster. Out of the box, we can get dashboards for Node Level and Namespace level metrics in Grafana.
This dashboard helps us visualize Pod Metrics like CPU and memory in Grafana using Kusto Queries.


{
  "__inputs": [
    {
      "name": "DS_AZURE_MONITOR",
      "label": "Azure Monitor",
      "description": "",
      "type": "datasource",
      "pluginId": "grafana-azure-monitor-datasource",
      "pluginName": "Azure Monitor"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.5.7"
    },
    {
      "type": "datasource",
      "id": "grafana-azure-monitor-datasource",
      "name": "Azure Monitor",
      "version": "0.3.0"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Azure Monitor Container Insights - Pod and Container Metrics\n\nAzure Monitor for Containers sources collection of metrics as part of monitoring an AKS cluster. Out of the box, we can get dashboards for Node Level and Namespace level metrics in Grafana through App Insights and Log Analytics. This dashboard helps us to visualize pod level and container metric. \n\n\n",
  "editable": true,
  "gnetId": 14891,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1629363025169,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "datasource": null,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 18,
      "panels": [],
      "title": "Pod CPU",
      "type": "row"
    },
    {
      "datasource": "${DS_AZURE_MONITOR}",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "filterable": false
          },
          "decimals": 2,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Name"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 300
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "CpuLimit"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 80
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "CpuUsage"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 85
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 21,
        "w": 7,
        "x": 0,
        "y": 1
      },
      "id": 49,
      "options": {
        "showHeader": true
      },
      "pluginVersion": "7.5.7",
      "targets": [
        {
          "appInsights": {
            "dimension": "none",
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "timeColumn": "timestamp",
            "timeGrain": "auto",
            "valueColumn": ""
          },
          "azureLogAnalytics": {
            "query": "KubePodInventory\n| where TimeGenerated > ago(2m)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where TimeGenerated > ago(2m)\n    | where ObjectName == 'K8SContainer'\n    | where CounterName == 'cpuLimitNanoCores'\n    | where InstanceName contains '$AKS'\n    | extend ContainerNameParts = split(InstanceName, '/')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n    | summarize arg_max(TimeGenerated, *) by ContainerName\n    | project ContainerName, CpuLimit=CounterValue\n    | join kind = inner (\n        Perf\n        | where TimeGenerated > ago(2m)\n        | where ObjectName == 'K8SContainer'\n        | where CounterName == 'cpuUsageNanoCores'\n        | where InstanceName contains '$AKS'\n        | extend ContainerNameParts = split(InstanceName, '/')\n        | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n        | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n        | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n        | summarize arg_max(TimeGenerated, *) by ContainerName\n        | project TimeGenerated, ContainerName, CpuUsage=CounterValue\n    ) on ContainerName\n) on ContainerName\n| order by Name asc\n| project Name, CpuLimit=(CpuLimit / 1000000), CpuUsage=(CpuUsage / 1000000)",
            "resultFormat": "table",
            "workspace": "$Workspace"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "CPU Utlization - Current",
      "type": "table"
    },
    {
      "datasource": "${DS_AZURE_MONITOR}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "decimals": 2,
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 17,
        "x": 7,
        "y": 1
      },
      "id": 19,
      "options": {
        "graph": {},
        "legend": {
          "calcs": [
            "mean",
            "lastNotNull",
            "max",
            "min",
            "sum"
          ],
          "displayMode": "table",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.5.7",
      "targets": [
        {
          "appInsights": {
            "dimension": [
              "none"
            ],
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "timeColumn": "timestamp",
            "timeGrain": "auto",
            "valueColumn": ""
          },
          "azureLogAnalytics": {
            "query": "KubePodInventory\n| where $__timeFilter(TimeGenerated)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where $__timeFilter(TimeGenerated)\n    | where ObjectName == 'K8SContainer'\n    | where CounterName == 'cpuUsageNanoCores'\n    | where InstanceName contains '$AKS'\n    | extend ContainerNameParts = split(InstanceName, '/')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n    | project TimeGenerated, ContainerName, CounterValue\n) on ContainerName\n| order by TimeGenerated asc\n| project TimeGenerated, Name, CounterValue=(CounterValue / 1000000)",
            "resultFormat": "time_series",
            "workspace": "$Workspace"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "CPU Usage Per Pod ( in millicores )",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "Name"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_AZURE_MONITOR}",
      "fieldConfig": {
        "defaults": {
          "unit": "percent"
        },
        "overrides": []
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 11,
        "w": 17,
        "x": 7,
        "y": 11
      },
      "hiddenSeries": false,
      "id": 20,
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": true,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.5.7",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "appInsights": {
            "dimension": [
              "none"
            ],
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "timeColumn": "timestamp",
            "timeGrain": "auto",
            "valueColumn": ""
          },
          "azureLogAnalytics": {
            "query": "KubePodInventory\n| where $__timeFilter(TimeGenerated)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where $__timeFilter(TimeGenerated)\n    | where ObjectName == 'K8SContainer'\n    | where CounterName == 'cpuLimitNanoCores'\n    | where InstanceName contains '$AKS'\n    | extend ContainerNameParts = split(InstanceName, '/')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n    | summarize arg_max(TimeGenerated, *) by ContainerName\n    | project ContainerName, CpuLimit=CounterValue\n    | join kind = inner (\n        Perf\n        | where $__timeFilter(TimeGenerated)\n        | where ObjectName == 'K8SContainer'\n        | where CounterName == 'cpuUsageNanoCores'\n        | where InstanceName contains '$AKS'\n        | extend ContainerNameParts = split(InstanceName, '/')\n        | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n        | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n        | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n        | project TimeGenerated, ContainerName, CpuUsage=CounterValue\n    ) on ContainerName\n    | project TimeGenerated, ContainerName, CpuPercentage=(CpuUsage / CpuLimit) * 100\n) on ContainerName\n| order by TimeGenerated asc\n| project TimeGenerated, Name, CpuPercentage",
            "resultFormat": "time_series",
            "workspace": "$Workspace"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Percentaqe Pod CPU Usage over Pod CPU Limit",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "Name"
          }
        }
      ],
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:470",
          "decimals": 2,
          "format": "percent",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:471",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "collapsed": false,
      "datasource": null,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 22
      },
      "id": 22,
      "panels": [],
      "title": "Pod Memory Usage Metrics",
      "type": "row"
    },
    {
      "datasource": "${DS_AZURE_MONITOR}",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "filterable": false
          },
          "decimals": 2,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "bits"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Name"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 400
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "MemLimit"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 90
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "MemUsage"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 95
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 21,
        "w": 7,
        "x": 0,
        "y": 23
      },
      "id": 50,
      "options": {
        "showHeader": true
      },
      "pluginVersion": "7.5.7",
      "targets": [
        {
          "appInsights": {
            "dimension": "none",
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "timeColumn": "timestamp",
            "timeGrain": "auto",
            "valueColumn": ""
          },
          "azureLogAnalytics": {
            "query": "KubePodInventory\n| where TimeGenerated > ago(2m)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where TimeGenerated > ago(2m)\n    | where ObjectName == 'K8SContainer'\n    | where CounterName == 'memoryLimitBytes'\n    | where InstanceName contains '$AKS'\n    | extend ContainerNameParts = split(InstanceName, '/')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n    | summarize arg_max(TimeGenerated, *) by ContainerName\n    | project ContainerName, MemLimit=CounterValue\n) on ContainerName\n| order by Name asc\n| project Name, MemLimit",
            "resultFormat": "table",
            "workspace": "$Workspace"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Memory Usage (Current)",
      "type": "table"
    },
    {
      "datasource": "${DS_AZURE_MONITOR}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "decimals": 2,
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "bits"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 17,
        "x": 7,
        "y": 23
      },
      "id": 23,
      "options": {
        "graph": {},
        "legend": {
          "calcs": [
            "mean",
            "lastNotNull",
            "max",
            "min",
            "sum"
          ],
          "displayMode": "table",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.5.7",
      "targets": [
        {
          "appInsights": {
            "dimension": [
              "none"
            ],
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "timeColumn": "timestamp",
            "timeGrain": "auto",
            "valueColumn": ""
          },
          "azureLogAnalytics": {
            "query": "KubePodInventory\n| where $__timeFilter(TimeGenerated)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where $__timeFilter(TimeGenerated)\n    | where ObjectName == 'K8SContainer'\n    | where CounterName == 'memoryRssBytes'    \n    | where InstanceName contains '$AKS'\n    | extend ContainerNameParts = split(InstanceName, '/')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n    | project TimeGenerated, ContainerName, CounterValue\n) on ContainerName\n| order by TimeGenerated asc\n| project TimeGenerated, Name, CounterValue=(CounterValue)",
            "resultFormat": "time_series",
            "workspace": "$Workspace"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "RSS Memory Usage Per Pod",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "Name"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "datasource": "${DS_AZURE_MONITOR}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "bits"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 17,
        "x": 7,
        "y": 34
      },
      "id": 57,
      "options": {
        "graph": {},
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.5.7",
      "targets": [
        {
          "appInsights": {
            "dimension": [
              "none"
            ],
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "timeColumn": "timestamp",
            "timeGrain": "auto",
            "valueColumn": ""
          },
          "azureLogAnalytics": {
            "query": "KubePodInventory\n| where $__timeFilter(TimeGenerated)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where $__timeFilter(TimeGenerated)\n    | where ObjectName == 'K8SContainer'\n    | where CounterName == 'memoryWorkingSetBytes'    \n    | where InstanceName contains '$AKS'\n    | extend ContainerNameParts = split(InstanceName, '/')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n    | project TimeGenerated, ContainerName, CounterValue\n) on ContainerName\n| order by TimeGenerated asc\n| project TimeGenerated, Name, CounterValue=(CounterValue)",
            "resultFormat": "time_series",
            "workspace": "$Workspace"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Memory Working Set by Pod",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "Name"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "datasource": "${DS_AZURE_MONITOR}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "decimals": 2,
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 44
      },
      "id": 58,
      "options": {
        "graph": {},
        "legend": {
          "calcs": [
            "mean",
            "lastNotNull",
            "max",
            "min",
            "sum"
          ],
          "displayMode": "table",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.5.7",
      "targets": [
        {
          "appInsights": {
            "dimension": [
              "none"
            ],
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "timeColumn": "timestamp",
            "timeGrain": "auto",
            "valueColumn": ""
          },
          "azureLogAnalytics": {
            "query": "KubePodInventory\n| where $__timeFilter(TimeGenerated)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where $__timeFilter(TimeGenerated)\n    | where ObjectName == 'K8SContainer'\n    | where CounterName == 'memoryLimitBytes'\n    | where InstanceName contains '$AKS'\n    | extend ContainerNameParts = split(InstanceName, '/')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n    | summarize arg_max(TimeGenerated, *) by ContainerName\n    | project ContainerName, MemLimit=CounterValue\n    | join kind = inner (\n        Perf\n        | where $__timeFilter(TimeGenerated)\n        | where ObjectName == 'K8SContainer'\n        | where CounterName == 'memoryRssBytes'\n        | where InstanceName contains '$AKS'\n        | extend ContainerNameParts = split(InstanceName, '/')\n        | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n        | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n        | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n        | project TimeGenerated, ContainerName, MemUsage=CounterValue\n    ) on ContainerName\n    | project TimeGenerated, ContainerName, MemPercentage=(MemUsage / MemLimit) * 100\n) on ContainerName\n| order by TimeGenerated asc\n| project TimeGenerated, Name, MemPercentage",
            "resultFormat": "time_series",
            "workspace": "$Workspace"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Percentage Memory(RSS) Usage against Memory Limit",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "Name"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "datasource": "${DS_AZURE_MONITOR}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "decimals": 2,
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 44
      },
      "id": 24,
      "options": {
        "graph": {},
        "legend": {
          "calcs": [
            "mean",
            "lastNotNull",
            "max",
            "min",
            "sum"
          ],
          "displayMode": "table",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.5.7",
      "targets": [
        {
          "appInsights": {
            "dimension": [
              "none"
            ],
            "metricName": "select",
            "rawQuery": false,
            "rawQueryString": "",
            "timeColumn": "timestamp",
            "timeGrain": "auto",
            "valueColumn": ""
          },
          "azureLogAnalytics": {
            "query": "KubePodInventory\n| where $__timeFilter(TimeGenerated)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where $__timeFilter(TimeGenerated)\n    | where ObjectName == 'K8SContainer'\n    | where CounterName == 'memoryLimitBytes'\n    | where InstanceName contains '$AKS'\n    | extend ContainerNameParts = split(InstanceName, '/')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n    | summarize arg_max(TimeGenerated, *) by ContainerName\n    | project ContainerName, MemLimit=CounterValue\n    | join kind = inner (\n        Perf\n        | where $__timeFilter(TimeGenerated)\n        | where ObjectName == 'K8SContainer'\n        | where CounterName == 'memoryWorkingSetBytes'\n        | where InstanceName contains '$AKS'\n        | extend ContainerNameParts = split(InstanceName, '/')\n        | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n        | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n        | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n        | project TimeGenerated, ContainerName, MemUsage=CounterValue\n    ) on ContainerName\n    | project TimeGenerated, ContainerName, MemPercentage=(MemUsage / MemLimit) * 100\n) on ContainerName\n| order by TimeGenerated asc\n| project TimeGenerated, Name, MemPercentage",
            "resultFormat": "time_series",
            "workspace": "$Workspace"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Percentage Memory(Working Set) Usage against Memory Limit",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "Name"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "collapsed": true,
      "datasource": null,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 54
      },
      "id": 38,
      "panels": [
        {
          "datasource": "${DS_AZURE_MONITOR}",
          "fieldConfig": {
            "defaults": {
              "custom": {
                "align": "left"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green",
                    "value": null
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": [
              {
                "matcher": {
                  "id": "byName",
                  "options": "Node"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 318
                  }
                ]
              }
            ]
          },
          "gridPos": {
            "h": 7,
            "w": 24,
            "x": 0,
            "y": 9
          },
          "id": 40,
          "options": {
            "showHeader": true
          },
          "pluginVersion": "7.0.0",
          "targets": [
            {
              "appInsights": {
                "dimension": "none",
                "metricName": "select",
                "rawQuery": false,
                "rawQueryString": "",
                "timeColumn": "timestamp",
                "timeGrain": "auto",
                "valueColumn": ""
              },
              "azureLogAnalytics": {
                "query": "KubePodInventory\n| where TimeGenerated > ago(30m)\n| where ClusterName == \"$AKS\"\n| where Namespace == \"$Namespace\"\n| summarize arg_max(TimeGenerated, *) by Name\n| project Pod=Name, Namespace, PodStatus, Node=Computer, PodRestartCount, ContainerRestartCount, PodStartTime, ControllerKind",
                "resultFormat": "table",
                "workspace": "$Workspace"
              },
              "azureMonitor": {
                "aggOptions": [],
                "dimensionFilter": "*",
                "metricDefinition": "select",
                "metricName": "select",
                "metricNamespace": "select",
                "resourceGroup": "select",
                "resourceName": "select",
                "timeGrain": "auto",
                "timeGrains": [],
                "top": "10"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Overview",
          "type": "table"
        },
        {
          "aliasColors": {},
          "bars": true,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_AZURE_MONITOR}",
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 9,
            "w": 6,
            "x": 0,
            "y": 16
          },
          "hiddenSeries": false,
          "id": 42,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": false,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "dataLinks": []
          },
          "percentage": false,
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "appInsights": {
                "dimension": "none",
                "metricName": "select",
                "rawQuery": false,
                "rawQueryString": "",
                "timeColumn": "timestamp",
                "timeGrain": "auto",
                "valueColumn": ""
              },
              "azureLogAnalytics": {
                "query": "KubePodInventory\n| where TimeGenerated > ago(2m)\n| where ClusterName == \"$AKS\"\n| summarize arg_max(TimeGenerated, *) by Name\n| summarize qtd=count() by Namespace\n| project now(), Namespace, qtd",
                "resultFormat": "time_series",
                "workspace": "$Workspace"
              },
              "azureMonitor": {
                "aggOptions": [],
                "dimensionFilter": "*",
                "metricDefinition": "select",
                "metricName": "select",
                "metricNamespace": "select",
                "resourceGroup": "select",
                "resourceName": "select",
                "timeGrain": "auto",
                "timeGrains": [],
                "top": "10"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Pods per Namespaces",
          "tooltip": {
            "shared": false,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "series",
            "name": null,
            "show": false,
            "values": [
              "total"
            ]
          },
          "yaxes": [
            {
              "$$hashKey": "object:355",
              "decimals": 0,
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": true
            },
            {
              "$$hashKey": "object:356",
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_AZURE_MONITOR}",
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 0,
          "fillGradient": 0,
          "gridPos": {
            "h": 9,
            "w": 18,
            "x": 6,
            "y": 16
          },
          "hiddenSeries": false,
          "id": 44,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "nullPointMode": "null",
          "options": {
            "dataLinks": []
          },
          "percentage": false,
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "appInsights": {
                "dimension": "none",
                "metricName": "select",
                "rawQuery": false,
                "rawQueryString": "",
                "timeColumn": "timestamp",
                "timeGrain": "auto",
                "valueColumn": ""
              },
              "azureLogAnalytics": {
                "query": "KubePodInventory\n| where $__timeFilter(TimeGenerated)\n| where ClusterName == \"$AKS\"\n| summarize count() by TimeGenerated, Namespace\n| order by TimeGenerated asc",
                "resultFormat": "time_series",
                "workspace": "$Workspace"
              },
              "azureMonitor": {
                "aggOptions": [],
                "dimensionFilter": "*",
                "metricDefinition": "select",
                "metricName": "select",
                "metricNamespace": "select",
                "resourceGroup": "select",
                "resourceName": "select",
                "timeGrain": "auto",
                "timeGrains": [],
                "top": "10"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": "7b0bcc15-eef6-4181-b9fe-23bc213ce163"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Pod Count by Namespace",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        }
      ],
      "title": "Pod Overview",
      "type": "row"
    }
  ],
  "refresh": false,
  "schemaVersion": 27,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_AZURE_MONITOR}",
        "definition": "workspaces()",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "Workspace",
        "options": [],
        "query": "workspaces()",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_AZURE_MONITOR}",
        "definition": "ResourceGroups()",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "ResourceGroups",
        "options": [],
        "query": "ResourceGroups()",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_AZURE_MONITOR}",
        "definition": "ResourceNames($ResourceGroups, Microsoft.ContainerService/managedClusters)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "AKS",
        "options": [],
        "query": "ResourceNames($ResourceGroups, Microsoft.ContainerService/managedClusters)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_AZURE_MONITOR}",
        "definition": "KubePodInventory | where ClusterName == \"$AKS\" | summarize count() by Namespace | project Namespace",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "Namespace",
        "options": [],
        "query": "KubePodInventory | where ClusterName == \"$AKS\" | summarize count() by Namespace | project Namespace",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Pod Metrics for Azure Kubernetes Services | Azure Monitor | Azure Container Insights ",
  "uid": "rD8loTpLs",
  "version": 1
}