【问题标题】:powershell command to show application insight availability percentage用于显示应用程序洞察可用性百分比的 powershell 命令
【发布时间】:2021-07-26 16:42:10
【问题描述】:

希望使用 powershell 命令从 Azure 应用程序洞察中获取可用性百分比。我有 BASH 命令 az monitor app-insights metrics show,但由于我想在自动化运行手册中运行脚本,它们不支持 BASH 命令。有人知道如何使用 PS 命令获得相同的结果吗?

我最后的手段是使用 invoke-webrequest 或 cURL,但它还有其他挑战,例如 API 密钥。

谢谢

【问题讨论】:

    标签: azure powershell azure-application-insights azure-monitoring


    【解决方案1】:

    需要从json file保存availability.json并根据需要修改资源并将json从json file保存为availabilityalert.parameters.json

     {  
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
        "contentVersion": "1.0.0.0", 
        "parameters": {
        "appName": {
        "value": "Replace with your Application Insights resource name"
        },
        "pingURL": {
        "value": "https://www.yoursite.com"
        },
        "actionGroupId": {
        "value": "/subscriptions/replace-with-subscription-id/resourceGroups/replace-with-resourceGroup-name/providers/microsoft.insights/actiongroups/replace-with-action-group-name"
        },
        "location": {
        "value": "Replace with the location of your Application Insights resource"
        }
        }
        }
    

    活动日志中获取actionGroupId -> 选择特定日志在这里您可以获取resourceid

    您可以使用 PowerShell 使用模板和参数文件创建可用性测试和相关警报。

    Connect-AzAccount
    
    New-AzResourceGroup -Name AvailabilityAlertDeployment -Location westus2
    
    New-AzResourceGroupDeployment -ResourceGroupName AvailabilityAlertDeployment -TemplateFile ./availabilityalert.json -TemplateParameterFile ./availabilityalert.parameters.json
    

    进一步refer

    【讨论】:

    • 这似乎就像创建可用性报告。我们已经在运行可用性测试。需要的是那些结果。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-15
    • 1970-01-01
    • 1970-01-01
    • 2010-11-25
    • 2020-12-11
    • 1970-01-01
    相关资源
    最近更新 更多