Grafana dashboard: Azure / Insights / Virtual Machines by Workspace
Description: This dashboard shows the performance and health of Azure Virtual Machines via different metrics collected by Azure Monitor VM Insights. Filter data by Workspace

Using Azure Monitor data source, this dashboard provides insights for VM monitoring through a number of VM Insights metrics. You will be able to access key details on metrics like CPU Utilization %, Available Memory, Network Bytes Sent, Network Bytes Received and Logical Disk Space Used %. Use this dashboard if you would like to filter data by workspace.

More information:
- [Set up Azure Monitor data source](https://grafana.com/docs/grafana/next/datasources/azuremonitor/)
- [Azure Monitor](https://docs.microsoft.com/en-us/azure/azure-monitor/)

Send your feedback to [azmongrafana@microsoft.com](mailto:azmongrafana@microsoft.com)

{
  "__inputs": [],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.4.3"
    },
    {
      "type": "datasource",
      "id": "grafana-azure-monitor-datasource",
      "name": "Azure Monitor",
      "version": "0.3.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "description": "This dashboard shows the performance and health of Azure Virtual Machines via different metrics collected by Azure Monitor VM Insights. Filter data by Workspace",
  "editable": true,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "gridPos": {
        "h": 5,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 54,
      "options": {
        "content": "<div style=\"padding: 1em; text-align: center\">\n    <p>Welcome to the Azure Monitor data source for Grafana. To learn more about it, visit our <a href=\"https://grafana.com/docs/grafana/latest/datasources/azuremonitor/\" target=\"__blank\">docs</a>.  </p>\n  <p>  Choose the resource group(s) with VMs enabled with Azure Monitor VM Insights and related Workspace to get started.</p>\n</div>",
        "mode": "markdown"
      },
      "title": "How to activate this dashboard",
      "type": "text"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "id": 28,
      "panels": [],
      "title": "CPU Utilization %",
      "type": "row"
    },
    {
      "datasource": {
        "uid": "${ds}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisGridShow": true,
            "axisLabel": "",
            "axisPlacement": "auto",
            "axisSoftMax": 100,
            "axisSoftMin": 0,
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 6
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "azureLogAnalytics": {
            "query": "let startDateTime = $__timeFrom;\nlet endDateTime = $__timeTo;\nlet trendBinSize = (endDateTime - startDateTime)/100;\nlet summary = InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'Processor' and Name == 'UtilizationPercentage')\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\n| where resGroup in~ ($rg)\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| summarize hint.shufflekey=ComputerId $agg by ComputerId, Computer| top 10 by score;\nlet computerList=(summary\n| project ComputerId, Computer);\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \nlet OmsNodeIdentityAndProps = computerList        \n| extend NodeId = ComputerId        \n| extend Priority = 1        \n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \nlet ServiceMapNodeIdentityAndProps = VMComputer        \n| where TimeGenerated >= startDateTime        \n| where TimeGenerated < endDateTime        \n| extend ResourceId = strcat('machines/', Machine)         \n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachine`alesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\n | extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \n | where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \n | extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \n | summarize arg_max(TimeGenerated, *) by Machine        \n | extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName), strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''), AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName), strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''), ComputerProps = pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \n | project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \n let NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \n | summarize arg_max(Priority, *) by ComputerId;\n summary\n | join (InsightsMetrics    \n | where TimeGenerated between (startDateTime .. endDateTime)    \n | where Origin == 'vm.azm.ms' and (Namespace == 'Processor' and Name == 'UtilizationPercentage')    \n | extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)    \n | where ComputerId in (computerList)    \n | summarize $agg by bin(TimeGenerated, trendBinSize), ComputerId   \n | sort by TimeGenerated asc) on ComputerId",
            "resource": "$ws",
            "resultFormat": "table",
            "workspace": ""
          },
          "hide": false,
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub",
          "subscriptions": []
        }
      ],
      "title": "${agg:text} CPU Utilization %",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "ComputerId": true,
              "ComputerId1": true,
              "P5th": true,
              "P95th": true,
              "score": true
            },
            "indexByName": {},
            "renameByName": {}
          }
        },
        {
          "id": "prepareTimeSeries",
          "options": {
            "format": "many"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "(.+)\\s(.+)",
            "renamePattern": "$2"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-azure-monitor-datasource",
        "uid": "${ds}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Computer"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "targetBlank": true,
                    "title": "",
                    "url": "https://ms.portal.azure.com/#@${__data.fields[\"Tenant ID\"]}/resource/subscriptions/?${sub}?/resourcegroups/${__data.fields[\"Resource Group\"]}/providers/microsoft.compute/?${__data.fields.Type}?/${__data.fields[\"Resource Name\"]}/infrainsights"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Average"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 76
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "P50th"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 77
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "P90th"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 75
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "P95th"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 72
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Max"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 78
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 12,
        "w": 14,
        "x": 0,
        "y": 16
      },
      "id": 26,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 1,
        "showHeader": true,
        "sortBy": []
      },
      "targets": [
        {
          "azureLogAnalytics": {
            "query": "\r\nlet startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize = 5m;\r\nlet summaryPerComputer = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Processor' and Name == 'UtilizationPercentage')  \r\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resourceGroup '/p(.+)' *\t\r\n| where resourceGroup in~ ($rg)  \r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| summarize hint.shufflekey = ComputerId Average = round(avg(Val), 2), Max = max(Val), percentiles(Val, 5, 10, 50, 80, 90, 95) by ComputerId, Computer, _ResourceId\r\n| project ComputerId, Computer, Average, Max, P5th = percentile_Val_5, P10th = percentile_Val_10, P50th = percentile_Val_50, P80th = percentile_Val_80, P90th = percentile_Val_90, P95th = percentile_Val_95, ResourceId = _ResourceId\r\n| top 10 by ${agg:text};\r\nlet computerList = summaryPerComputer\r\n| summarize by ComputerId, Computer;\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'',     replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',     @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))    \r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName), strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''), AzureScaleSetNodeIdentity = iif(isnotempty\r\n(AzureVmScaleSetName), strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''), ComputerProps = pack('type', 'StandAloneNode', 'name', DisplayName, 'mappingResourceId', \r\nResourceId, 'subscriptionId', AzureSubscriptionId, 'resourceGroup', AzureResourceGroup, 'azureResourceId', _ResourceId), AzureCloudServiceNodeProps =  pack('type', 'AzureCloudServiceNode',\r\n'cloudServiceInstanceId', AzureCloudServiceInstanceId, 'cloudServiceRoleName', AzureCloudServiceRoleName, 'cloudServiceDeploymentId', AzureCloudServiceDeployment, 'fullDisplayName', FullDisplayName,'cloudServiceName', AzureCloudServiceName, 'mappingResourceId', ResourceId), AzureScaleSetNodeProps = pack('type', 'AzureScaleSetNode', 'scaleSetInstanceId', AzureResourceName, 'vmScaleSetDeploymentId', \r\nAzureVmScaleSetDeployment, 'vmScaleSetName', AzureVmScaleSetName, 'serviceFabricClusterName', AzureServiceFabricClusterName, 'vmScaleSetResourceId', AzureVmScaleSetResourceId, 'resourceGroupName', \r\nAzureResourceGroup, 'subscriptionId', AzureSubscriptionId, 'fullDisplayName', FullDisplayName, 'mappingResourceId', ResourceId)        \r\n| project   ComputerId, Computer, NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity, isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity,\r\nComputer), NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps, isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps), Priority = 2;\r\nlet NodeIdentityAndProps = union kind=inner isfuzzy = true EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps\r\n| summarize arg_max(Priority, *) by ComputerId;\r\nlet trend = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Processor' and Name == 'UtilizationPercentage')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)\r\n| project ComputerId, Computer\r\n| summarize hint.shufflekey = ComputerId by ComputerId, Computer;\r\nsummaryPerComputer\r\n| join ( trend ) on ComputerId\r\n| join ( NodeIdentityAndProps ) on ComputerId\r\n| parse tolower(ResourceId) with * \"virtualmachinescalesets/\" scaleSetName \"/virtualmachines/\" vmNameScale\r\n| parse tolower(ResourceId) with * \"virtualmachines/\" vmName\r\n| parse tolower(ResourceId) with * \"resourcegroups/\" resourceGroup \"/providers/microsoft.compute/\" typeVM \"/\" nameVM\r\n| parse tolower(ResourceId) with * \"microsoft.compute/\" typeScale \"/\" nameScale \"/virtualmachines\" remaining\r\n| project resourceGroup, Average, P50th, P90th, P95th, Max, Computer, Type = iff(isnotempty(typeScale), typeScale, typeVM), Name = iff(isnotempty(nameScale), nameScale, nameVM)",
            "resource": "$ws",
            "resultFormat": "table"
          },
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "hide": false,
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": ""
        },
        {
          "azureResourceGraph": {
            "query": "resources\r\n| where tolower(type) contains \"virtualmachines\" and resourceGroup in~ ($rg) \r\n| project Name = tolower(name), tenantId, resourceGroup"
          },
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "hide": false,
          "queryType": "Azure Resource Graph",
          "refId": "B",
          "subscription": "",
          "subscriptions": [
            "$sub"
          ]
        }
      ],
      "title": "CPU Utilization % Statistics",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Max": false,
              "NodeId": false,
              "NodeProps": false,
              "P50th": false,
              "ResourceId": false,
              "name 2": true
            },
            "indexByName": {
              "Average": 2,
              "Computer": 0,
              "Max": 6,
              "Name": 8,
              "P50th": 3,
              "P90th": 4,
              "P95th": 5,
              "Type": 7,
              "resourceGroup": 1,
              "tenantId": 9
            },
            "renameByName": {
              "Column1": "Computer",
              "Name": "Resource Name",
              "ResourceId": "Resource ID",
              "UseRelativeScale": "",
              "list_TrendPoint": "95th Trend",
              "resGroup": "Resource Group",
              "resourceGroup": "Resource Group",
              "tenantId": "Tenant ID",
              "typeName": "Type/Name"
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "isNotNull",
                  "options": {}
                },
                "fieldName": "Computer"
              }
            ],
            "match": "all",
            "type": "include"
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "grafana-azure-monitor-datasource",
        "uid": "${ds}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "light-green",
            "mode": "fixed"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 10,
        "x": 14,
        "y": 16
      },
      "id": 46,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "max"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "targets": [
        {
          "azureLogAnalytics": {
            "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize = (endDateTime - startDateTime)/100;\r\nlet summary = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Processor' and Name == 'UtilizationPercentage')\r\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\r\n| where resGroup in~ ($rg)\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| summarize hint.shufflekey=ComputerId Average = avg(Val), Min = min(Val),P5th = round(percentile(Val, 5), 2), P10th = round(percentile(Val, 10), 2), \r\nP50th = round(percentile(Val, 50), 2), P80th = round(percentile(Val, 80), 2),\r\nP90th = round(percentile(Val, 90), 2), P95th = round(percentile(Val, 95), 2) by ComputerId, Computer\r\n| top 10 by ${agg:text};\r\nlet computerList=(summary\r\n| project ComputerId, Computer);\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachine`alesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\r\n | extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n | where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n | extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n | summarize arg_max(TimeGenerated, *) by Machine        \r\n | extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName), strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''), AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName), strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''), ComputerProps = pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n | project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \r\n let NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n | summarize arg_max(Priority, *) by ComputerId;\r\n summary\r\n | join (InsightsMetrics    \r\n | where TimeGenerated between (startDateTime .. endDateTime)    \r\n | where Origin == 'vm.azm.ms' and (Namespace == 'Processor' and Name == 'UtilizationPercentage')    \r\n | extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)    \r\n | where ComputerId in (computerList)    \r\n | summarize Max = max(Val) by bin(TimeGenerated, trendBinSize), ComputerId  \r\n | sort by TimeGenerated asc) on ComputerId",
            "resource": "$ws",
            "resultFormat": "table"
          },
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": ""
        }
      ],
      "title": "Max CPU Utilization % and trend lines",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Average": true,
              "Computer": false,
              "ComputerId": true,
              "ComputerId1": true,
              "Min": true,
              "P10th": true,
              "P50th": true,
              "P5th": true,
              "P80th": true,
              "P90th": true,
              "P95th": true,
              "score": false
            },
            "indexByName": {},
            "renameByName": {}
          }
        },
        {
          "id": "prepareTimeSeries",
          "options": {
            "format": "many"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "(.+)\\s(.+)",
            "renamePattern": "$2"
          }
        }
      ],
      "type": "stat"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 28
      },
      "id": 30,
      "panels": [
        {
          "datasource": {
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "palette-classic"
              },
              "custom": {
                "axisGridShow": true,
                "axisLabel": "",
                "axisPlacement": "auto",
                "axisSoftMin": 0,
                "barAlignment": 0,
                "drawStyle": "line",
                "fillOpacity": 0,
                "gradientMode": "none",
                "hideFrom": {
                  "legend": false,
                  "tooltip": false,
                  "viz": false
                },
                "lineInterpolation": "linear",
                "lineWidth": 1,
                "pointSize": 5,
                "scaleDistribution": {
                  "type": "linear"
                },
                "showPoints": "never",
                "spanNulls": true,
                "stacking": {
                  "group": "A",
                  "mode": "none"
                },
                "thresholdsStyle": {
                  "mode": "off"
                }
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              },
              "unit": "decmbytes"
            },
            "overrides": []
          },
          "gridPos": {
            "h": 10,
            "w": 24,
            "x": 0,
            "y": 7
          },
          "id": 8,
          "options": {
            "legend": {
              "calcs": [],
              "displayMode": "list",
              "placement": "bottom"
            },
            "tooltip": {
              "mode": "single",
              "sort": "none"
            }
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\nlet endDateTime = $__timeTo;\nlet trendBinSize =  (endDateTime - startDateTime)/100;\nlet summary = InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'Memory' and Name == 'AvailableMB')\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\n| where resGroup in~ ($rg)\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| summarize hint.shufflekey=ComputerId $agg by ComputerId, Computer\n| top 10 by score;\nlet computerList=(summary\n| project ComputerId, Computer);\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \nlet OmsNodeIdentityAndProps = computerList        \n| extend NodeId = ComputerId        \n| extend Priority = 1        \n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \nlet ServiceMapNodeIdentityAndProps = VMComputer        \n| where TimeGenerated >= startDateTime        \n|where TimeGenerated < endDateTime        \n| extend ResourceId = strcat('machines/', Machine)         \n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \n| summarize arg_max(TimeGenerated, *) by Machine        \n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \nlet NodeIdentityAndProps = union kind=inner isfuzzy = true  EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \n| summarize arg_max(Priority, *) by ComputerId;\nsummary\n| join (InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'Memory' and Name == 'AvailableMB')\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| where ComputerId in (computerList)\n| summarize $agg by bin(TimeGenerated, trendBinSize), ComputerId\n| sort by TimeGenerated asc) on ComputerId\n",
                "resource": "$ws",
                "resultFormat": "table",
                "workspace": ""
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": "",
              "subscriptions": []
            }
          ],
          "title": "${agg:text} Available Memory",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "ComputerId": true,
                  "ComputerId1": true,
                  "P5th": true,
                  "P95th": true,
                  "score": true
                },
                "indexByName": {},
                "renameByName": {}
              }
            },
            {
              "id": "prepareTimeSeries",
              "options": {
                "format": "many"
              }
            },
            {
              "id": "renameByRegex",
              "options": {
                "regex": "(.+)\\s(.+)",
                "renamePattern": "$2"
              }
            }
          ],
          "type": "timeseries"
        },
        {
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "align": "auto",
                "displayMode": "auto"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": [
              {
                "matcher": {
                  "id": "byName",
                  "options": "Min"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 81
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P5th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 99
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P10th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 77
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P50th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 91
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Average"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 78
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Computer"
                },
                "properties": [
                  {
                    "id": "links",
                    "value": [
                      {
                        "targetBlank": true,
                        "title": "",
                        "url": "https://ms.portal.azure.com/#@${__data.fields[\"Tenant ID\"]}/resource/subscriptions/${sub}?/resourcegroups/${__data.fields[\"Resource Group\"]}/providers/microsoft.compute/?${__data.fields.Type}/${__data.fields[\"Resource Name\"]}?/infrainsights"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          "gridPos": {
            "h": 12,
            "w": 14,
            "x": 0,
            "y": 17
          },
          "id": 32,
          "options": {
            "footer": {
              "fields": "",
              "reducer": [
                "sum"
              ],
              "show": false
            },
            "showHeader": true,
            "sortBy": []
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet maxResultCount = 10;\r\nlet summaryPerComputer = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Memory' and Name == 'AvailableMB')\r\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\r\n| where resGroup in~ ($rg)\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| summarize hint.shufflekey = ComputerId Average = round(avg(Val), 2), Min = min(Val), percentiles(Val, 5, 10, 50, 80, 90, 95) by ComputerId, Computer, _ResourceId\r\n| project ComputerId, Computer, Average, Min, P5th = percentile_Val_5, P10th = percentile_Val_10, P50th = percentile_Val_50, P80th = percentile_Val_80,\r\nP90th = percentile_Val_90, P95th = percentile_Val_95, ResourceId = _ResourceId\r\n| top 10 by ${agg:text};\r\nlet computerList = summaryPerComputer\r\n| summarize by ComputerId, Computer;\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'',     replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',     @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))    \r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \r\nlet NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n| summarize arg_max(Priority, *) by ComputerId;\r\nlet trend = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Memory' and Name == 'AvailableMB')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)\r\n| project ComputerId, Computer;\r\nsummaryPerComputer\r\n| join ( trend ) on ComputerId\r\n| join ( NodeIdentityAndProps ) on ComputerId\r\n| parse tolower(ResourceId) with * \"virtualmachinescalesets/\" scaleSetName \"/virtualmachines/\" vmNameScale\r\n| parse tolower(ResourceId) with * \"virtualmachines/\" vmName\r\n| parse tolower(ResourceId) with * \"resourcegroups/\" resourceGroup \"/providers/microsoft.compute/\" typeVM \"/\" nameVM\r\n| parse tolower(ResourceId) with * \"microsoft.compute/\" typeScale \"/\" nameScale \"/virtualmachines\" remaining\r\n| project resourceGroup, Min, Average, P5th, P10th, P50th, Computer, Type = iff(isnotempty(typeScale), typeScale, typeVM), Name = iff(isnotempty(nameScale), nameScale, nameVM)\r\n",
                "resource": "$ws",
                "resultFormat": "table"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": ""
            },
            {
              "azureResourceGraph": {
                "query": "resources\r\n| where tolower(type) contains \"virtualmachines\" and resourceGroup in~ ($rg) \r\n| project Name = tolower(name), tenantId, resourceGroup"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "hide": false,
              "queryType": "Azure Resource Graph",
              "refId": "B",
              "subscription": "",
              "subscriptions": [
                "$sub"
              ]
            }
          ],
          "title": "Available Memory Statistics",
          "transformations": [
            {
              "id": "merge",
              "options": {}
            },
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "NodeId": true,
                  "NodeProps": true,
                  "ResourceId": true,
                  "UseRelativeScale": true,
                  "list_TrendPoint": true
                },
                "indexByName": {
                  "Average": 6,
                  "Computer": 0,
                  "Min": 2,
                  "Name": 8,
                  "P10th": 4,
                  "P50th": 5,
                  "P5th": 3,
                  "Type": 7,
                  "resourceGroup": 1,
                  "tenantId": 9
                },
                "renameByName": {
                  "Name": "Resource Name",
                  "list_TrendPoint": "P5th Trend",
                  "resGroup": "Resource Group",
                  "resourceGroup": "Resource Group",
                  "tenantId": "Tenant ID",
                  "typeName": "Type/Name"
                }
              }
            },
            {
              "id": "filterByValue",
              "options": {
                "filters": [
                  {
                    "config": {
                      "id": "isNotNull",
                      "options": {}
                    },
                    "fieldName": "Computer"
                  }
                ],
                "match": "all",
                "type": "include"
              }
            }
          ],
          "type": "table"
        },
        {
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "fixedColor": "light-green",
                "mode": "fixed"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": []
          },
          "gridPos": {
            "h": 12,
            "w": 10,
            "x": 14,
            "y": 17
          },
          "id": 44,
          "options": {
            "colorMode": "value",
            "graphMode": "area",
            "justifyMode": "auto",
            "orientation": "auto",
            "reduceOptions": {
              "calcs": [
                "min"
              ],
              "fields": "",
              "values": false
            },
            "text": {},
            "textMode": "value_and_name"
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize =  (endDateTime - startDateTime)/100;\r\nlet summary = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Memory' and Name == 'AvailableMB')\r\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\r\n| where resGroup in~ ($rg)\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| summarize hint.shufflekey=ComputerId Average = avg(Val), Min = min(Val),P5th = round(percentile(Val, 5), 2), P10th = round(percentile(Val, 10), 2), \r\nP50th = round(percentile(Val, 50), 2), P80th = round(percentile(Val, 80), 2),\r\nP90th = round(percentile(Val, 90), 2), P95th = round(percentile(Val, 95), 2) by ComputerId, Computer\r\n| top 10 by ${agg:text};\r\nlet computerList=(summary\r\n| project ComputerId, Computer);\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n|where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \r\nlet NodeIdentityAndProps = union kind=inner isfuzzy = true  EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n| summarize arg_max(Priority, *) by ComputerId;\r\nsummary\r\n| join (InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Memory' and Name == 'AvailableMB')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)\r\n| summarize Min = min(Val) by bin(TimeGenerated, trendBinSize), ComputerId\r\n| sort by TimeGenerated asc) on ComputerId\r\n",
                "resource": "$ws",
                "resultFormat": "table"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A"
            }
          ],
          "title": "Min Available Memory and Trend Line",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "Average": true,
                  "ComputerId": true,
                  "ComputerId1": true,
                  "Min": true,
                  "P10th": true,
                  "P50th": true,
                  "P5th": true,
                  "P80th": true,
                  "P90th": true,
                  "P95th": true
                },
                "indexByName": {},
                "renameByName": {}
              }
            },
            {
              "id": "prepareTimeSeries",
              "options": {
                "format": "many"
              }
            },
            {
              "id": "renameByRegex",
              "options": {
                "regex": "(.+)\\s(.+)",
                "renamePattern": "$2"
              }
            }
          ],
          "type": "stat"
        }
      ],
      "title": "Available Memory",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 29
      },
      "id": 22,
      "panels": [
        {
          "datasource": {
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "palette-classic"
              },
              "custom": {
                "axisGridShow": true,
                "axisLabel": "",
                "axisPlacement": "auto",
                "axisSoftMin": 0,
                "barAlignment": 0,
                "drawStyle": "line",
                "fillOpacity": 0,
                "gradientMode": "none",
                "hideFrom": {
                  "legend": false,
                  "tooltip": false,
                  "viz": false
                },
                "lineInterpolation": "linear",
                "lineWidth": 1,
                "pointSize": 5,
                "scaleDistribution": {
                  "type": "linear"
                },
                "showPoints": "never",
                "spanNulls": true,
                "stacking": {
                  "group": "A",
                  "mode": "none"
                },
                "thresholdsStyle": {
                  "mode": "off"
                }
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              },
              "unit": "Bps"
            },
            "overrides": []
          },
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 8
          },
          "id": 12,
          "options": {
            "legend": {
              "calcs": [],
              "displayMode": "list",
              "placement": "bottom"
            },
            "tooltip": {
              "mode": "single",
              "sort": "none"
            }
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\nlet endDateTime = $__timeTo;\nlet trendBinSize = (endDateTime - startDateTime)/100;\nlet MaxListSize = 1000;\nlet summary = InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'WriteBytesPerSecond')\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\n| where resGroup in~ ($rg)\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| summarize Val = sum(Val) by bin(TimeGenerated, trendBinSize), ComputerId, Computer\n| summarize hint.shufflekey=ComputerId $agg by ComputerId, Computer\n| top 10 by score;\nlet computerList=(summary\n| project ComputerId, Computer);\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \nlet OmsNodeIdentityAndProps = computerList        \n| extend NodeId = ComputerId        \n| extend Priority = 1        \n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        let ServiceMapNodeIdentityAndProps = VMComputer        \n| where TimeGenerated >= startDateTime        \n| where TimeGenerated < endDateTime        \n| extend ResourceId = strcat('machines/', Machine)         \n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \n| summarize arg_max(TimeGenerated, *) by Machine        \n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        let NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \n| summarize arg_max(Priority, *) by ComputerId;summary\n| join (InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'WriteBytesPerSecond')\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| where ComputerId in (computerList)\n| summarize Val = sum(Val) by bin(TimeGenerated, trendBinSize), ComputerId, Computer\n| summarize $agg by bin(TimeGenerated, trendBinSize), ComputerId\n| sort by TimeGenerated asc) on ComputerId\n",
                "resource": "$ws",
                "resultFormat": "table",
                "workspace": ""
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": "",
              "subscriptions": []
            }
          ],
          "title": "${agg:text} Bytes Sent Rate",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "Computer": false,
                  "ComputerId": true,
                  "ComputerId1": true,
                  "P5th": true,
                  "P95th": true,
                  "score": true
                },
                "indexByName": {},
                "renameByName": {}
              }
            },
            {
              "id": "prepareTimeSeries",
              "options": {
                "format": "many"
              }
            },
            {
              "id": "renameByRegex",
              "options": {
                "regex": "(.+)\\s(.+)",
                "renamePattern": "$2"
              }
            }
          ],
          "type": "timeseries"
        },
        {
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "align": "auto",
                "displayMode": "auto"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": [
              {
                "matcher": {
                  "id": "byName",
                  "options": "Computer"
                },
                "properties": [
                  {
                    "id": "links",
                    "value": [
                      {
                        "targetBlank": true,
                        "title": "",
                        "url": "https://ms.portal.azure.com/#@${__data.fields[\"Tenant ID\"]}/resource/subscriptions/${sub}/resourcegroups/${__data.fields[\"Resource Group\"]}/providers/microsoft.compute/${__data.fields.Type}/${__data.fields[\"Resource Name\"]}/infrainsights"
                      }
                    ]
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Average"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 94
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P50th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 86
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P90th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 101
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P95th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 97
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Max"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 131
                  }
                ]
              }
            ]
          },
          "gridPos": {
            "h": 12,
            "w": 14,
            "x": 0,
            "y": 19
          },
          "id": 34,
          "options": {
            "footer": {
              "fields": "",
              "reducer": [
                "sum"
              ],
              "show": false
            },
            "showHeader": true,
            "sortBy": []
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize = 5m;\r\nlet maxResultCount = 10;\r\nlet summaryPerComputer = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'WriteBytesPerSecond')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| summarize Val = sum(Val) by bin(TimeGenerated, 1m), ComputerId, Computer, _ResourceId\r\n| summarize hint.shufflekey = ComputerId Average = avg(Val), Max = max(Val), percentiles(Val, 5, 10, 50, 90, 95) by ComputerId, Computer, _ResourceId\r\n| project ComputerId, Computer, Average, Max, P5th = percentile_Val_5, P10th = percentile_Val_10, P50th = percentile_Val_50, P90th = percentile_Val_90, P95th = percentile_Val_95, ResourceId = _ResourceId\r\n| top 10 by ${agg:text};\r\nlet computerList = summaryPerComputer\r\n| summarize by ComputerId, Computer;\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'',     replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',     @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))    \r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \r\nlet NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n| summarize arg_max(Priority, *) by ComputerId;\r\nlet trend = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'WriteBytesPerSecond')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)\r\n| summarize Val = sum(Val) by bin(TimeGenerated, 1m), ComputerId, Computer, _ResourceId\r\n| summarize hint.shufflekey = ComputerId TrendValue = percentile(Val, 95) by ComputerId, Computer, bin(TimeGenerated, trendBinSize)\r\n| project ComputerId, Computer\r\n| summarize hint.shufflekey = ComputerId by ComputerId, Computer;\r\nsummaryPerComputer\r\n| join ( trend ) on ComputerId\r\n| join ( NodeIdentityAndProps ) on ComputerId\r\n| parse tolower(ResourceId) with * \"virtualmachinescalesets/\" scaleSetName \"/virtualmachines/\" vmNameScale\r\n| parse tolower(ResourceId) with * \"virtualmachines/\" vmName\r\n| parse tolower(ResourceId) with * \"resourcegroups/\" resourceGroup \"/providers/microsoft.compute/\" typeVM \"/\" nameVM\r\n| parse tolower(ResourceId) with * \"microsoft.compute/\" typeScale \"/\" nameScale \"/virtualmachines\" remaining\r\n| project resourceGroup, Average, P50th, P90th, P95th, Max, Computer, Type = iff(isnotempty(typeScale), typeScale, typeVM), Name = iff(isnotempty(nameScale), nameScale, nameVM)\r\n",
                "resource": "$ws",
                "resultFormat": "table"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": ""
            },
            {
              "azureResourceGraph": {
                "query": "resources\r\n| where tolower(type) contains \"virtualmachines\" and resourceGroup in~ ($rg) \r\n| project Name = tolower(name), tenantId, resourceGroup"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "hide": false,
              "queryType": "Azure Resource Graph",
              "refId": "B",
              "subscription": "",
              "subscriptions": [
                "$sub"
              ]
            }
          ],
          "title": "Available Bytes Sent Statistics",
          "transformations": [
            {
              "id": "merge",
              "options": {}
            },
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "NodeId": true,
                  "NodeProps": true,
                  "ResourceId": true,
                  "UseRelativeScale": true
                },
                "indexByName": {
                  "Average": 2,
                  "Computer": 0,
                  "Max": 6,
                  "Name": 8,
                  "P50th": 3,
                  "P90th": 4,
                  "P95th": 5,
                  "Type": 7,
                  "resourceGroup": 1,
                  "tenantId": 9
                },
                "renameByName": {
                  "Name": "Resource Name",
                  "list_TrendPoint": "Trend 95th",
                  "resGroup": "Resource Group",
                  "resourceGroup": "Resource Group",
                  "tenantId": "Tenant ID",
                  "typeName": "Type/Name"
                }
              }
            },
            {
              "id": "filterByValue",
              "options": {
                "filters": [
                  {
                    "config": {
                      "id": "isNotNull",
                      "options": {}
                    },
                    "fieldName": "Computer"
                  }
                ],
                "match": "all",
                "type": "include"
              }
            }
          ],
          "type": "table"
        },
        {
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "fixedColor": "light-green",
                "mode": "fixed"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": []
          },
          "gridPos": {
            "h": 12,
            "w": 10,
            "x": 14,
            "y": 19
          },
          "id": 48,
          "options": {
            "colorMode": "value",
            "graphMode": "area",
            "justifyMode": "auto",
            "orientation": "auto",
            "reduceOptions": {
              "calcs": [
                "max"
              ],
              "fields": "",
              "values": false
            },
            "text": {},
            "textMode": "auto"
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize = (endDateTime - startDateTime)/100;\r\nlet MaxListSize = 1000;\r\nlet summary = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'WriteBytesPerSecond')\r\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\r\n| where resGroup in~ ($rg)\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| summarize Val = sum(Val) by bin(TimeGenerated, trendBinSize), ComputerId, Computer\r\n| summarize hint.shufflekey=ComputerId Average = avg(Val), Min = min(Val),P5th = round(percentile(Val, 5), 2), P10th = round(percentile(Val, 10), 2), \r\nP50th = round(percentile(Val, 50), 2), P80th = round(percentile(Val, 80), 2),\r\nP90th = round(percentile(Val, 90), 2), P95th = round(percentile(Val, 95), 2) by ComputerId, Computer\r\n| top 10 by ${agg:text};\r\nlet computerList=(summary\r\n| project ComputerId, Computer);\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        let ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        let NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n| summarize arg_max(Priority, *) by ComputerId;summary\r\n| join (InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'WriteBytesPerSecond')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)\r\n| summarize Val = sum(Val) by bin(TimeGenerated, trendBinSize), ComputerId, Computer\r\n| summarize Max = max(Val) by bin(TimeGenerated, trendBinSize), ComputerId\r\n| sort by TimeGenerated asc) on ComputerId\r\n",
                "resource": "$ws",
                "resultFormat": "table"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": ""
            }
          ],
          "title": "Max Available Bytes Sent and Trend  Line",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "Average": true,
                  "ComputerId": true,
                  "ComputerId1": true,
                  "Min": true,
                  "P10th": true,
                  "P50th": true,
                  "P5th": true,
                  "P80th": true,
                  "P90th": true,
                  "P95th": true
                },
                "indexByName": {},
                "renameByName": {}
              }
            },
            {
              "id": "prepareTimeSeries",
              "options": {
                "format": "many"
              }
            },
            {
              "id": "renameByRegex",
              "options": {
                "regex": "(.+)\\s(.+)",
                "renamePattern": "$2"
              }
            }
          ],
          "type": "stat"
        }
      ],
      "title": "Network Bytes Sent",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 30
      },
      "id": 36,
      "panels": [
        {
          "datasource": {
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "palette-classic"
              },
              "custom": {
                "axisGridShow": true,
                "axisLabel": "",
                "axisPlacement": "auto",
                "axisSoftMin": 0,
                "barAlignment": 0,
                "drawStyle": "line",
                "fillOpacity": 0,
                "gradientMode": "none",
                "hideFrom": {
                  "legend": false,
                  "tooltip": false,
                  "viz": false
                },
                "lineInterpolation": "linear",
                "lineWidth": 1,
                "pointSize": 5,
                "scaleDistribution": {
                  "type": "linear"
                },
                "showPoints": "never",
                "spanNulls": true,
                "stacking": {
                  "group": "A",
                  "mode": "none"
                },
                "thresholdsStyle": {
                  "mode": "off"
                }
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              },
              "unit": "Bps"
            },
            "overrides": []
          },
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 9
          },
          "id": 16,
          "options": {
            "legend": {
              "calcs": [],
              "displayMode": "list",
              "placement": "bottom"
            },
            "tooltip": {
              "mode": "single",
              "sort": "none"
            }
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\nlet endDateTime = $__timeTo;\nlet trendBinSize = (endDateTime - startDateTime)/100;\nlet MaxListSize = 1000;\nlet summary = InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'ReadBytesPerSecond')\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\n| where resGroup in~ ($rg)\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| summarize Val = sum(Val) by bin(TimeGenerated, trendBinSize), ComputerId, Computer\n| summarize hint.shufflekey=ComputerId $agg by ComputerId, Computer\n| top 10 by score;\nlet computerList=(summary\n| project ComputerId, Computer);\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        let OmsNodeIdentityAndProps = computerList        \n| extend NodeId = ComputerId        \n| extend Priority = 1        \n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \nlet ServiceMapNodeIdentityAndProps = VMComputer        \n| where TimeGenerated >= startDateTime        \n| where TimeGenerated < endDateTime        \n| extend ResourceId = strcat('machines/', Machine)        \n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \n| summarize arg_max(TimeGenerated, *) by Machine        \n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        let NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \n| summarize arg_max(Priority, *) by ComputerId;\nsummary\n| join (InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'ReadBytesPerSecond')\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| where ComputerId in (computerList)\n| summarize Val = sum(Val) by bin(TimeGenerated, trendBinSize), ComputerId, \nComputer\n| summarize $agg by bin(TimeGenerated, trendBinSize), ComputerId\n| sort by TimeGenerated asc) on ComputerId\n",
                "resource": "$ws",
                "resultFormat": "table",
                "workspace": ""
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": "",
              "subscriptions": []
            }
          ],
          "title": "${agg:text} Bytes Received Rate",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "ComputerId": true,
                  "ComputerId1": true,
                  "P95th": true,
                  "score": true
                },
                "indexByName": {},
                "renameByName": {}
              }
            },
            {
              "id": "prepareTimeSeries",
              "options": {
                "format": "many"
              }
            },
            {
              "id": "renameByRegex",
              "options": {
                "regex": "(.+)\\s(.+)",
                "renamePattern": "$2"
              }
            }
          ],
          "type": "timeseries"
        },
        {
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "align": "auto",
                "displayMode": "auto"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": [
              {
                "matcher": {
                  "id": "byName",
                  "options": "Computer"
                },
                "properties": [
                  {
                    "id": "links",
                    "value": [
                      {
                        "targetBlank": true,
                        "title": "",
                        "url": "https://ms.portal.azure.com/#@${__data.fields[\"Tenant ID\"]}/resource/subscriptions/${sub}/resourcegroups/${__data.fields[\"Resource Group\"]}/providers/microsoft.compute/${__data.fields.Type}/${__data.fields[\"Resource Name\"]}/infrainsights"
                      }
                    ]
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Average"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 97
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P50th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 82
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P90th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 99
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "P95th"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 89
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Max"
                },
                "properties": [
                  {
                    "id": "custom.width",
                    "value": 93
                  }
                ]
              }
            ]
          },
          "gridPos": {
            "h": 12,
            "w": 14,
            "x": 0,
            "y": 20
          },
          "id": 38,
          "options": {
            "footer": {
              "fields": "",
              "reducer": [
                "sum"
              ],
              "show": false
            },
            "showHeader": true,
            "sortBy": []
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize = 5m;\r\nlet maxResultCount = 10;\r\nlet summaryPerComputer = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime) \r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'ReadBytesPerSecond')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| summarize Val = sum(Val) by bin(TimeGenerated, 1m), ComputerId, Computer, _ResourceId\r\n| summarize hint.shufflekey = ComputerId Average = avg(Val), Max = max(Val), percentiles(Val, 5, 10, 50, 90, 95) by ComputerId, Computer, _ResourceId\r\n| project ComputerId, Computer, Average, Max, P5th = percentile_Val_5, P10th = percentile_Val_10, P50th = percentile_Val_50, P90th = percentile_Val_90, P95th = percentile_Val_95, ResourceId = _ResourceId\r\n| top 10 by ${agg:text};\r\nlet computerList = summaryPerComputer\r\n| summarize by ComputerId, Computer;\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'',     replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',     @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))    \r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \r\nlet NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n| summarize arg_max(Priority, *) by ComputerId;\r\nlet trend = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'ReadBytesPerSecond')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)\r\n| summarize Val = sum(Val) by bin(TimeGenerated, 1m), ComputerId, Computer, _ResourceId\r\n| summarize hint.shufflekey = ComputerId TrendValue = percentile(Val, 95) by ComputerId, Computer, bin(TimeGenerated, trendBinSize)\r\n| project ComputerId, Computer\r\n| summarize hint.shufflekey = ComputerId by ComputerId, Computer;summaryPerComputer\r\n| join ( trend ) on ComputerId\r\n| join ( NodeIdentityAndProps ) on ComputerId\r\n| parse tolower(ResourceId) with * \"virtualmachinescalesets/\" scaleSetName \"/virtualmachines/\" vmNameScale\r\n| parse tolower(ResourceId) with * \"virtualmachines/\" vmName\r\n| parse tolower(ResourceId) with * \"resourcegroups/\" resourceGroup \"/providers/microsoft.compute/\" typeVM \"/\" nameVM\r\n| parse tolower(ResourceId) with * \"microsoft.compute/\" typeScale \"/\" nameScale \"/virtualmachines\" remaining\r\n| project resourceGroup, Average, P50th, P90th, P95th, Max, Computer, Type = iff(isnotempty(typeScale), typeScale, typeVM), Name = iff(isnotempty(nameScale), nameScale, nameVM)\r\n",
                "resource": "$ws",
                "resultFormat": "table"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": ""
            },
            {
              "azureResourceGraph": {
                "query": "resources\r\n| where tolower(type) contains \"virtualmachines\" and resourceGroup in~ ($rg) \r\n| project Name = tolower(name), tenantId, resourceGroup"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "hide": false,
              "queryType": "Azure Resource Graph",
              "refId": "B",
              "subscription": "",
              "subscriptions": [
                "$sub"
              ]
            }
          ],
          "title": "Available Bytes Received Statistics",
          "transformations": [
            {
              "id": "merge",
              "options": {}
            },
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "NodeId": true,
                  "NodeProps": true,
                  "ResourceId": true,
                  "UseRelativeScale": true
                },
                "indexByName": {
                  "Average": 2,
                  "Computer": 0,
                  "Max": 6,
                  "Name": 8,
                  "P50th": 3,
                  "P90th": 4,
                  "P95th": 5,
                  "Type": 7,
                  "resourceGroup": 1,
                  "tenantId": 9
                },
                "renameByName": {
                  "Name": "Resource Name",
                  "list_TrendPoint": "Trend 95th",
                  "resGroup": "Resource Group",
                  "resourceGroup": "Resource Group",
                  "tenantId": "Tenant ID",
                  "typeName": "Type/Name"
                }
              }
            },
            {
              "id": "filterByValue",
              "options": {
                "filters": [
                  {
                    "config": {
                      "id": "isNotNull",
                      "options": {}
                    },
                    "fieldName": "Computer"
                  }
                ],
                "match": "all",
                "type": "include"
              }
            }
          ],
          "type": "table"
        },
        {
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "fieldConfig": {
            "defaults": {
              "color": {
                "fixedColor": "light-green",
                "mode": "fixed"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green"
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              }
            },
            "overrides": []
          },
          "gridPos": {
            "h": 12,
            "w": 10,
            "x": 14,
            "y": 20
          },
          "id": 50,
          "options": {
            "colorMode": "value",
            "graphMode": "area",
            "justifyMode": "auto",
            "orientation": "auto",
            "reduceOptions": {
              "calcs": [
                "max"
              ],
              "fields": "",
              "values": false
            },
            "text": {},
            "textMode": "auto"
          },
          "targets": [
            {
              "azureLogAnalytics": {
                "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize = (endDateTime - startDateTime)/100;\r\nlet MaxListSize = 1000;\r\nlet summary = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'ReadBytesPerSecond')\r\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\r\n| where resGroup in~ ($rg)\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| summarize Val = sum(Val) by bin(TimeGenerated, trendBinSize), ComputerId, Computer\r\n| summarize hint.shufflekey=ComputerId Average = avg(Val), Min = min(Val),P5th = round(percentile(Val, 5), 2), P10th = round(percentile(Val, 10), 2), \r\nP50th = round(percentile(Val, 50), 2), P80th = round(percentile(Val, 80), 2),\r\nP90th = round(percentile(Val, 90), 2), P95th = round(percentile(Val, 95), 2) by ComputerId, Computer\r\n| top 10 by ${agg:text};\r\nlet computerList=(summary\r\n| project ComputerId, Computer);\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        let OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)        \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        let NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n| summarize arg_max(Priority, *) by ComputerId;\r\nsummary\r\n| join (InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'Network' and Name == 'ReadBytesPerSecond')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)\r\n| summarize Val = sum(Val) by bin(TimeGenerated, trendBinSize), ComputerId, \r\nComputer\r\n| summarize Max = max(Val) by bin(TimeGenerated, trendBinSize), ComputerId\r\n| sort by TimeGenerated asc) on ComputerId\r\n",
                "resource": "$ws",
                "resultFormat": "table"
              },
              "datasource": {
                "type": "grafana-azure-monitor-datasource",
                "uid": "${ds}"
              },
              "queryType": "Azure Log Analytics",
              "refId": "A",
              "subscription": ""
            }
          ],
          "title": "Max Available Bytes Recieved and Trend  Line",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "Average": true,
                  "ComputerId": true,
                  "ComputerId1": true,
                  "Min": true,
                  "P10th": true,
                  "P50th": true,
                  "P5th": true,
                  "P80th": true,
                  "P90th": true,
                  "P95th": true
                },
                "indexByName": {},
                "renameByName": {}
              }
            },
            {
              "id": "prepareTimeSeries",
              "options": {
                "format": "many"
              }
            },
            {
              "id": "renameByRegex",
              "options": {
                "regex": "(.+)\\s(.+)",
                "renamePattern": "$2"
              }
            }
          ],
          "type": "stat"
        }
      ],
      "title": "Network Bytes Received",
      "type": "row"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 31
      },
      "id": 40,
      "panels": [],
      "title": "Logical Disk Space Used %",
      "type": "row"
    },
    {
      "datasource": {
        "uid": "${ds}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisGridShow": true,
            "axisLabel": "",
            "axisPlacement": "auto",
            "axisSoftMin": 0,
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 24,
        "x": 0,
        "y": 32
      },
      "id": 20,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "azureLogAnalytics": {
            "query": "let startDateTime = $__timeFrom;\nlet endDateTime = $__timeTo;\nlet trendBinSize = (endDateTime - startDateTime)/100;\nlet MaxListSize = 1000;\nlet summary = InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'LogicalDisk' and Name == 'FreeSpaceMB')\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resGroup '/p(.+)' *\n| where resGroup in~ ($rg)\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| extend Tags = todynamic(Tags)\n| extend Total = todouble(Tags['vm.azm.ms/diskSizeMB'])\n| summarize Val = sum(Val), Total = sum(Total)  by bin(TimeGenerated, trendBinSize), ComputerId, Computer, _ResourceId\n| extend Val = (100.0 - (Val * 100.0)/Total)\n| summarize hint.shufflekey=ComputerId $agg by ComputerId, Computer\n| top 10 by score;\nlet computerList=(summary\n| project ComputerId, Computer);\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \nlet OmsNodeIdentityAndProps = computerList        \n| extend NodeId = ComputerId        \n| extend Priority = 1        \n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \nlet ServiceMapNodeIdentityAndProps = VMComputer        \n| where TimeGenerated >= startDateTime        \n| where TimeGenerated < endDateTime        \n| extend ResourceId = strcat('machines/', Machine)         \n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \n| extend laResourceId = iff(isempty(_ResourceId),'', replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)', @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \n| summarize arg_max(TimeGenerated, *) by Machine        \n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \nlet NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \n| summarize arg_max(Priority, *) by ComputerId;\nsummary\n| join (InsightsMetrics\n| where TimeGenerated between (startDateTime .. endDateTime)\n| where Origin == 'vm.azm.ms' and (Namespace == 'LogicalDisk' and Name == 'FreeSpaceMB')\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\n| where ComputerId in (computerList)\n| extend Tags = todynamic(Tags)\n| extend Total = todouble(Tags['vm.azm.ms/diskSizeMB'])\n| summarize Val = sum(Val), Total = sum(Total)  by bin(TimeGenerated, trendBinSize), ComputerId, Computer, _ResourceId\n| extend Val = (100.0 - (Val * 100.0)/Total)\n| summarize $agg by bin(TimeGenerated, trendBinSize), ComputerId\n| sort by TimeGenerated asc) on ComputerId\n",
            "resource": "$ws",
            "resultFormat": "table",
            "workspace": ""
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "",
          "subscriptions": []
        }
      ],
      "title": "${agg:text} Logical Disk Space Used %",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "ComputerId": true,
              "ComputerId1": true,
              "P95th": true,
              "score": true
            },
            "indexByName": {},
            "renameByName": {}
          }
        },
        {
          "id": "prepareTimeSeries",
          "options": {
            "format": "many"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "(.+)\\s(.+)",
            "renamePattern": "$2"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-azure-monitor-datasource",
        "uid": "${ds}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Computer"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "targetBlank": true,
                    "title": "",
                    "url": "https://ms.portal.azure.com/#@${__data.fields[\"Tenant ID\"]}/resource/subscriptions/${sub}/resourcegroups/${__data.fields[\"Resource Group\"]}/providers/microsoft.compute/${__data.fields.Type}/${__data.fields[\"Resource Name\"]}/infrainsights"
                  }
                ]
              },
              {
                "id": "custom.width",
                "value": 193
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Average"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 89
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "P50th"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 86
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "P90th"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 90
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "P95th"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 87
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Max"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 77
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 12,
        "w": 14,
        "x": 0,
        "y": 44
      },
      "id": 42,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "targets": [
        {
          "azureLogAnalytics": {
            "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize = 5m;\r\nlet maxResultCount = 10;\r\nlet summaryPerComputer = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'LogicalDisk' and Name == 'FreeSpaceMB')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| extend Tags = todynamic(Tags)\r\n| extend Total = todouble(Tags['vm.azm.ms/diskSizeMB']), MountId = tostring(Tags['vm.azm.ms/mountId'])\r\n| extend Val = (100.0 - (Val * 100.0)/Total)\r\n| summarize hint.shufflekey = ComputerId Average = avg(Val), Max = max(Val), percentiles(Val, 5, 10, 50, 90, 95) by MountId, ComputerId, Computer, _ResourceId\r\n| project MountId, ComputerId, Computer, Average, Max, P5th = percentile_Val_5, P10th = percentile_Val_10, P50th = percentile_Val_50, P90th = percentile_Val_90, P95th = percentile_Val_95, ResourceId = _ResourceId\r\n| top 10 by ${agg:text};\r\nlet computerList = summaryPerComputer\r\n| summarize by ComputerId, Computer;\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'',     replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',     @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))    \r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \r\nlet NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n| summarize arg_max(Priority, *) by ComputerId;\r\nlet trend = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'LogicalDisk' and Name == 'FreeSpaceMB')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)| extend Tags = todynamic(Tags)\r\n| extend Total = todouble(Tags['vm.azm.ms/diskSizeMB']), MountId = tostring(Tags['vm.azm.ms/mountId'])\r\n| extend Val = (100.0 - (Val * 100.0)/Total)\r\n| summarize hint.shufflekey = ComputerId TrendValue = percentile(Val, 95) by MountId, ComputerId, Computer, bin(TimeGenerated, trendBinSize)\r\n| project MountId, ComputerId, Computer\r\n| summarize hint.shufflekey = ComputerId by MountId, ComputerId, Computer;summaryPerComputer\r\n| join kind=leftouter ( trend ) on ComputerId, MountId\r\n| join kind=leftouter ( NodeIdentityAndProps ) on ComputerId\r\n| extend VolumeId = strcat(MountId, '|', NodeId), VolumeProps = pack('type', 'NodeVolume', 'volumeName', MountId, 'node', NodeProps)\r\n| parse tolower(ResourceId) with * \"virtualmachinescalesets/\" scaleSetName \"/virtualmachines/\" vmNameScale\r\n| parse tolower(ResourceId) with * \"virtualmachines/\" vmName\r\n| parse tolower(ResourceId) with * \"resourcegroups/\" resourceGroup \"/providers/microsoft.compute/\" typeVM \"/\" nameVM\r\n| parse tolower(ResourceId) with * \"microsoft.compute/\" typeScale \"/\" nameScale \"/virtualmachines\" remaining\r\n| project resourceGroup, Average, P50th, P90th, P95th, Max, Computer,  Type = iff(isnotempty(typeScale), typeScale, typeVM), Name = iff(isnotempty(nameScale), nameScale, nameVM)\r\n",
            "resource": "$ws",
            "resultFormat": "table"
          },
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": ""
        },
        {
          "azureResourceGraph": {
            "query": "resources\r\n| where tolower(type) contains \"virtualmachines\" and resourceGroup in~ ($rg) \r\n| project Name = tolower(name), tenantId, resourceGroup"
          },
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "hide": false,
          "queryType": "Azure Resource Graph",
          "refId": "B",
          "subscription": "",
          "subscriptions": [
            "$sub"
          ]
        }
      ],
      "title": "Available Logical Space Disk Used % Statistics",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "ResourceId": true,
              "UseRelativeScale": true,
              "VolumeId": true,
              "VolumeProps": true
            },
            "indexByName": {
              "Average": 2,
              "Computer": 0,
              "Max": 6,
              "Name": 8,
              "P50th": 3,
              "P90th": 4,
              "P95th": 5,
              "Type": 7,
              "resourceGroup": 1,
              "tenantId": 9
            },
            "renameByName": {
              "Name": "Resource Name",
              "list_TrendPoint": "Trend 95th",
              "resGroup": "Resource Group",
              "resourceGroup": "Resource Group",
              "tenantId": "Tenant ID",
              "typeName": "Type/Name"
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "isNotNull",
                  "options": {}
                },
                "fieldName": "Computer"
              }
            ],
            "match": "all",
            "type": "include"
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "grafana-azure-monitor-datasource",
        "uid": "${ds}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "light-green",
            "mode": "fixed"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 10,
        "x": 14,
        "y": 44
      },
      "id": 52,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "max"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "targets": [
        {
          "azureLogAnalytics": {
            "query": "let startDateTime = $__timeFrom;\r\nlet endDateTime = $__timeTo;\r\nlet trendBinSize = 5m;\r\nlet maxResultCount = 10;\r\nlet summaryPerComputer = InsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'LogicalDisk' and Name == 'FreeSpaceMB')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| extend Tags = todynamic(Tags)\r\n| extend Total = todouble(Tags['vm.azm.ms/diskSizeMB']), MountId = tostring(Tags['vm.azm.ms/mountId'])\r\n| extend Val = (100.0 - (Val * 100.0)/Total)\r\n| summarize hint.shufflekey = ComputerId Average = avg(Val), Max = max(Val), percentiles(Val, 5, 10, 50, 90, 95) by MountId, ComputerId, Computer, _ResourceId\r\n| project MountId, ComputerId, Computer, Average, Max, P5th = percentile_Val_5, P10th = percentile_Val_10, P50th = percentile_Val_50, P90th = percentile_Val_90, P95th = percentile_Val_95, ResourceId = _ResourceId\r\n| top 10 by ${agg:text};\r\nlet computerList = summaryPerComputer\r\n| summarize by ComputerId, Computer;\r\nlet EmptyNodeIdentityAndProps = datatable(ComputerId: string, Computer:string, NodeId:string, NodeProps:dynamic, Priority: long) [];        \r\nlet OmsNodeIdentityAndProps = computerList        \r\n| extend NodeId = ComputerId        \r\n| extend Priority = 1        \r\n| extend NodeProps = pack('type', 'StandAloneNode', 'name', Computer);        \r\nlet ServiceMapNodeIdentityAndProps = VMComputer        \r\n| where TimeGenerated >= startDateTime        \r\n| where TimeGenerated < endDateTime        \r\n| extend ResourceId = strcat('machines/', Machine)         \r\n| extend tempComputerId=iff(isempty(_ResourceId), Computer, _ResourceId) \r\n| extend laResourceId = iff(isempty(_ResourceId),'',     replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',     @'virtualmachinescalesets/\\\\1/virtualmachines/\\\\1_\\\\2', _ResourceId))    \r\n| extend oldLaResourceId=iff(isempty(_ResourceId),'',replace(@'virtualmachinescalesets/(.+)/virtualmachines/(\\\\d+)',@'virtualmachines/\\\\1_\\\\2', _ResourceId))        \r\n| where tempComputerId in~ (computerList) or laResourceId in (computerList) or oldLaResourceId in (computerList) \r\n| extend ComputerId = iff(laResourceId in (computerList), laResourceId, iff(oldLaResourceId in (computerList), oldLaResourceId, tempComputerId))        \r\n| summarize arg_max(TimeGenerated, *) by Machine        \r\n| extend                  AzureCloudServiceNodeIdentity = iif(isnotempty(AzureCloudServiceName),                      strcat(AzureCloudServiceInstanceId, '|', AzureCloudServiceDeployment), ''),                  AzureScaleSetNodeIdentity = iif(isnotempty(AzureVmScaleSetName),                      strcat(AzureVmScaleSetInstanceId, '|', AzureVmScaleSetDeployment), ''),                  ComputerProps =                      pack('type', 'StandAloneNode',                           'name', DisplayName,                           'mappingResourceId', ResourceId,                           'subscriptionId', AzureSubscriptionId,                           'resourceGroup', AzureResourceGroup,                           'azureResourceId', _ResourceId),                  AzureCloudServiceNodeProps =                      pack('type', 'AzureCloudServiceNode',                           'cloudServiceInstanceId', AzureCloudServiceInstanceId,                           'cloudServiceRoleName', AzureCloudServiceRoleName,                           'cloudServiceDeploymentId', AzureCloudServiceDeployment,                           'fullDisplayName', FullDisplayName,                           'cloudServiceName', AzureCloudServiceName,                           'mappingResourceId', ResourceId),                  AzureScaleSetNodeProps =                       pack('type', 'AzureScaleSetNode',                           'scaleSetInstanceId', AzureResourceName,                           'vmScaleSetDeploymentId', AzureVmScaleSetDeployment,                           'vmScaleSetName', AzureVmScaleSetName,                           'serviceFabricClusterName', AzureServiceFabricClusterName,                           'vmScaleSetResourceId', AzureVmScaleSetResourceId,                           'resourceGroupName', AzureResourceGroup,                           'subscriptionId', AzureSubscriptionId,                           'fullDisplayName', FullDisplayName,                           'mappingResourceId', ResourceId)        \r\n| project   ComputerId,                    Computer,                    NodeId = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeIdentity,                               isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeIdentity, Computer),                    NodeProps = case(isnotempty(AzureCloudServiceNodeIdentity), AzureCloudServiceNodeProps,                                  isnotempty(AzureScaleSetNodeIdentity), AzureScaleSetNodeProps, ComputerProps),                    Priority = 2;        \r\nlet NodeIdentityAndProps = union kind=inner isfuzzy = true                                          EmptyNodeIdentityAndProps, OmsNodeIdentityAndProps, ServiceMapNodeIdentityAndProps                                    \r\n| summarize arg_max(Priority, *) by ComputerId;\r\nInsightsMetrics\r\n| where TimeGenerated between (startDateTime .. endDateTime)\r\n| where Origin == 'vm.azm.ms' and (Namespace == 'LogicalDisk' and Name == 'FreeSpaceMB')\r\n| extend ComputerId = iff(isempty(_ResourceId), Computer, _ResourceId)\r\n| where ComputerId in (computerList)| extend Tags = todynamic(Tags)\r\n| extend Total = todouble(Tags['vm.azm.ms/diskSizeMB']), MountId = tostring(Tags['vm.azm.ms/mountId'])\r\n| extend Val = (100.0 - (Val * 100.0)/Total)\r\n| summarize hint.shufflekey = ComputerId TrendValue = max(Val) by MountId, ComputerId, Computer, bin(TimeGenerated, trendBinSize)\r\n",
            "resource": "$ws",
            "resultFormat": "table"
          },
          "datasource": {
            "type": "grafana-azure-monitor-datasource",
            "uid": "${ds}"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": ""
        }
      ],
      "title": "Max available Logical Space Disk Used % ",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Average": true,
              "ComputerId": true,
              "ComputerId1": true,
              "Min": true,
              "MountId": true,
              "P10th": true,
              "P50th": true,
              "P5th": true,
              "P80th": true,
              "P90th": true,
              "P95th": true
            },
            "indexByName": {},
            "renameByName": {}
          }
        },
        {
          "id": "prepareTimeSeries",
          "options": {
            "format": "many"
          }
        },
        {
          "id": "renameByRegex",
          "options": {
            "regex": "(.+)\\s(.+)",
            "renamePattern": "$2"
          }
        }
      ],
      "type": "stat"
    }
  ],
  "refresh": false,
  "schemaVersion": 35,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "hide": 0,
        "includeAll": false,
        "label": "Datasource",
        "multi": false,
        "name": "ds",
        "options": [],
        "query": "grafana-azure-monitor-datasource",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {},
        "datasource": {
          "uid": "${ds}"
        },
        "definition": "Subscriptions()",
        "hide": 0,
        "includeAll": false,
        "label": "Subscription",
        "multi": false,
        "name": "sub",
        "options": [],
        "query": "Subscriptions()",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "uid": "${ds}"
        },
        "definition": "Workspaces($sub)",
        "hide": 0,
        "includeAll": false,
        "label": "Workspace",
        "multi": false,
        "name": "ws",
        "options": [],
        "query": "Workspaces($sub)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "grafana-azure-monitor-datasource",
          "uid": "${ds}"
        },
        "definition": "",
        "hide": 0,
        "includeAll": false,
        "label": "Resource Group(s)",
        "multi": true,
        "name": "rg",
        "options": [],
        "query": {
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where Origin == 'vm.azm.ms'\r\n| parse kind=regex tolower(_ResourceId) with 'resourcegroups/' resourceGroup '/p(.+)' *\r\n| project resourceGroup",
            "resource": "$ws"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": ""
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "Average",
          "value": "score = round(avg(Val), 2)"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Aggregate",
        "multi": false,
        "name": "agg",
        "options": [
          {
            "selected": true,
            "text": "Average",
            "value": "score = round(avg(Val), 2)"
          },
          {
            "selected": false,
            "text": "P5th",
            "value": "score= round(percentile(Val, 5), 2)"
          },
          {
            "selected": false,
            "text": "P10th",
            "value": "score= round(percentile(Val, 10), 2)"
          },
          {
            "selected": false,
            "text": "P50th",
            "value": "score= round(percentile(Val, 50), 2)"
          },
          {
            "selected": false,
            "text": "P80th",
            "value": "score= round(percentile(Val, 80), 2)"
          },
          {
            "selected": false,
            "text": "P90th",
            "value": "score= round(percentile(Val, 90), 2)"
          },
          {
            "selected": false,
            "text": "P95th",
            "value": "score= round(percentile(Val, 95), 2)"
          }
        ],
        "query": "Average : score = round(avg(Val)\\, 2), P5th : score= round(percentile(Val\\, 5)\\, 2),  P10th : score= round(percentile(Val\\, 10)\\, 2), P50th : score= round(percentile(Val\\, 50)\\, 2), P80th : score= round(percentile(Val\\, 80)\\, 2), P90th : score= round(percentile(Val\\, 90)\\, 2), P95th : score= round(percentile(Val\\, 95)\\, 2)",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-15m",
    "to": "now"
  },
  "title": "Azure / Insights / Virtual Machines by Workspace",
  "uid": "AzVmInsightsByWS",
  "version": 21,
  "gnetId": 15948
}