incubator-cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ran Tavory <ran...@gmail.com>
Subject Re: admin web UI
Date Thu, 06 May 2010 08:17:05 GMT
Thanks Gabriele, it's quite nice!

The code change is pretty small I would even say for simplicity it's better
to just commit that to the core. I'll paste the code below.

In main():

            daemon.startJmxOverHttp();


And we have:

    public void startJmxOverHttp()
    {
        try
        {
            MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
            ObjectName processorName = new
ObjectName("Server:name=XSLTProcessor");

            HttpAdaptor adapter = new HttpAdaptor(9292);
            ObjectName httpName = new ObjectName("system:name=http");
            mbs.registerMBean(adapter, httpName);
            XSLTProcessor processor = new XSLTProcessor();
            adapter.setProcessor(processor);
            mbs.registerMBean(processor, processorName);
            adapter.start();
        } catch(MalformedObjectNameException ex)
        {
          logger.warn("Could not start JMX over HTTP service, wrong name
specifed in code: {}", ex);
        } catch(InstanceAlreadyExistsException ex)
        {
          logger.warn("Could not start JMX over HTTP service, already
started: {}", ex);
        } catch(IOException ex)
        {
          logger.warn("Could not start JMX over HTTP service: {}", ex);
        } catch(JMException ex)
        {
          logger.warn("Could not start register mbean in JMX: {}", ex);
        }
    }

That's all, now just add mx4j.jar and mx4j-tools.jar to lib and you're done.
See screenshot for what you get from that on a live cassandra node.
I'll try this for my installation but I think it'll be also nice to have
that for everyone, let me know what you think. If you prefer contrib, then
I'm not sure how to do that without having to run two processes.


On Thu, May 6, 2010 at 10:15 AM, gabriele renzi <rff.rff@gmail.com> wrote:

> On Wed, May 5, 2010 at 12:00 PM, Ran Tavory <rantav@gmail.com> wrote:
> > can you send it to me? I'll try to work from it.
>
> I updated it to trunk, moved the code into a method and added a few
> catch'es (before: in main() throws Exception) .
> As you can see, once exception handling and imports are removed it's
> about ten lines.
>
> To compile you need the jars mx4j-tools.jar, mx4j.jar from the mx4j
> distribution, compile, run cassandra, connect to 9292.
>
> I recall I've seen better looking mx4j-over-http interfaces (in e.g.
> mule ESB) which I'd say depends on the default stylesheet, but for a
> quick glance it kind of works. It should also be possible to only
> expose selected beans, though I have not investigated it.
>
> --
> blog en: http://www.riffraff.info
> blog it: http://riffraff.blogsome.com
>

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