esme-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy the destroyer <>
Subject Requesting feedback on JMX REST API...
Date Fri, 20 Nov 2009 02:55:14 GMT

I have finished a REST api for generic jmx MBeans. It allows for listing
mbeans, getting mbeaninfo, reading and setting attributes and invoking
operations with parameters that can be represented as Strings ( i.e. String,
Long etc. serialized classes don't count).

Before I send to code to Richard I would like some feedback to see if I am
missing something or should do something different.

Here is the api and sample returns. Bad requests or errors will return

GET /jmx/mbeans - returns a list of mbean names
GET /jmx/mbean/[mbean name]/info - returns MBeanInfo for specified mbean
GET /jmx/mbean/[mbean name]/attributes - returns attribute name and string

POST /jmx/mbean/[mbean name]/invoke/[operation name]
  <Param signature="java.lang.Long">123</Param>

POST /jmx/mbean/[mbean name/set - sets a single attribute
<Attribute name="attr" value="val" />

POST /jmx/mbean/[mbean name]/set - sets multiple attributes
  <Attribute name="att1" value="val1" />
  <Attrubute name="att2" value="val2" />


GET /jmx/mbeans

<esme_api operation="mbeans" success="true">
<MBean name="java.lang:type=Memory"/>
<MBean name="java.lang:type=GarbageCollector,name=Copy"/>
<MBean name="java.lang:type=MemoryPool,name=Code Cache"/>
<MBean name="java.lang:type=Runtime"/>
<MBean name="java.lang:type=ClassLoading"/>
<MBean name="java.lang:type=MemoryPool,name=Perm Gen [shared-rw]"/>
<MBean name="java.lang:type=Threading"/>
<MBean name="java.util.logging:type=Logging"/>
<MBean name="java.lang:type=MemoryPool,name=Perm Gen [shared-ro]"/>
<MBean name="java.lang:type=Compilation"/>
<MBean name="java.lang:type=MemoryPool,name=Eden Space"/>
<MBean name="org.apache.esme.stats:type=Stats"/>
<MBean name="StatsAgent:name=htmlAdaptor,port=9092"/>
<MBean name=""/>
<MBean name="java.lang:type=GarbageCollector,name=MarkSweepCompact"/>
<MBean name="java.lang:type=MemoryPool,name=Survivor Space"/>
<MBean name="java.lang:type=MemoryPool,name=Tenured Gen"/>
<MBean name="java.lang:type=MemoryPool,name=Perm Gen"/>
<MBean name="java.lang:type=OperatingSystem"/>
<MBean name="JMImplementation:type=MBeanServerDelegate"/>
<MBean name="java.lang:type=MemoryManager,name=CodeCacheManager"/>

GET /jmx/mbean/org.apache.esme.stats:type=Stats/attributes
<esme_api operation="mbean" success="true">
<MBeanAttributes name="org.apache.esme.stats:type=Stats">
<MBeanAttribute value="1" name="counter_userCount"/>
<MBeanAttribute value="1" name="counter_liftSessions"/>
<MBeanAttribute value="1.0" name="gauge_users"/>
<MBeanAttribute value="1.0" name="gauge_listener"/>

GET /jmx/mbean/org.apache.esme.stats:type=Stats/info
<esme_api operation="mbean" success="true">
<MBeanInfo name="org.apache.esme.stats:type=Stats">
<MBeanAttributeInfo isIs="false" type="java.lang.Long" description="counter"
isReadable="true" name="counter_userCount" isWritable="false"/>
<MBeanAttributeInfo isIs="false" type="java.lang.Long" description="counter"
isReadable="true" name="counter_liftSessions" isWritable="false"/>
<MBeanAttributeInfo isIs="false" type="java.lang.Long" description="gauge"
isReadable="true" name="gauge_users" isWritable="false"/>
<MBeanAttributeInfo isIs="false" type="java.lang.Long" description="gauge"
isReadable="true" name="gauge_listener" isWritable="false"/>
<MBeanOperationInfo impact="ACTION" description="Remove all Counters,
Timers, Gauges and restart gathering timestamp."
returnType="java.lang.String" name="clear">


There is no security on the api. This obviously should not stay like this
and should only be accessable with an administrator account.

I tested it with the Stats MBean and the java.util.Logging MBean and it is
working. I can access stats, reset them and change logging levels.

It would be nice to be able to change runtime properties though JMX however
most of the Lift and ESME code uses vals and immutable data structures that
are set when the app is originally loaded. The lift Props object used by
esme is totally immutable after it is constructed. It is worth thinking
about switching to a property api like Configgy which uses mutable data
structures for properties.

We could change in real time things like resent & links period, refresh
intervals, analyzer settings like long query time, db connection pool sizes

I didn't enable sending serialized objects through the REST api because it
seems like more trouble than it's worth. Besides that sort of JMX
functionality is only useful between servers and this api is really just for
the cloud environment like stax which doesn't allow you to bind to ports.

I welcome any comments or suggestions of Stats or JMX features to add before
I send the code to Richard. Should invalid requests return specific error
messages or just BadResponse?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message