News, tips, partners, and perspectives for Oracle’s virtualization offerings

How to automate an Oracle Enterprise Manager 13c agent install to a VM using Oracle Linux Virtualization Manager

Simon Hayler
Senior Technical Product Manager


Oracle Linux Virtualization Manager coupled with Oracle Enterprise Manager is a powerful combination. Based upon the open source oVirt project, Oracle Linux Virtualization Manager is a server virtualization management platform that can be easily deployed to configure, monitor, and manage an Oracle Linux kernel-based Virtual Machine (KVM) environment. Oracle Enterprise Manager is a complete, integrated, and business-driven enterprise cloud management solution. Oracle Enterprise Manager 13c is the recommended management framework for managing Oracle Infrastructure Software and Oracle Engineered Systems. The first step for inclusion within the Oracle Enterprise Manager framework is the installation of the Oracle Enterprise Manager agent. Once the agent is installed a host target is created which then enables higher level monitoring.

This post will discuss how to automate this installation of the Oracle Enterprise Manager agent as part of the Virtual Machine provisioning process using tools within Oracle Enterprise Manager and Oracle Linux Virtualization Manager.

High level steps

Using Oracle Linux Virtualization Manager create an Oracle Linux 7 host based upon the latest update ISO. A useful set of video's is available here, review the Creating a Virtual Machine in Oracle Linux Virtualization and Uploading Resources to a Data Storage Domain with Oracle Linux Virtualization Manager video's.

Once the Oracle Linux 7 host is created, install and configure the host to enable the Oracle Enterprise Manager agent install via the AgentPull script method. Documentation on this method is here.

Create an Oracle Linux Virtualization Manager template from the newly created and prepared Oracle Linux 7 host. Using the video portal above, review the Creating a Template from a Virtual Machine in Oracle Linux Virtualization Manager video.

Create a new host based upon the newly created template which is ready to have the Oracle Enterprise Manager agent automatically installed. Using the video portal above, review the Creating a Virtual Machine from a template in Oracle Linux Virtualization Manager video.

My environment

Within the lab I have the following:

Oracle Enterprise Manager 13c version 13.4

Oracle Linux Virtualization Manager version 4.3.6 with a single KVM host

Access to an Oracle Linux 7 x86-64 latest ISO

Template target host configuration steps

During the install of Oracle Linux 7 using a minimal install, configuring DHCP networking and accepting all the defaults, I created a user (oma, which I use often and for me stands for Oracle Management Agent) with password to use for the Oracle Enterprise Manager agent install.

If a proxy server exists in your environment then an entry needs to be added to /etc/yum.conf

Once the host was installed, I carried out the following configuration steps to prepare the host for the Oracle Enterprise Manager agent install:

  •    Create a sudo entry for user oma with the ability to run commands as root with no password
  •    Create a firewall rule for the Oracle Enterprise Manager agent using the default port of 3872 (As this was a minimal install neither iptables or ip6tables was installed and running)
    • For example:
      • sudo firewall-cmd - permenant --zone=public --add-port=3872/tcp
      • sudo firewall-cmd --reload
  • Change the selinux status from enforcing to permissuve
    • For example:
      • sudo setenforce 0
      • sudo sed -i 's/enforcing/permissive/g' /etc/selinux/config /etc/selinux/config
  • Create a directory for the Oracle Enterprise Manager agent install, in my example this is /home/oma/emagent. Being in the oma host directory and created by the oma user it has the correct permissions for the agent install
  • Install the following rpm's to enable the agent install:
    • zip unzip curl make binutils gcc libaio glibc-common libstdc++ sysstat
      • For example sudo yum install -y <target list of rpm's>
  • Start and enable the Oracle Linux Virtualization agent rpm, for example:
    • sudo systemctl start qemu-agent.service
    • sudo systemctl enable qemu-agent.service
  • Install and enable the cloud-init key services to enable the automation for the agent install
    • For example:
      • sudo yum install -y cloud-init
      • sudo systemctl enable cloud-init
      • sudo systemctl enable cloud-final
  • Update the OS to the latest, for example:
    • sudo yum update
  • Shut the host down and create a template, use the video referenced in the High level steps section above.

Template install flow

Using the video referenced in the High level steps section, create a VM using the template we firstly configured. To enable the automation we need to provide configuration within the Initial Run section.

The screenshot above shows the Initial Run section with our template chosen which is em-template-iso. We also need to click the box next to Use Cloud-Init/Sysprep.

Next, we fill in our hostname, set our timezone and expand the Authentication section. For us this is not needed (and is shown as blank) as we created our user for the Oracle Enterprise Manager agent install as part of the configuration process. The authentication section is very useful for creating users based on passwords or ssh keys.

Next, we click Networks and fill in the relevant areas for our target networking; my example is ipv4 with static IP details. The Oracle Enterprise Manager agent prefers a fully qualified domain name with fixed IP address rather than a DHCP address which could change.

Finally, we click to expose the Custom Script area, this area is where we can use cloud-init to drive our configuration of the Oracle Enterprise Manager agent install.

The cloud-init script below is an example which once modified to suit your local environment can be copied or typed into the Custom Script panel.

In my example below I have used "my_em_user" as the Oracle Enterprise Manager user with "my_em_password" as the login password; I have also used "my_agent_registration_password" as the Oracle Enterprise Manager Agent registration password which is set when Oracle Enterprise Manager is installed. As stated above the variables below need to be evaluated and edited to suit your local environment.

The top "#cloud-config" definition must exist at the top of the script. Within the runcmd section the correct Oracle Enterprise Manager hostname and port should be inserted, in my example I have "https://myoms.oracle.com:7803"

- content: |
       PLATFORM="Linux x86-64"
  path: /home/oma/agent.properties
  owner: oma:oma
  permissions: '0755'
- 'su - oma sh -c "curl "https://myoms.oracle.com:7803/em/install/getAgentImage" --insecure -o AgentPull.sh"'
- 'su - oma sh -c "chmod +x /home/oma/AgentPull.sh"'
- 'su - oma sh -c "/home/oma/AgentPull.sh RSPFILE_LOC=/home/oma/agent.properties"'
- '/home/oma/emagent/agent_13.'

Write_files definition

The write_files definition creates a response file in the oma users home directory, here I have defined a user name and password within my Oracle Enterprise Manager 13c 13.4 system, also I have defined the agent registration password as well as the platform (Linux x86-64). In my case my Oracle Enterprise Manager 13c system is based upon Oracle Linux x86-64 and therefore would have the Linux x86-64 platform agent already installed and available. If you system is not based upon Linux x86-64 then you need to refer to the documentation with regard to the extensibility framework to download the Linux x86-64 platform agent. This section creates the file and provides the correct permissions and ownership.

Runcmd definition

The runcmd definition is where commands are run upon the initial or first boot; the cloud-init and cloud-final service have to be enabled to run at boot time. Commands in this section are placed into a script which is located in /var/lib/cloud/instance/scripts/runcmd and in the event of a failure can be run separately as root to check the validity of the commands.

These commands perform the following:

  •     Obtain the AgentPull.sh script which is pre-configured for the pulling of the Oracle Enterprise Manager agent components from the Oracle Enterprise Manager server via the curl utility
  •     Changes the permissions of the script and also makes the script executable
  •     Runs the script using the response file created in the write-files section
  •     Finally runs the root script at the end of the agent install

Once this section is complete, click OK, the VM can now be started where the response file will be created and then used by the AgentPull.sh script for a hands off automated Oracle Enterprise Manager agent install. When all scripts have run the Host target should appear within the Oracle Enterprise Manager UI as a managed and promoted target.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.