Azure VM 現在可以支援相依性代理程式 (Dependency agent) 了

Azure VM 可以支援 Service Map 的相依性代理程式了!! 將相依性代理程式加入 Azure 的方法很簡單,只需要一行 Powershell 指令,或者在您 Azure 資源管理模板裡做一些小改變即可。

這個產品現在有兩個擴充,一個是適用於 Windows (DependencyAgentWindows),另一個是適用於 Linux (DependencyAgentLinux)。兩個的發行者都是 Microsoft.Azure.Monitoring.DependencyAgent。

以下是一些 PowerShell 的範例,它將相依性代理程式裝在 Azure 資源群組裡每個 VM 上。

$version = "9.1"

$ExtPublisher = "Microsoft.Azure.Monitoring.DependencyAgent"

$0sExtensionMap = @{ "Windows" = "DependencyAgentWindows"; "Linux"

="DependencyAgentLinux" }

$rmgroup = ""

Get-AzureRmVm -ResourceGroupName $rmgroup |

ForEach-Object {

""

$name = $_.Name

$os = $_.StorageProfile.0sDisk.0sType

$location = $_.Location

$vmRmGroup =$_.ResourceGroupName

"${name}: ${os} (${location})"

Date -Format o

$ext = $0sExtensionMap.($os.ToString())

$result = Set-AzureRmVMExtension -ResourceGroupName $vmRmGroup -VMName -Location

`` $location `

-Publisher $ExtPublisher -ExtensionType $ext -Name "DependencyAgent"

=TypeHandlerVersion $version

$result.IsSuccessStatusCode

}

相依性代理程式 VM 擴充還是要仰賴 OMS 代理程式,因此在添加相依性代理程式前,您需要確認您的 VMs 有安裝 OMS 且有在執行 OMS。