Managing JBoss Application Server 7 with System Center Operations Manager 2012 R2: Part 1 – Standalone Mode

Java Application Server management with System Center Operations Manager has been available since 2010, and with the latest Management Pack update http://www.microsoft.com/en-us/download/details.aspx?id=44576  JBoss Application Server 7 support is finally available.

JBoss Application Server 7 can be booted in two distinct operating modes: standalone and domain mode. Standalone mode is the most familiar to past JBoss Application Server users, and consists of an independent process. The second operating mode is the newly introduced domain mode. Domain mode allows multiple JBoss Application Server instances to be managed from a single domain controller spanning the same or different servers. For more information on operating modes refer to the following JBoss documentation https://docs.jboss.org/author/display/AS7/Operating+modes

The latest Java EE Management Pack update allows for both of these operating modes to be monitored on Linux* and Windows.

*Linux platforms are limited to those that are supported by System Center Operations Manager. Refer to the JBoss Management Pack guide for a complete list of platform and version support.

This blog series details managing a JBoss AS 7 application server running in first standalone mode and then domain modes on a CentOS Linux machine. This first blog post goes through a guided setup of a JBoss AS 7 running in standalone mode.

Basic Setup

My environment consists of a clean CentOS 7 64-bit Linux machine without JBoss Application Server 7 installed. My CentOS 7 64-bit machine is already managed by Operations Manager 2012 R2 with Update Rollup 4 installed. For more details on managing a Linux machine with System Center Operations Manager please refer to the following http://blogs.technet.com/b/kevinholman/archive/2012/03/18/deploying-unix-linux-agents-using-opsmgr-2012.aspx

In addition we also need the UNIX/Linux UR4 Management Packs http://www.microsoft.com/en-us/download/details.aspx?id=29696 and the new Management Packs for Java EE – linked above

Obtaining the Java EE Management Pack and JBoss MP Guide 

Go online and download the MSI and the Management Pack Guide

Once the download is complete run the MSI and then navigate to the installation directory. The files are installed in “C:\Program Files (x86)\System Center Management Packs\System Center 2012 R2 Management Packs for Java EE” by default.

After verifying that the management packs are present, begin importing the following management packs to manage JBoss Application Server

  • Microsoft.JEE.Library.mpb
  • Microsoft.JEE.JBoss.7.mp
  • Microsoft.JEE.JBoss.Library.mp
  • Microsoft.JEE.Templates.Library.mpb

Once imported switch to the Linux machine to set up JBoss Application Server.

Installing JBoss Application Server 7 on CentOS Linux 7 x64

Downloading the JBoss application server files 

  • On the CentOS machine create a directory “/jboss” to store the application server and then change into that directory.

 mkdir /jboss

 cd /jboss

  • Inside this new /jboss directory download the 7.1.0.Final.zip from the JBoss download site.

 wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.0.Final/jboss-as-7.1.0.Final.zip

    • Alternatively, the zip file can be directly downloaded from the website and transferred to the Linux box.

Setting up the application server

  • After the application server is downloaded unzip the contents

 unzip jboss-as-7.1.0.Final.zip

  • Once the package has fully inflated, change into the application server's bin directory

 cd /jboss/jboss-as-7.1.0.Final/bin

  • Let's make sure that all our important files are present by issuing an `ls`
  • There are a couple of configuration programs, admin programs, and start up scripts for both standalone and domain mode

Starting the server in standalone mode

  • One of the selling points of JBoss AS 7 is quick setup and launch, and with these steps completed we can go ahead and kick the server off. Within the bin directory issue the following command.

 ./standalone.sh -b <ip-address>

  • If you run into errors here make sure that Java is installed on the Linux machine and ensure that port 8080 is not blocked by common applications (e.g. Apache HTTP Server)
  • The application server starts up, and prints a list of services running and ports that are active for your configuration.

Checkpoint for basic monitoring

  • Switch back to the Operations Manager console to see the base configuration of the JBoss Application Server discovered.
  • Discovery for the JBoss Application Server runs initially after Management Pack import and then runs on a time interval of 4 hours. This setting can be adjusted if faster discovery is required.

Configuring the JBoss Application Server

Background

The basic JBoss Application Server monitoring is useful if you only want to monitor the availability of the server; Operations Manager allows for much more meaningful metrics through a setting known as “deep monitoring”. Deep monitoring, at its core, consists of a monitored Java Application Server running a lightweight Microsoft developed Java component known as BeanSpy.

BeanSpy is a Java application that utilizes Java Management Extensions (JMX) to gather useful statistics from Managed Beans (MBeans). MBeans are object representations of resources running inside the Java virtual machine and can contain valuable data attributes and operations. BeanSpy can retrieve data from attributes, and invoke operations based on server permissions granted to the application.

BeanSpy is included the Management Packs for Java EE through a management pack task, or can be locally built from source located here https://github.com/MSFTOSSMgmt/BeanSpy. Once deep monitoring is enabled Operations Manager communicates directly with the BeanSpy running on the application server over HTTP/HTTPS.


Adding a JBoss management user

A JBoss management user has full access to the JBoss web management console, and can perform all the required configuration operations for deploying BeanSpy. The management user is only needed if using the JBoss web management console for configuration. This blog details configuring the JBoss application server with the included JBoss command line utility. Important Note: this is not the same user we monitor our MBeans with.

  • Add a user using the included script program in the application server's bin directory

 ./add-user.sh

  • The add-user program guides you through a series of options for configuring your management user.
    • For the type of user select (a), selected by default.
    • For the Realm name option leave the option blank.
    • For username and password enter your choice – I selected to use the classic admin and admin for my management user.
    • The program terminates with messages indicating the changes to the properties files in standalone and domain configuration directories.

