[英]Proxy settings on Azure Log Analytics agent on Linux systems
我正在將Azure Log Analytics 代理部署到 Ubuntu 18 VM。 使用Microsoft.EnterpriseCloud.Monitoring.OmsAgentForLinux
擴展通過 Azure 策略完成。 我需要設置代理配置。 在 windows 系統上,可以在部署模板中設置代理設置,其中"proxyUri": "[parameters('proxyUri')]"
作為代理的屬性。 我可以在 Windows OS 的監控代理 UI 上驗證代理設置。
我對 Linux 做了同樣的聲明。
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"logAnalytics": {
"type": "string"
},
"proxyUri": {
"type": "String",
"defaultValue": "proxy_server_ipaddress",
"metadata": {
"description": "Proxy Settings', Proxy Server"
}
}
},
"resources": [
{
"name": "[concat(parameters('vmName'),'/omsPolicy')]",
"type": "Microsoft.Compute/virtualMachines/extensions",
"location": "[parameters('location')]",
"apiVersion": "2017-12-01",
"properties": {
"publisher": "Microsoft.EnterpriseCloud.Monitoring",
"type": "OmsAgentForLinux",
"typeHandlerVersion": "1.13",
"autoUpgradeMinorVersion": true,
"settings": {
"workspaceId": "[reference(parameters('logAnalytics'), '2015-03-20').customerId]",
"proxyUri": "[parameters('proxyUri')]"
},
"protectedSettings": {
"workspaceKey": "[listKeys(parameters('logAnalytics'), '2015-03-20').primarySharedKey]"
}
}
}
],
代理擴展安裝成功。 但是在配置文件 /etc/opt/microsoft/omsagent/conf/omsagent.conf 中,我找不到任何代理設置。 老實說,我不知道在系統上的確切位置。 而且我在Microsoft 文檔中找不到它。
有人知道如何在 Linux 系統上檢查 Azure Log Analytics 代理的代理設置嗎?
根據文件:
代理配置在此文件中設置: /etc/opt/microsoft/omsagent/proxy.conf
此文件可以直接創建或編輯,但必須由 omsagent 用戶讀取。 如果代理配置發生更改,則必須更新此文件並重新啟動 omsagent 守護程序。 例如:
proxyconf="https://proxyuser:proxypassword@proxyserver01:8080"
sudo echo $proxyconf >>/etc/opt/microsoft/omsagent/proxy.conf
sudo chown omsagent:omiusers /etc/opt/microsoft/omsagent/proxy.conf
sudo chmod 600 /etc/opt/microsoft/omsagent/proxy.conf
sudo /opt/microsoft/omsagent/bin/service_control restart
經過我的驗證,看起來直接在 ARM 模板中定義proxyUri
參數不起作用。 您可以嘗試使用自定義腳本擴展在安裝期間調用包裝腳本。
例如,Azure 存儲 blob 上的oms_linux.sh
文件的內容。
sudo sh ./onboard_agent.sh -p https://<proxy address>:<proxy port> -w <workspace id> -s <shared key>
Arm 模板:
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('vmName'),'/installcustomscript')]",
"apiVersion": "2019-03-01",
"location": "[parameters('location')]",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": ["https://mystorageaccount.blob.core.windows.net/oms/oms_linux.sh"]
},
"protectedSettings": {
"commandToExecute": "wget https://raw.githubusercontent.com/Microsoft/OMS-Agent-for-Linux/master/installer/scripts/onboard_agent.sh && sh oms_linux.sh",
"storageAccountName": "xxx",
"storageAccountKey": "xxxx"
}
}
}
結果
在 Azure Linux 虛擬機上,
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.