排查 Azure Linux 代理问题

注意

本文是否有帮助? 你的输入对我们很重要。 请使用此页面上的 “反馈 ”按钮,让我们了解本文对你的影响,或者我们如何改进它。

Azure Linux 代理允许虚拟机 (VM) 与构造控制器 (托管 VM 的基础物理服务器) IP 地址 168.63.129.16 进行通信。

注意

此 IP 地址是一个虚拟公共 IP 地址,可促进通信,不应阻止。 有关详细信息,请参阅 什么是 IP 地址 168.63.129.16?

开始之前

检查代理状态和版本,确保仍受支持。 若要检查版本支持,请参阅 Azure 中虚拟机代理的最低版本支持;有关查找状态和版本的步骤,请参阅 WALinuxAgent 常见问题解答

排查“未就绪”状态问题

  1. 检查 Azure Linux 代理的服务状态,确保它正在运行。 服务名称可以是 walinuxagentwaagent

    root@nam-u18:/home/nam# service walinuxagent status
    ● walinuxagent.service - Azure Linux Agent
       Loaded: loaded (/lib/systemd/system/walinuxagent.service; enabled; vendor preset: enabled)
       Active: active (running) since Thu 2020-10-08 17:10:29 UTC; 3min 9s ago
     Main PID: 1036 (python3)
        Tasks: 4 (limit: 4915)
       CGroup: /system.slice/walinuxagent.service
               ├─1036 /usr/bin/python3 -u /usr/sbin/waagent -daemon
               └─1156 python3 -u bin/WALinuxAgent-2.2.51-py2.7.egg -run-exthandlers
    Oct 08 17:10:33 nam-u18 python3[1036]: 2020-10-08T17:10:33.129375Z INFO ExtHandler ExtHandler Started tracking cgroup: Microsoft.OSTCExtensions.VMAccessForLinux-1.5.10, path: /sys/fs/cgroup/memory/sys
    Oct 08 17:10:35 nam-u18 python3[1036]: 2020-10-08T17:10:35.189020Z INFO ExtHandler [Microsoft.CPlat.Core.RunCommandLinux-1.0.1] Target handler state: enabled [incarnation 2]
    Oct 08 17:10:35 nam-u18 python3[1036]: 2020-10-08T17:10:35.197932Z INFO ExtHandler [Microsoft.CPlat.Core.RunCommandLinux-1.0.1] [Enable] current handler state is: enabled
    Oct 08 17:10:35 nam-u18 python3[1036]: 2020-10-08T17:10:35.212316Z INFO ExtHandler [Microsoft.CPlat.Core.RunCommandLinux-1.0.1] Update settings file: 0.settings
    Oct 08 17:10:35 nam-u18 python3[1036]: 2020-10-08T17:10:35.224062Z INFO ExtHandler [Microsoft.CPlat.Core.RunCommandLinux-1.0.1] Enable extension [bin/run-command-shim enable]
    Oct 08 17:10:35 nam-u18 python3[1036]: 2020-10-08T17:10:35.236993Z INFO ExtHandler ExtHandler Started extension in unit 'Microsoft.CPlat.Core.RunCommandLinux_1.0.1_db014406-294a-49ed-b112-c7912a86ae9e
    Oct 08 17:10:35 nam-u18 python3[1036]: 2020-10-08T17:10:35.263572Z INFO ExtHandler ExtHandler Started tracking cgroup: Microsoft.CPlat.Core.RunCommandLinux-1.0.1, path: /sys/fs/cgroup/cpu,cpuacct/syst
    Oct 08 17:10:35 nam-u18 python3[1036]: 2020-10-08T17:10:35.280691Z INFO ExtHandler ExtHandler Started tracking cgroup: Microsoft.CPlat.Core.RunCommandLinux-1.0.1, path: /sys/fs/cgroup/memory/system.sl
    Oct 08 17:10:37 nam-u18 python3[1036]: 2020-10-08T17:10:37.349090Z INFO ExtHandler ExtHandler ProcessGoalState completed [incarnation 2; 4496 ms]
    Oct 08 17:10:37 nam-u18 python3[1036]: 2020-10-08T17:10:37.365590Z INFO ExtHandler ExtHandler [HEARTBEAT] Agent WALinuxAgent-2.2.51 is running as the goal state agent [DEBUG HeartbeatCounter: 1;Heartb
    root@nam-u18:/home/nam#
    

    如果服务正在运行,请重启它以解决问题。 如果服务已停止,请启动它,等待几分钟,然后再次检查状态。

  2. 确保已启用自动更新。 检查 /etc/waagent.conf 中的自动更新设置。

    AutoUpdate.Enabled=y
    

    有关如何更新 Azure Linux 代理的详细信息,请参阅 如何更新 VM 上的 Azure Linux 代理

  3. 确保 VM 可以连接到构造控制器。 使用 curl 等工具测试 VM 是否可以在端口 80、443 和 32526 上连接到 168.63.129.16。 如果 VM 未按预期连接,检查是否在 VM 上的本地防火墙中打开通过端口 80、443 和 32526 的出站通信。 如果阻止此 IP 地址,VM 代理可能会显示意外行为。

高级故障排除

用于排查 Azure Linux 代理问题的事件记录在 /var/log/waagent.log 文件中。

无法连接到 WireServer IP (主机 IP)

当 VM 无法访问主机服务器上的 WireServer IP 时,以下错误将显示在 /var/log/waagent.log 文件中。

2020-10-02T18:11:13.148998Z WARNING ExtHandler ExtHandler An error occurred while retrieving the goal state:

若要解决该问题,请执行下列操作:

  • 使用 SSH 连接到 VM,然后运行以下命令以测试 VM 与 WireServer 之间的连接。 运行命令需要根权限。

    curl http://168.63.129.16/?comp=versions
    
  • 检查防火墙、代理或其他可能阻止访问 IP 地址 168.63.129.16 的源引起的任何问题。

  • 检查 Linux IPTable 或第三方防火墙是否阻止了对端口 80 和 32526 的访问。

联系我们寻求帮助

如果你有任何疑问或需要帮助,请创建支持请求联系 Azure 社区支持。 还可以向 Azure 反馈社区提交产品反馈。