25. 11. 2013 Patrick Zambelli NetEye

Java Application Monitoring

Modern Java application servers can be a complex construct of services and business logic. It is not possible to monitor them through conventional ways, like checking if a process is running. Within a Java application server multiple components are bundled together, to hold logic and provide intelligence for the application. For everyone who has some experience in java programming this concept will be easily understood, in fact java applications consist of hierarchical constructs of objects and classes.

To meet the requirement of checking the availability and the proper behavior of Java Applications and their services, the Java Management Extensions (JMX) have been introduced. This Java technology supplies resources for reading the application and system objects. Those resources are represented by objects called MBeans (for Managed Bean). The Java Management Extensions (JMX) technology is a standard part of the Java Platform and comes along with all Application Servers based on the Java Technologies, ie. the Glassfish Server or Apache Tomcat server.

With JMX technology, a given resource is accessible by one or more Managed Beans. These MBeans are registered in a so called MBean server. The MBean server acts as a management agent and can run on most devices that have been enabled for the Java programming language. In this way, the JMX agents directly access resources and make them available to remote management applications. For the communication, the JMX technology defines standard connectors (known as JMX connectors) that enable remote management applications ( NetEye) access the Java Beans.

As said, the remote connection to those Java Beans can be done in many ways and multiple API and framework exist. For NetEye we have defined the Perl Module for Jmx. Perl is well supported on Unix/Linux and proved on those systems a great performance. In the same way it comes with a dedicated module, providing the necessary functions to establish the communication.

All the necessary packages have been compiled and are provided for the NetEye environment.

How to implement the solution

Reading the available objects…

List the server Beans

[box type=”shadow”] [root@pbzsilx001 ~]# jmx4perl http://localhost:8080/j4p –target service:jmx:rmi:///jndi/rmi://localhost:12345/jmxrmi list […] solr:id=org.apache.solr.handler.component.SearchHandler,type=/spell[/box]

The available attributes:

source                              java.lang.String [ro], “”

avgTimePerRequest     java.lang.String [ro], “”

errors                               java.lang.String [ro], “”

requests                           java.lang.String [ro], “”

version                             java.lang.String [ro], “”

totalTime                        java.lang.String [ro], “”

name                                java.lang.String [ro], “”

description                      java.lang.String [ro], “”

timeouts                           java.lang.String [ro], “”

sourceId                           java.lang.String [ro], “”

avgRequestsPerSecond java.lang.String [ro], “”

category                            java.lang.String [ro], “”

handlerStart                    java.lang.String [ro], “”

[…]

Run the check for the Java Bean SearchHandler, type=tvrh and attribute “requests”:

[box] [root@pbzsilx001 ~]# /usr/bin/check_jmx4perl -u http://localhost:8080/j4p –target service:jmx:rmi:///jndi/rmi://localhost:12345/jmxrmi -m solr:id=org.apache.solr.handler.component.SearchHandler, type=tvrh -a requests -c :0 OK – [solr:id=org.apache.solr.handler.component.SearchHandler, type=tvrh,requests] : Value 0 in range | ‘[solr:id=org.apache.solr.handler.component.SearchHandler, type=tvrh,requests]’=0;;:0[/box]

Run the check for the Aliases

List all ALIASES check_jmx4perl that can be used:

[box] [root@pbzsilx001 ~]# perl -MJMX::Jmx4Perl::Alias -e ‘JMX::Jmx4Perl::Alias::help’CL_LOADED attr Number of currently loaded classes[/box]

CL_TOTAL                       attr Number of classes loaded in total

CL_UNLOADED                    attr Number of unloaded classes

JMX4PERL_DEBUG                 attr Switch on/off debugging by setting this boolean

JMX4PERL_DEBUG_INFO            oper Print out latest debug info

JMX4PERL_DEBUG_MAX_ENTRIES     attr Maximum number of entries for storing debug info

JMX4PERL_HISTORY_MAX_ATTRIBUTE oper Set the size of the history for a specific attribute

JMX4PERL_HISTORY_MAX_ENTRIES   attr Maximum number of entries per attribute/operation possible

JMX4PERL_HISTORY_MAX_OPERATION oper Set the size of the history for a specific operation

JMX4PERL_HISTORY_RESET         oper Reset the history for all attributes and operations

JMX4PERL_HISTORY_SIZE          attr Size of the history of all attributes and operations in bytes

JMX4PERL_SERVER_INFO           oper Show information about registered MBeanServers

MEMORY_GC                      oper Run a garbage collection

MEMORY_HEAP                    attr Heap memory usage, multiple values

MEMORY_HEAP_COMITTED           attr Committed heap memory. That’s the memory currently available for this JVM

MEMORY_HEAP_INIT               attr Initially allocated heap memory

MEMORY_HEAP_MAX                attr Maximum available heap memory

MEMORY_HEAP_USED               attr Used heap memory

[…]

[box] [root@pbzsilx001 plugins]# /usr/bin/check_jmx4perl -u http://localhost:8080/j4p –target service:jmx:rmi:///jndi/rmi://localhost:12345/jmxrmi –alias “OS_MEMORY_PHYSICAL_FREE” -n memory_free -c 103000000: OK – memory_free : Value 118382592 in range | ‘memory_free’=118382592;;103000000: [root@pbzsilx001 ~]# /usr/bin/check_jmx4perl -u http://localhost:8080/j4p –target service:jmx:rmi:///jndi/rmi://localhost:12345/jmxrmi –alias “OS_MEMORY_PHYSICAL_FREE” -c 103000000: CRITICAL – [OS_MEMORY_PHYSICAL_FREE] : Threshold ‘103000000:’ failed for value 71675904 | ‘[OS_MEMORY_PHYSICAL_FREE]’=71675904;;103000000:[/box]

Source:

https://en.wikipedia.org/wiki/Java_Management_Extensions

Patrick Zambelli

Patrick Zambelli

Project Manager at Würth Phoenix
After my graduation in Applied Computer Science at the Free University of Bolzano I decided to start my professional career outside the province. With a bit of good timing and good luck I went into the booming IT-Dept. of Geox in the shoe district of Montebelluna, where I realized how a big IT infrastructure has to grow and adapt to quickly changing requirements. During this experience I had also the nice possibility to travel the world, while setting up the various production and retail areas of this company. Arrived at Würth Phoenix I started developing on our monitoring solution NetEye. Today, in my position as Consulting an Project Manager I am continuously heading to implement our solutions to meet the expectation of your enterprise customers.

Author

Patrick Zambelli

After my graduation in Applied Computer Science at the Free University of Bolzano I decided to start my professional career outside the province. With a bit of good timing and good luck I went into the booming IT-Dept. of Geox in the shoe district of Montebelluna, where I realized how a big IT infrastructure has to grow and adapt to quickly changing requirements. During this experience I had also the nice possibility to travel the world, while setting up the various production and retail areas of this company. Arrived at Würth Phoenix I started developing on our monitoring solution NetEye. Today, in my position as Consulting an Project Manager I am continuously heading to implement our solutions to meet the expectation of your enterprise customers.

Leave a Reply

Your email address will not be published. Required fields are marked *

Archive