如何解决Linux 系统上 Azure Log Analytics 代理的代理设置
我正在将 Azure Log Analytics 代理部署到 Ubuntu 18 虚拟机。它是通过使用 Microsoft.EnterpriseCloud.Monitoring.OmsAgentForLinux
扩展通过 Azure Policy 完成的。我需要设置代理配置。在 Windows 系统上,可以在部署模板中设置代理设置,并将 "proxyUri": "[parameters('proxyUri')]"
作为代理的属性。我可以在 Windows 操作系统的监控代理 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 documentation 上找不到。
有人知道如何在 Linux 系统上检查 Azure Log Analytics 代理的代理设置吗?
解决方法
根据the document:
代理配置在这个文件中设置:.click()
这个文件可以直接创建或编辑,但必须是 omsagent 用户可读的。如果代理配置更改,则必须更新此文件并重新启动 omsagent 守护程序。例如:
/etc/opt/microsoft/omsagent/proxy.conf
经过我的验证,在ARM模板中直接定义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
参数似乎不起作用。您可以尝试在安装过程中使用 custom script extension 来调用 wrapper scripts。
例如,Azure 存储 blob 上 proxyUri
文件的内容。
oms_linux.sh
手臂模板:
sudo sh ./onboard_agent.sh -p https://<proxy address>:<proxy port> -w <workspace id> -s <shared key>
结果
在 Azure Linux 虚拟机上,
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。