Adding an Operations Manager monitoring user

In order to monitor the application server's jvm metrics we need to add a monitoring user who has monitoring and invoke privileges with BeanSpy.

  • Change into the configuration directory of the server

 cd /jboss/jboss-as-7.1.0.Final/standalone/configuration

  • In this directory create the following files
    • opsmgr-users.properties
      • this file contains the username and password
    • opsmgr-roles.properties
      • this file contains the username and associated role (e.g monitoring, invoke)
  • Edit the opsmgr-users.properties file and add the following username and password
  • Edit the opsmgr-roles.properties file and add the following username and password

Configuring the JBoss security domains

After adding the OpsMgr monitoring user proceed to configuring the security domain. this configuration can be done through the JBoss web management console, http://localhost:9990 by default, or by a JBoss command line program (jboss-cli.sh) installed with the server. This walkthrough uses jboss-cli to set up the needed security domains.

  • In the JBoss bin directory run the program jboss-cli.sh with the "-c" option to connect to the running server

 ./jboss-cli.sh -c

  • A prompt with operating mode, bind-address, and port indicates a successful connection to the application server

  • Run the following command ,"starting with /subsystem", in the JBoss command line program to create a security domain named "opsmgr"
    • These commands are also available in the MP guide

 [standalone@localhost:9999 /] /subsystem=security/security-domain=opsmgr:add(cache-type=default)

  • The printed outcome property indicates success or failure

  • Run the following command in the JBoss command line program to associate the opsmgr monitoring user with the newly created security domain

 [standalone@localhost:9999 /] ./subsystem=security/security-domain=opsmgr/authentication=classic:add(login-modules=[{"code"=>"org.jboss.security.auth.spi.UsersRolesLoginModule","flag"=>"required","module-options"=>[("usersProperties"=>" file:${jboss.server.config.dir}/opsmgr-users.properties "),("rolesProperties"=>" file:${jboss.server.config.dir}/opsmgr-roles.properties ")]}])

  • Another prompt indicates success, as well as an additional reload requirement

  • Restart the server – I terminate the JBoss process and then start it again using standalone.sh

Deploying BeanSpy and enabling deep monitoring

Now that the server is correctly configured, deploy BeanSpy and enable deep monitoring on the server.

Retrieving BeanSpy

BeanSpy can be retrieved through a management pack task, or by building from source located here https://github.com/MSFTOSSMgmt/BeanSpy . This blog uses the management pack task to retrieve the file.

  • On the management server under the JBoss configuration view locate the "Application Server Instance Tasks" on the right hand side

  • Select "Copy BeanSpy and Universal discovery files" and run the task
  • The files are now located in C:\Windows\Temp

    • BeanSpy.ear and BeanSpy.war allow for monitoring over HTTP/HTTPS with user authentication
    • BeanSpy.HTTP.NoAuth.ear and BeanSpy.HTTP.NoAuth.war allow for monitoring over HTTP without user authentication
  • This blog uses BeanSpy.war to monitor the JBoss application server over HTTP.
  • Move BeanSpy.war to the root folder on the Linux server

Deploy BeanSpy

  • Once BeanSpy is located on the Linux server start the JBoss command line interface again

 /jboss/jboss-as-7.1.0.Final/bin/jboss-cli.sh -c

  • Run the following command in the JBoss command line program to deploy BeanSpy.war to the server

 [standalone@localhost:9999 /] deploy ~/BeanSpy.war

  • The application server output prints out confirmation and deployment information

  • Ignore the “Failed to connect to com.interopbridges.scx.jmx” WARNINGs in the log messages.
    • They are expected based on which type of application server BeanSpy is deployed to

Validating correct BeanSpy deployment

  • Once BeanSpy is deployed, go to a web browser enter the following url http:<Jboss server ip-address>:8080/BeanSpy/Stats
    • this is the same page Operations Manager parses to retrieve performance information about the application server
  • A prompt pops up asking for credentials. Enter the opsmgr monitoring username and password
    • Username: opsmgrmonitor
    • password: secret

Creating the Run as profile

  • Now that BeanSpy is setup we create a run-as profile that Operations Manager uses to access the data BeanSpy pumps out
  • Navigate to the administration pane of the Operations Manager console and select profiles under "Run As Configuration" option

  • There are two types of JEE accounts: one for monitoring MBeans, and one for invoking MBean operations
  • Earlier in opsmgr-roles.properties I granted the opsmgrmonitor user the role for both monitoring and invoke, allowing us to use this account for both profiles
  • Double click "JEE Monitoring Account" and click on the Run As Accounts on the left hand side

  • Click the "Add" button then "New…" in the pane that pops up
  • For "Run As account type" select "Simple Authentication"

  • Under "Credentials" enter the previously used username and passwords
    • Account Name: opsmgrmonitor
    • Password: secret

  • Under "Distribution Security" I select "Less Secure", as this is a lab system, and then hit "Create" to finish.
  • After my account is created, the "Run As Account" field is populated with the new account
  • Select the option for "All targeted objects"

  • Click "OK" and "Save" in the Run As Profile Wizard
  • For the JEE Invoke account repeat the same steps

Enabling deep monitoring

  • Now that BeanSpy is deployed and Run As accounts are created, we enable deep monitoring to get all the metrics into Operations Manager
  • Because our application server and BeanSpy is running with HTTP , run the management pack task "Enable deep monitoring using HTTP"
  • Switch to the Deep Monitored Configurations" views and a new instance is now present

  • You now have a fully configured JBoss Application Server 7 managed by Operations Manager!!!

Part 2

Join me in part two where will manage a JBoss Application Server instances running in domain mode across multiple machines. Coming Soon ….