Install QEMU Guest Agent

The QEMU Guest Agent is a helper daemon, which is installed in the guest. It is used to exchange information between the host and guest, and to execute command in the guest. The agent uses QEMU's native guest agent. The official agent is a comprehensive and reliable choice in terms of security endorsement, maintenance, and stability.

Elastic Compute offers a high-level view of your instance metrics using the Performance tab in zenConsole. All instances have basic performance data available when they are created. However, installing the QEMU guest agent provides deeper insights into instance behavior including the following additional metrics:

  • System Load Average - Last 1 Minute

  • System Load Average - Last 5 Minutes

  • System Load Average - Last 15 Minutes

  • Memory Utilization

  • Disk Utilization

  • Uptime

Note

  • The QEMU guest agent will be successfully installed and collect data only when you select a default public IPv4 while creating your instance.

  • For Windows operating system, the QEMU guest agent is already installed by default. You can disable the data collection as you need.

For instances with Rocky, CentOS, AlmaLinux, Alpine and FreeBSD operating systems, you need to manually configure the agent on the instance to activate it by following the steps below.

Rocky/CentoS/AlmaLinux

The agent is disabled by default. You need to modify the /etc/sysconfig/qemu-ga file.

  1. Open the file in a text editor:

    sudo vi /etc/sysconfig/qemu-ga
  2. Update the FILTER_RPC_ARGS to enable the desired RPCs. Add the following line or modify it if it already exists:

    FILTER_RPC_ARGS="--block-rpcs=guest-file-seek,guest-file-flush,guest-exec,guest-exec-status"
    
    # Guest agent command with comma-separated allowed RPCs to enable,
    # or empty list to disable all.
    #
    # You can get the list of RPC commands using "qemu-ga --allow-rpcs='?'".
    # There should be no spaces between commas and commands in the allow list.
    FILTER_RPC_ARGS="--allow-rpcs=guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-sync-delimited,guest-sync,guest-ping,guest-get-time,guest-set-time,guest-info,guest-shutdown,guest-fsfreeze-status,guest-fsfreeze-freeze,guest-fsfreeze-freeze-list,guest-fsfreeze-thaw,guest-fstrim,guest-suspend-disk,guest-suspend-ram,guest-suspend-hybrid,guest-network-get-interfaces,guest-get-vcpus,guest-set-vcpus,guest-get-disks,guest-get-fsinfo,guest-set-user-password,guest-get-memory-blocks,guest-set-memory-blocks,guest-get-memory-block-info,guest-get-host-name,guest-get-users,guest-get-timezone,guest-get-osinfo,guest-get-devices,guest-ssh-get-authorized-keys,guest-ssh-add-authorized-keys,guest-ssh-remove-authorized-keys,guest-get-diskstats,guest-get-cpustats"
  3. Restart the QEMU guest agent service

    sudo systemctl restart qemu-guest-agent

Alpine Linux

The agent is disabled by default.

  1. Start the QEMU guest agent service:

    sudo rc-service qemu-guest-agent start
  2. Check the status of the QEMU guest agent service:

    sudo rc-service qemu-guest-agent status
  3. Edit the QEMU guest agent init script:

    • Open the init script in a text editor:

      sudo vi /etc/init.d/qemu-guest-agent
    • Find the command_args line and modify it to enable verbose logging:

      command_args="--verbose -m ${GA_METHOD:-virtio-serial} -p ${GA_PATH:-/dev/virtio-ports/org.qemu.guest_agent.0} -l /var/log/qemu-ga.log -d"
  4. Restart the QEMU guest agent service:

    sudo rc-service qemu-guest-agent restart

FreeBSD

The agent is disabled by default. You can view the official documentation for more details.

  1. Modify /etc/rc.conf to enable the QEMU guest agent:

    • Open /etc/rc.conf in a text editor:

      sudo vi /etc/rc.conf
    • Add the following lines to enable and configure the QEMU guest agent:

      qemu_guest_agent_enable="YES"
      qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
  2. Start the QEMU guest agent service:

    sudo service qemu-guest-agent start
  3. Verify the status of the QEMU guest agent service:

    sudo service qemu-guest-agent status

Expected Outputs

  • Service status when not running:

    sudo service qemu-guest-agent status
    qemu_guest_agent is not running.
  • Service start output:

    sudo service qemu-guest-agent start
    Starting qemu_guest_agent.
    1715676493.359902: debug: Guest agent version 8.2.2 started
  • Service status when running:

    sudo service qemu-guest-agent status
    qemu_guest_agent is running as pid 2051.

Last updated