How to obtain an IP Address for a KVM Virtual Machine in APM

How to obtain an IP Address for a KVM Virtual Machine in APM

What is qemu-guest-agent?
  1. 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.
  2. The qemu-guest-agent is used for mainly two things:
    1. To properly shutdown the guest, instead of relying on ACPI commands or windows policies.
    2. To freeze the guest file system when making a backup (on windows, use the volume shadow copy service VSS).
  3. IP Address for a Virtual Machine will obtained only when the qemu-guest-agent is installed on that specific Virutal Machine.
Installation:
Host:
  1. You have to enable the guest-agent per VM, either set it in the GUI to "Yes" under options (see screenshot):
    Qemu Guest Agent Option
Guest:

Linux:

  1. Below Command needs to be executed to install qemu-guest-agent package on Linux.
    1. For Debian/Ubuntu, apt-get install qemu-guest-agent.
    2. For Redhat, yum install qemu-guest-agent.
  2. Depending on the distribution, the guest agent might not start automatically after the installation. Either reboot the guest or start it with the command systemctl start qemu-guest-agent.

Windows:

  1. First you have to download the virtio-win driver iso.
  2. Then install the virtio-serial driver:
    1. Attach the ISO to your windows VM (virtio-*.iso)
    2. Go to the windows Device Manager
    3. Look for "PCI Simple Communications Controller"
    4. Right Click -> Update Driver and select on the mounted iso in DRIVE:\vioserial\<OSVERSION>\ where <OSVERSION> is your Windows Version (e.g. 2k12R2 for Windows 2012 R2)

  3. After that, you have to install the qemu-guest-agent:
    1. Go to the mounted ISO in explorer.
    2. The guest agent installer is in the directory guest-agent.
    3. Execute the installer with double click (either qemu-ga-x86_64.msi (64-bit) or qemu-ga-i386.msi (32-bit).
  4. After that the qemu-guest-agent should be up and running. You can validate this in the list of Window Services, or in a PowerShell with:
    1. PS C:\Users\Administrator> Get-Service QEMU-GA
      
      Status   Name               DisplayName
      ------   ----               -----------
      Running  QEMU-GA            QEMU Guest Agent
      
      
    2. If it is not running, you can use the Services control panel to start it and make sure that it will start automatically on the next boot.
Testing that the communication with the guest agent is working:

The communication with the guest agent takes place over a unix socket located in /var/run/qemu-server/<my_vmid>.qga You can test the communication qm agent:

qm agent <vmid> ping

If the qemu-guest-agent is correctly runnning in the VM, it will return without an error message.


                    New to ADSelfService Plus?

                      • Related Articles

                      • Azure Virtual Machine - FAQ

                        1. How is data collection happening for Azure Virtual Machine monitors? Microsoft Azure monitor discovery modes in AppManager: AD Application mode Organizational Account mode OAuth mode Azure VM monitor - Data collection methods: Azure Monitor Azure ...
                      • How to get an IP Address for Hyper-V Linux VM in APM?

                        Hyper-V Integration Service: Hyper-V Integration Services enhance virtual machine performance and provide convenience features by leveraging two-way communication with the Hyper-V host. How to Install the Linux Integration Service in Hyper-V Linux ...
                      • First Step to do if no data is available for a KVM Host Monitor

                        In KVM all the data has been collected via CLI Commands. So if any of data is not retrieved properly in the UI, we can check it by executing CLI Commands. The below table contails the List of CLI Commands used for each metrics present under the KVM ...
                      • Upgrade guide for OpManager v 12.7 and APM Plugin

                        After downloading the service pack for OpManager and the compatible service pack for Applications Manager Plugin (APM Plugin) to OpManager installed server, start the upgrade process for OpManager and APM Plugin by following the steps below: Note: If ...
                      • IP Whitelist/Blacklist configuration

                        Applications Manager does not have support for filtering access through the request ip's. However making use of the underlying Tomcat app server, this can be achieved.  Users should ideally use a network firewall to restrict IP based access (this is ...