JMXJsonServlet (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.jmx
Class JMXJsonServlet

    java.lang.Object
      javax.servlet.GenericServlet
          javax.servlet.http.HttpServlet
              org.apache.hadoop.jmx.JMXJsonServlet

All Implemented Interfaces:
  Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class JMXJsonServlet

extends javax.servlet.http.HttpServlet

Provides Read only web access to JMX.

This servlet generally will be placed under the /jmx URL for each HttpServer. It provides read only access to JMX metrics. The optional `qry` parameter may be used to query only a subset of the JMX Beans. This query functionality is provided through the `MBeanServer.queryNames(ObjectName, javax.management.QueryExp)` method.

For example `http://.../jmx?qry=Hadoop:*` will return all hadoop metrics exposed through JMX.

If the `qry` parameter is not formatted correctly then a 400 BAD REQUEST http response code will be returned.

The return format is JSON and in the form

``

      {
        "beans" : [
          {
            "name":"bean-name"
            ...
          }
        ]
      }

The servlet attempts to convert the the JMXBeans into JSON. Each bean's attributes will be converted to a JSON object member. If the attribute is a boolean, a number, a string, or an array it will be converted to the JSON equivalent. If the value is a `CompositeData` then it will be converted to a JSON object with the keys as the name of the JSON member and the value is converted following these same rules. If the value is a `TabularData` then it will be converted to an array of the `CompositeData` elements that it contains. All other objects will be converted to a string and output as such. The bean's name and modelerType will be returned for all beans.

See Also:
  Serialized Form

Field Summary
`protected MBeanServer` | `mBeanServer` MBean server.

Constructor Summary
`JMXJsonServlet()`

Method Summary
`void` | `doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Process a GET request for the specified resource.
`void` | `init()` Initialize this servlet.

Methods inherited from class javax.servlet.http.HttpServlet
`doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service`

Methods inherited from class javax.servlet.GenericServlet
`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### mBeanServer

    protected transient MBeanServer mBeanServer

  MBean server.

Constructor Detail

### JMXJsonServlet

    public JMXJsonServlet()

Method Detail

### init

    public void init()
              throws javax.servlet.ServletException

  Initialize this servlet.

  Overrides:
    `init` in class `javax.servlet.GenericServlet`
  Throws:
    `javax.servlet.ServletException`

### doGet

    public void doGet(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)

  Process a GET request for the specified resource.

  Overrides:
    `doGet` in class `javax.servlet.http.HttpServlet`
  Parameters:
    `request` - The servlet request we are processing
    `response` - The servlet response we are creating

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation