OpManager Nexus APM Insight Java agent – Ansible role

Overview

You can perform the bulk installation of the OpManager Nexus APM Insight Java agent on your application servers using an Ansible role. It supports popular application servers and frameworks like Apache Tomcat, JBoss, Oracle WebLogic, and WildFly.

Requirements

  • The unzip command must be available on target hosts.
  • Supports operating systems such as RedHat, Rocky, AlmaLinux, Debian, and Darwin.
  • Ansible should be installed on the control node. Ansible Installation Guide.

Configuration

The following properties can be configured in the OpManager Nexus APM Insight Ansible role to enable application performance monitoring.

APM Insight configuration properties

These settings can be specified through the apminsight_props variable to define essential configurations for application monitoring.

Property Description Required
app_name The name of the application being monitored. If not provided, an auto-generated name will be assigned based on the server group in the inventory file. No
license_key The OpManager Nexus APM Insight license key used for authentication and data collection. Obtain this key from your OpManager Nexus account. Yes

Role installation properties

These properties define the server-specific configurations required to integrate the OpManager Nexus APM Insight agent with your web server.

Property Description Required Default
server_type Specifies the web server type (e.g., tomcat, jboss, weblogic, wildfly). This ensures compatibility with the agent. Yes -
server_version Defines the web server version to ensure proper configuration. No -
jvm_config_file Path to the JVM configuration file used by the web server. If the file does not exist, it will be created. 
Example: setenv.sh for Tomcat.
Yes -
service_name Service name of the application server to restart after installing the agent. No -
restart_web_server Determines whether the web server should restart after installation. No true
agent_download_dir Directory where the agent files will be stored. No /opt/apm
enable_agent Controls whether the APM Insight agent is enabled. If set to false, no data collection will occur. No true

Installation of OpManager Nexus APM Insight Java agent with Ansible

Follow the steps to configure the OpManager Nexus APM Insight Java agent on your application servers using an Ansible role.

Step 1: Extract and set up the role

  1. Use the following command to extract the Ansible role and rename it to OpManager Nexus-APM:
curl -L -o Site24x7-APM-Ansible-main.zip https://github.com/site24x7/Site24x7-APM-Ansible/archive/refs/heads/main.zip && unzip Site24x7-APM-Ansible-main.zip && mv Site24x7-APM-Ansible-main Site24x7-APM
Note

Create a playbook named my-playbook.yml and an inventory file named my-inventory.yml, and place both files alongside the OpManager Nexus-APM folder.

  1. Once the zip file is extracted using the command above, the final folder structure, including the my-playbook.yml and my-inventory.yml files, should appear as follows:

    ├─ OpManager Nexus-APM
    ├    ├── defaults
    ├    ├── handlers
    ├    ├── meta
    ├    ├── tasks
    ├    ├── tests
    ├    ├── vars
    ├    ├── README.md
    ├─ my-playbook.yml
    ├─ my-inventory.yml

Step 2: Configure the inventory and playbook

  1. Create an inventory file as follows.

    Example my-inventory.yml file:

    prod_webserver:
      vars:
        ansible_user: fedora
        ansible_password: <Your Host Password>
        ansible_sudo_pass: <Your Sudo Password>
        server_type: tomcat
      hosts:
        java_server_one:
          ansible_host: 10.0.20.5
          java_agent_host_config:
            app_name: Example App
        java_server_two:
          ansible_host: 127.0.40.2
  1. Create a playbook file as follows.

    Example my-playbook.yml file:

    - hosts: prod_webserver
      vars:
        apminsight_props:
          app_name: <Your Application Name>
          license_key: <Your License Key>
        install_props:
          server_type: 'tomcat'
          jvm_config_file: '/usr/share/tomcat8/bin/setenv.sh'
          service_name: 'tomcat'
          server_version: '8'
          restart_web_server: true
      tasks:
       - include_role:
           name: Site24x7-APM
Note

The license_key property is mandatory and must be retrieved from your OpManager Nexus APM Insight page.

Step 3: Install the agent

  1. Run the Ansible playbook using the following command:
    ansible-playbook -i ./my-inventory.yml ./my-playbook.yml
  1. Verify that the agent is installed and the application server is running as expected.

Uninstallation

To uninstall the OpManager Nexus APM Insight Java agent using Ansible, you can use the following variable property in your Ansible playbook:

Property Description Required Default
uninstall set to true to uninstall the agent Yes -

Example Ansible playbook

Here is an example Ansible playbook that uninstalls the OpManager Nexus APM Insight Java agent:

Example uninstall-playbook.yml file:

- hosts: webservers
  vars:
    uninstall: true
    ansible_sudo_pass: <Your Sudo Password>
  tasks:
   - include_role:
       name: Site24x7-APM

Execute the following command to run the playbook for uninstallation.

ansible-playbook -i ./my-inventory.yml ./uninstall-playbook.yml
Notes
  • The uninstallation steps will only work if the OpManager Nexus APM Insight Java agent is installed using Ansible.
  • Make sure to set the uninstall variable to true to uninstall the agent. If you set it to false or omit it, the agent will not be uninstalled.
  • Replace webservers with the name of your host group in your Ansible inventory file.
  • Make sure to include the OpManager Nexus-APM role in your playbook to uninstall the agent.
Shortlink has been copied!