【问题标题】:How to add Azure Scaleset to Log Analytics如何将 Azure Scaleset 添加到 Log Analytics
【发布时间】:2019-07-17 13:18:19
【问题描述】:

如何将 Azure 规模集添加到 Log Analytics。从日志分析中,我可以看到虚拟机,但与虚拟机不同,连接按钮未启用。我需要做什么。启用此连接。

【问题讨论】:

    标签: azure monitoring azure-log-analytics azure-vm-scale-set


    【解决方案1】:

    有一篇关于这个问题的 MSDN 帖子:

    https://blogs.msdn.microsoft.com/timomta/2018/04/09/how-to-add-the-oms-client-to-a-vm-scale-set/

    正如文章中提到的,我们解释了如何为 VM 执行此操作,而不是为 VMSS。您可以通过 PowerShell 完成此操作,上面的链接博客描述了如何实现它。

    我会为不想点击链接的用户添加下面的脚本

    select-azurermsubscription -subscriptionid ‘your subscription id’
    $PublicSettings = @{"workspaceId" = "your oms workspace id"}
    $ProtectedSettings = @{"workspaceKey" = "your big base64 oms key"}
    
    # Get information about the scale set
    $vmss = Get-AzureRmVmss -ResourceGroupName 'VMSSRESOURCEGROUP' `
    -VMScaleSetName 'VMSSNAME'
    
    Add-AzureRmVmssExtension `
    -VirtualMachineScaleSet $vmss `
    -Name "Microsoft.EnterpriseCloud.Monitoring" `
    -Publisher "Microsoft.EnterpriseCloud.Monitoring" `
    -Type "MicrosoftMonitoringAgent" `
    -TypeHandlerVersion 1.0 `
    -AutoUpgradeMinorVersion $true `
    -Setting $PublicSettings `
    -ProtectedSetting $ProtectedSettings
    
    # Update the scale set and apply the Custom Script Extension to the VM instances
    Update-AzureRmVmss `
    -ResourceGroupName $vmss.ResourceGroupName `
    -Name $vmss.Name `
    -VirtualMachineScaleSet $vmss
    
    # Only needed for manual update VMSS – warning tells them all to update, so modify to suit
    $jobs=@()
    Get-AzureRmVmssVM -ResourceGroupName $vmss.ResourceGroupName -VMScaleSetName $vmss.Name | foreach {
    $jobs+=Update-AzureRmVmssInstance -ResourceGroupName $vmss.ResourceGroupName -Name $vmss.Name -InstanceId $_.InstanceId -AsJob
    }
    
    $jobs | Wait-Job
    $jobs | Receive-Job
    

    感谢作者https://social.msdn.microsoft.com/profile/Tim+Omta

    【讨论】:

      猜你喜欢
      • 2020-11-11
      • 2022-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-29
      • 2018-08-08
      • 2021-07-29
      • 2020-06-30
      相关资源
      最近更新 更多