Home     RSSRSS

Monitoring Java based Servers with JMX

January 5, 2014 by kiranbadi1991 | Filed under Development, Environment, Performance Center, Performance Engineering, Web Server.

Many times I have seen people struggling to do monitoring set up on the Java based servers like Web logic , Web sphere or even commercial servers like Tibco etc. Any server which supports Java based application can be monitored with JMX Solutions. Even the commercial tools like Sitescope, Silk Performer Monitors use the Custom JMX Client classes behind the scenes to monitor the java based servers.

JMX provides the powerful API to monitor and manage any Java based application servers or infrastructure. Below are some  benefits which I have seen we get by using the JMX API,

  1. Using the JMX we can monitor the health of all servers in the environment. Even if we have non Java based servers , we can always  write the custom wrapper classes which can pull the performance stats from those servers. However this approach consumes some time, but is doable if we have skilled java resources. However if we have Java based infrastructure than probably other than enabling JMX , there is hardly any code is required.
  2. Configuring Resources on the server is also possible with JMX API. With JMX API we can monitor and configure the application and its services either fully or in part by exposing it to the JMX API.
  3. JMX also helps in debugging. Debugging can be enabled at runtime in case if required.
  4. JMX can also send out the alert notification, emails for critical events.However a listener needs to be Configured to send out the actual data.

Setting the JMX Based monitoring on the java based server involves the enabling the JMX Port in the start up option of the server. Normally it’s the flag which needs to be set up in java options of the server.

In this post I will show you as how to do set up in Apache Tomcat 7x server. I have installed the Apache Tomcat on my local machine as windows service.Once you have installed Tomcat as service, navigate to the bin directory of the server and right click tomcat7w.exe file. Please make sure that you run this with administrator rights.

image

In apache Tomcat 7 Properties windows, click on Java tab, you need to enter below options for local monitoring solutions.Please note that with below options we have turned off SSL and authentication is also switched off which means that you don’t need user id and password to connect to the server.

-Dcom.sun.management.jmxremote=true 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false

For remote monitoring of the server we need to enable remote port for jmx. Below options I have shown as how to set JMX Monitoring with user credentials, however if you don’t need user credentials, then probably, you can use options jmxremote.authenthicate as false.

-Dcom.sun.management.jmxremote.port=(your port number)
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file= path to password file

Below screenshot shows you the setting I have given in my tomcat server. Since JMX is based on JMX Specification, set up is pretty should be similar in other java based servers. However in those servers, we might set the java options in class path options while starting the servers.

image

Once the JMX options is enabled, we can use any JMX Client to connect to the server and gather the performance metrics. However please do note that application and server need to expose its functionality via Mbeans. Below screenshots shows the connection with JConsole,

image

Enabling the JMX Options is the first step you need to do if ever you want to monitor any java based servers with JMX.

Lot of people also say that enabling the JMX is cumbersome process, but my experience was bit different and after enabling it did not break any thing on my environment set up.

Technorati Tags: ,,
← Previous

Tags: , ,

One Response to “Monitoring Java based Servers with JMX”

  1. Lisbeth says:

    Interesting article, I have recently passed PMP exam with the help of study materials and practice test papers of PMstudy which is one of the best PMP online training provider. Check out their free resources at http://www.PMstudy.com .