Using Chef to Boost the Effectiveness of Your ManageEngine Applications Manager Solution
Setting up and configuring the Applications Manager from scratch takes time. Learn to automate these processes with Chef.
Join the DZone community and get the full member experience.Join For Free
ManageEngine Applications Manager is an application performance monitoring tool that unobtrusively monitors business applications that help businesses ensure their revenue-critical applications run efficiently and meet end user expectations. Applications Manager offers out-of-the-box monitoring support for 80+ applications and servers.
Today, you will learn how to roll your own cookbook using the basic concepts behind Chef for integrating insightful end-to-end monitoring with Applications Manager into every part of your enterprise application in a few seconds.
In this blog, I will show you how to install the ManageEngine Application Manager using Chef. This solution uses a chef cookbook named Install_APM which contains recipes to model the infrastructure as code.
There is a large need in many IT organizations to configure Applications Manager to monitor Application/Web Servers, Performance, ERP, and Services etc. on pre-production and production environments. Manually installing and configuring Applications Manager on multiple environments is time-consuming and requires human intervention that is prone to error. It takes enormous time and effort to create the required application and infrastructure specific monitors from scratch in a new environment.
Let’s assume that our pre-production environment is made up of physically separated instances of Apache HTTPd web servers, Apache Tomcat application servers, and PostgreSQL DB respectively, and is monitored using Applications Manager. Now, if we want to replicate the similar setup of Applications Manager and the existing monitors in order to get the same level of visibility in the production environment, we have to recreate the entire Applications Manager setup along with the configuration from scratch. We have to install Applications Manager and create monitors for each application, database, and server to be monitored and make sure that all servers are configured to relay their data to a central Applications Manager server nearby, making it a complex and time-consuming activity.
To overcome the above challenges, we have come up with the automation of ManageEngine Applications Manager installation and ability to import/export the entire set of monitors and configuration details on Windows environment using Chef. This solution is compatible with Windows 7, Windows 8, Windows Server 2008 R2, and Windows Server 2012 R2.
Chef is a powerful IT automation tool for environment and infrastructure provisioning, configuration management, and application deployment. Whether you have five or five thousand servers, Chef lets you manage them all by turning infrastructure into code. Infrastructure described as code is flexible, versionable, human-readable, and testable. Whether your infrastructure is in the cloud, on-premises, or in a hybrid environment, you can easily and quickly adapt to your business’s changing needs with Chef. The rich set of available Chef resources, prebuilt resources, definitions allowed us to automate the installation and configuration of Applications Manager without the need for custom scripting.
Here are the HW/SW used to implement this solution:
- Chef Server: We have used the Hosted Chef server.
- WorkStation: Windows 7.
- RAM: 4 GB minimum.
- Chef Nodes: Tested on Windows Server 2008 and above.
- ChefDK Version 1.0.3 on Windows 7 workstation.
Download URL: https://downloads.chef.io/chefdk.
- Chef-client version 12.19.36.
- Applications Manager installer version 13.
- Applications Manager installer response file (setup.iss).
- Applications Manager database backup file.
The Windows Application Manager Package comes bundled in the form of a binary file and can be installed using either GUI mode or silent mode.
In GUI mode, the installer is launched from the setup.exe file and relevant parameters like passwords, port numbers etc. are provided as input.
In silent mode, you launch the Windows installer from a command prompt and a silent installation file named as setup.iss is passed as a parameter. This setup.iss file is an answer file and provides the necessary input to the Windows binary installer.
Step 1: Preparation of the setup.iss Configuration File
- Open a command line console. Change directories to the folder containing the Application manager exe.
- In the command line, type the following: installer.exe /r
- Press Enter to launch the installation program.
- Follow the on-screen instructions to enter your preferred installation settings until you reach the final screen of the setup program.
- These settings are recorded in the response file setup.iss file and place it in the C:\WINDOWS directory. Click Cancel to abort the installation.
Step 2: Cookbook Creation
We created a cookbook named Install_APM using the command
# chef generate cookbook Install_APM , which will be used for installing and configuring Application manager on our Windows Server 2008 R2 host.
You will see the cookbook created with a directory structure as shown below:
The Application Manager installer, the response file created in Step 1, and the database backup file were all stored inside the \chef-repo\cookbooks\Install_APM\files\default\ directory of Chef Workstation and then used under the “source” attribute of the “template” resource in the given recipes.
Step 3: Developing Chef Recipes
We have created two separate recipes, Install.rb and Restoreconfig.rb, to deal with the Applications Manager installation and configuration activity, respectively.
This recipe takes care of the Applications Manager installation with the usage of 'directory,' 'cookbook_file,' and 'windows_package' Chef resources, wherein it
- First transfers the downloaded Applications Manager Windows installer and setup.iss file from the Hosted Chef server to the Windows Chef node, then
- Starts the unattended installation of ManageEngine Applications Manager, referencing the setup.iss file.
This is the code for install.rb:
Applications Manager is a data driven application and stores all of its configuration changes and library information inside the PostgreSQL database. The main purpose of this recipe is to restore the pgsql database of newly created Applications Manger’s instance using the DBbackup.zip file (this file can be created by following the usual steps for taking PostgreSQL database backup).
This recipe will do the below activities:
- Stop the Application Manager service.
- Copy the database backup file to chef node \tmp directory.
- Run batch script Restoredb.bat which will invoke RestorePGSQLDB.bat file available in the location ‘C:\Program Files\ManageEngine\AppManager13\bin’ to restore the Applications Manager configuration files and data.
- Start the Application Manager service.
The source for the recipe is listed below:
Common Challenges/Problems We Faced
- To understand the Applications Manager tool installer type, and to identify the method to create the ‘answer file’ customarily named setup.iss which is mainly required to implement silent installation.
- To identify the Chef resources which better serve the Applications Manager installation requirement.
- In order to restore the database from a backup file, the build version of Applications Manager should be same, though people have claimed to successfully migrate from a lower version to higher version.
- Reduced the human intervention and error during software installation and configuration.
- Improved operational efficiency
- Less complexity to manage multiple environment configurations.
- The overall process just takes 5 – 6 mins of time, thus saving us around 30 - 40 minutes of precious time taken earlier, as can be seen in below execution log.
This approach is an efficient and automated way to enable end-to-end monitoring within a fraction of the time for enterprise applications by reducing the overhead of recreating the entire monitoring setup from scratch.
This level of automation has the capability to import/export all types of monitor groups maintained in the Applications Manager from one application environment to other. Enterprise applications, no matter how complex they are, can easily be automated. Automation not only produces defined and consistent outcomes, particularly in huge environments, it can also save you a lot of time.
Opinions expressed by DZone contributors are their own.