Share This
Related Posts
Tags
consulting customer case distributed monitoring education extension goodstart how-to how to Howto IFS load balanced monitoring merlin monitor monitoring monitoring solution monitor solution nagios network monitoring ninja nrpe nsclient++ op5 op5 logserver op5 monitor op5 monitor extension op5 partner op5 technology partner Open Source partner partners professional partner reference release notes service monitoring services SLA-reports snmp solution support sweden training value adding integrator video windows






How to monitor your application server with op5 Monitor and JMX4Perl
In this how-to we will cover how to monitor your application server via JMX with op5 Monitor with the plugin check_jmx4perl and the agent jolokia. We will also have a glance at monitoring application servers trough a JMX-proxy for agentless monitoring where agents are not possible to use.
Prerequisites
This guide covers the installation on op5 Appliance System 3.5.2 and op5 Monitor 5.4.3, but should also apply on CentOS 5. In this example Jboss6 is used as the server of choice. Make sure that you have perl, gcc and make installed, and the necessary ports opened in your firewall. Basic UNIX/Linux knowledge is needed.
Additional Information
JMX4Perl: http://labs.consol.de/lang/de/jmx4perl/
Agent information: http://www.jolokia.org/reference/html/agents.html
Proxy information: http://www.jolokia.org/reference/html/proxy.html
Security configuration: http://www.jolokia.org/reference/html/agents.html#agent-war-security
Disclaimer
This how-to is not officialy supported by op5. It is just a glimpse on how to preform monitoring of application servers with op5 Monitor. And I am not a sysadmin working with application servers all day long, so there may be some glitches here and there. This is not a security document, so it is your responsibility that your system is secure. Please refer to the developers manual for more information about securing your installation.
Installation
Note1: If you run a distributed and/or Load Balanced setup, you will need to install the plugin on all systems that are running jmx-checks.
Note2: When using a agentless approach these steps only applies for the server that is acting as proxy.
This command will most likely complain about the following dependencies: CBuilder, ParseXS and Module-Build.
Install them via rpm as described below. We have collected these rpm’s on our download site for your convenience.
Now it’s time to choose which components to install from the jmx4perl-package.
The required components are jmx4perl, and check_jmx4perl, although we recommend to install “j4psh” which is a JMX-shell that you can connect to JBoss and browse around the MBeans.
When this is done there may still be some missing dependencies and the Build-script will try to install these by itself.
Run the following commands:
If all goes well you should have JMX4Perl installed on your system.
Next we will need to deploy the webapp “jolokia” in our Application server. In this example I used Jboss6.
Now the webapp is deployed, and JBoss will extract it by it self.
To test if the webapp works, browse to: http://<server>:<port>/jolokia/version
or run the following command from your op5 Monitor server:
Now jmx4perl should return some information about JBoss and jolokia.
You can also connect with j4psh to the server and browse around the MBeans:
You need to copy the installed check_jmx4perl and it’s config-files to a directory that op5 monitor can browse:
Now we can try to do a check in command-line using this example:
That should give a output similar to this:
Config files
First copy all the default configs to your created “jmx4perl” folder in /opt/plugins/custom/jmx4perl/
In this example we will create one config that includes all the others to make changes more simple to maintain and to shorten the check commands.
Create this config called jmx4perl.cfg:
These files contains the variables set in “check_command_args” for the check commands that we will create.
I will go trough: memory.cfg, thread.cfg and some possibilities to customize your jboss.cfg.
Please have a look in the config files for further explanation of the options.
Check commands
First we create check commands to be used with agents. You can read the pros and cons for the different usages of jolokia at:
http://www.jolokia.org/reference/html/architecture.html#agent-mode and http://www.jolokia.org/reference/html/architecture.html#proxy-mode
When using config-files we minimize the number of check commands to a bare minimum, and we will only create two of them.
One for static checks and one for an incremental check that shows how much a value has changed in a given time period.
Create a new check command with the following values:
And the same procedure for the incremental check.
And save the configuration.
First we add host to op5 Monitor with the ip-address of our application server.
Fill in the configuration information: host name, alias, address etc.
Select the check command that you just created, and fill in the following arguments:
The syntax of check_command_args are:
<port>!<command>!<warning>!<critical>
And Save applied changes
Repeat these steps for the incremental check
The syntax of check_command_args are:
<port>!<command>!<delta>!<critical>
This command checks how much memory usage has changed the last 5 minutes with a warning threashold of 25%.
Proxy mode
When using a agentless approach we need a app-server with the jolokia webapp installed, and configured to accept connections via RMI.
This was default on my installation of Jboss6 and i won’t expand it any further.
RMI test:
If this works you should get something like this in return:
Now we will create a check command using config-files as explained earlier.
First we add host to op5 Monitor with the ip-address of our application server.
Fill in the configuration information: host name, alias, address etc. Click “Scan host for services” -> Click “Continue to step 3″
Select the check command that you just created, and fill in the following params:
Argument explanation:
First we define which host that runs the JMX-proxy, port, rmiport on the actual server we want to monitor, what checks we want to run on this server, and finally the thresholds.
These arguments is also listed in the config-files for jmx4perl just as the previous example with agents.
What you want to monitor in your environment is your call, this is just a glance at the possibilities using jmx4perl.
Jboss Labs (Optional)
This part shows some custom options that are not covered with the default configuration and is entirely optional. I just want to show examples for custom checks that you can create and include in your configs according to your needs. I found these values using the “j4psh” shell and browsing around the MBeans and editing jboss.cfg according to the MBean names and creating check commands for these:
<Check jboss_cpool_creation_rate> Use = count_per_minute("connections") MBean = jboss.jca:name=JmsXA,service=ManagedConnectionPool Attribute = ConnectionCreatedCount Name = Connection creation rate </Check>You can of course create additional config files with your specific needs and include them in “jmx4perl.cfg”
Author: Fredrik Mikker / op5 Professional Services
Rev. 1.0