【问题标题】:Azure Dashboard template for App Service Plan应用服务计划的 Azure 仪表板模板
【发布时间】:2022-10-04 12:12:52
【问题描述】:

我想创建一个 Azure 仪表板模板来监控我的应用服务计划的 CPU 百分比。目前它看起来像这样:

resource dashboardName_resource 'Microsoft.Portal/dashboards@2020-09-01-preview' = {
  name: dashboardName
  location: location
  properties: {
    lenses: [
      {
        order: 0
        parts: [
          {
            position: {
              x: 0
              y: 4
              rowSpan: 3
              colSpan: 11
            }
            metadata: {
              inputs: [
                {
                  name: 'queryInputs'
                  value: {
                    timespan: {
                      duration: 'PT1H'
                    }
                    id: resourceId(appServicePlanResourceGroup, 'Microsoft.Web/serverfarms', appServicePlanName)
                    chartType: 0
                    metrics: [
                      {
                        name: 'CPU Percentage'
                        resourceId: resourceId(appServicePlanResourceGroup, 'Microsoft.Web/serverfarms', appServicePlanName)
                      }
                    ]
                  }
                }
              ]
              type: 'Extension/Microsoft_Azure_Monitoring/PartType/MetricsChartPart'
            }
          }

        ]
      }
    ]
  }
}

验证和部署成功,但是当我到达这个仪表板时,我得到了这个: 有谁知道为什么?

【问题讨论】:

    标签: azure azure-resource-manager arm-template azure-bicep azure-dashboard


    【解决方案1】:

    通过引用您的二头肌代码的document from MS 示例副本并能够成功部署它。

    在我进行复制时,我已将 .bicep 文件中的类型扩展名从type:'Extension/Microsoft_Azure_Monitoring/PartType/MetricsChartPart 更改为type:'Extension/HubsExtension/PartType/MonitorChartPart',这已成功并能够查看 CPU 指标。

    附上示例代码供您参考:

    param  location  string = resourceGroup().location
    param  appServicePlanResourceGroup  string = 'xxxxx'
    param  appServicePlanName  string = 'xxxxxxx'
    
    resource  symbolicname  'Microsoft.Portal/dashboards@2020-09-01-preview' = {
      name: 'xxxxmydemo'
      location: location
      tags: {
        demo: 'repro01'
     }
    
      properties: {
        lenses: [
          {
            metadata: {}
            order: 2
            parts: [
              {
                metadata: {
                  type: 'Extension/HubsExtension/PartType/MonitorChartPart'
                  inputs: [
                    {
                       name: 'queryInputs'
                       value: {
                         timespan: {
                           duration: 'PT1H'
                          }
                          id: resourceId(appServicePlanResourceGroup, 'Microsoft.Web/serverfarms', appServicePlanName)
                          chartType: 0
                          metrics: [
                            {
                              name: 'CPU Percentage'
                              resourceId: resourceId(appServicePlanResourceGroup, 'Microsoft.Web/serverfarms', appServicePlanName)
                          }
                        ]
                      }
                    }
                  ]
                }
                position: {
                  colSpan: 11
                  metadata: {}
                  rowSpan: 5
                  x: 3
                  y: 4
                }
               }
             ]
            }
          ]
           metadata: {}
        }
      }
      
    

    输出供您参考:

    注意:最好验证资源组的access control(IAM) 权限,它应该是它的一部分。

    【讨论】:

      猜你喜欢
      • 2020-11-10
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多