Monitoring JBoss 7 with Monitis

free-website-monitoringWhen JBoss 7 was released, those familiar with earlier versions were taken by surprise – many familiar features were gone or completely redesigned. For instance, the JMX Console – a long-time staple of JBoss administration – was missing. While RedHat says JMX is still supported, their focus has clearly shifted – away from JMX and on to a new management indrastructure, specifically designed for JBoss. There are 3 ways to manage JBoss 7:

  • The Web Interface (Admin Console). Although it looks different than in previous versions, it is self-explanatory and thus fairly simple to use
  • The command-line client (CLI) allows administrators to write scripts to automate certain tasks. While it is very powerful, it is too verbose – which makes it impractical to use from the command line on a regular bases.
  • An entirely new HTTP management API enables programmatic access to management operations. The interface returns results encoded as JSON objects, which makes it really easy to develop sophisticated monitors in a variety of languages

In this article I will show you how to use the HTTP/JSON Management API along with the Monitis open API to collect JBoss 7 statistics and upload them to Monitis. So let’s get started.

After you have installed JBoss 7, you will need to create a management user by invoking the management script as described here. Once the app server is up and running, verify your admin user can login by logging in from the CLI at a shell prompt:

[jsmith@tramp bin]$ pwd
[jsmith@tramp bin]$ ./
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
Authenticating against security realm: ManagementRealm
Username: jbadmin
Password: <Enter admin password>
[standalone@localhost:9999 /]

Once you establish that your login works fine, let’s try to make an HTTP request to the management interface. Open up a web browser on the server machine and navigate to: http://localhost:9990/management/subsystem/datasources/data-source?json.pretty. Be aware that, for security reasons, the HTTP interface only accepts connections on the home interface (localhost or – you cannot connect to the management interface from another machine under the default settings. Assuming that all went well, you should see an output like this:

    "xa-data-source" : null,
    "data-source" : {
        "AsteriskDS" : null,
        "ExampleDS" : null
    "jdbc-driver" : {
        "postgresql-driver" : null,
        "h2" : null


This output tells us that there are two JDBC datasources configured on the server – in this case they are named AsteiskDS and ExampleDS. (You guessed it – the json.pretty parameter is only used to format the results nicely; you can safely omit it in any scripts that invoke the management interface)

A few words about the Monitis Java SDK are in order. The SDK is a Java implementation of the Monitis Open API. Similar to the perl SDK and Python SDK, it enables you to programmatically create custom monitors and upload data to them.

Now that you have all the pieces of the puzzle, let’s put them all together. You can download the Monitis JBoss Monitor (along with the rest of the Java monitors and associated code) from our GitHub repository like so:

[jsmith@tramp tmp]$ git clone
Initialized empty Git repository in /home/jsmith/tmp/Monitis-Java-Plugins/.git/
remote: Counting objects: 375, done.
remote: Compressing objects: 100% (265/265), done.
remote: Total 375 (delta 95), reused 327 (delta 47)
Receiving objects: 100% (375/375), 9.41 MiB | 1.41 MiB/s, done.
Resolving deltas: 100% (95/95), done.
[jsmith@tramp tmp]$ cd Monitis-Java-Plugins/JBoss7Monitor

Let’s briefly examine the project’s directory structure:

  • dist contains the binaries bundled as a jar file.
  • lib is where the library jars such as the Monitis SDK and necessary third-party jars live
  • properties contains the configuration file (monitor.config)
  • docs is where you will find the Javadoc-generated documentation

Before you can run the monitor, you will need to modify monitor.config. Here are the settings you need to change:

  • apiKey/secretKey To get the correct values for your account, log on to the Monitis dashboard and select Tools -> API -> API Key
  • username/password These are the JBoss 7 admin credentials you created on the server
  • mgmtObject This is the URL to the JBoss 7 management operation. Make sure it reflects the name of the data source you wish to monitor

You are now ready to start the monitor. To do that, go to the bin folder and run the JAR file as follows:
java -jar jboss7-monitor.jar

At this point you should see diagnostic messages on the standard output. Log on to your Monitis dashboard and add the monitor (Monitors -> Manage Monitors -> Custom Monitors):
Monitoring JBoss 7 with Monitis

Although the binary version is fully operational, if you feel adventurous you may decide to make changes and recompile the code. You will need JDK 6 or higher, and Ant 1.7.1 or higher. Once you make sure you have them, go to the project’s root folder (Monitis-Java-Plugins/JBoss7Monitor, where the Ant build file build.xml is located) and issue the ant command at the prompt. Once the build process completes, it will create a new JAR file in the dist folder.

Than’t is, feel free to examine the monitor source code and experiment with the Java SDK – it is really easy to create your own custom monitors.

You might also like