JMX support

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

JMX support

Renaud Bruyeron-2

Hi,

I've recently discovered hudson, and I love it :)

We were using cruisecontrol before, and we used JMX to monitor the
status of the jobs remotely.
I am wondering if this is something that could be interesting for hudson
users?

I am thinking of simply exposing a hierarchy of objects like such:

* instancename:type=Hudson: attributes=(), operations=(prepareForShutdown)
** instancename:type=Hudson, name=job1: attributes=(lastBuild, status,
lastSuccessfulBuild), operations=(build)
** instancename:type=Hudson, name=job2: attributes=(lastBuild, status,
lastSuccessfulBuild), operations=(build)

I had a quick look at the code and it seems that this could be done by
wrappers around Job and Hudson objects.

What do you think?

 - Renaud

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Ronald Klop-4
On Fri, 01 Dec 2006 11:53:04 +0100, Renaud Bruyeron <[hidden email]>  
wrote:

>
> Hi,
>
> I've recently discovered hudson, and I love it :)
>
> We were using cruisecontrol before, and we used JMX to monitor the  
> status of the jobs remotely.
> I am wondering if this is something that could be interesting for hudson  
> users?
>
> I am thinking of simply exposing a hierarchy of objects like such:
>
> * instancename:type=Hudson: attributes=(),  
> operations=(prepareForShutdown)
> ** instancename:type=Hudson, name=job1: attributes=(lastBuild, status,  
> lastSuccessfulBuild), operations=(build)
> ** instancename:type=Hudson, name=job2: attributes=(lastBuild, status,  
> lastSuccessfulBuild), operations=(build)
>
> I had a quick look at the code and it seems that this could be done by  
> wrappers around Job and Hudson objects.
>
> What do you think?

Hudson has plugins. Maybe it can be done as a JMX plugin.

Ronald.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Renaud Bruyeron-2
Ronald Klop wrote:

> On Fri, 01 Dec 2006 11:53:04 +0100, Renaud Bruyeron
> <[hidden email]> wrote:
>
>>
>> Hi,
>>
>> I've recently discovered hudson, and I love it :)
>>
>> We were using cruisecontrol before, and we used JMX to monitor the
>> status of the jobs remotely.
>> I am wondering if this is something that could be interesting for
>> hudson users?
>>
>> I am thinking of simply exposing a hierarchy of objects like such:
>>
>> * instancename:type=Hudson: attributes=(),
>> operations=(prepareForShutdown)
>> ** instancename:type=Hudson, name=job1: attributes=(lastBuild,
>> status, lastSuccessfulBuild), operations=(build)
>> ** instancename:type=Hudson, name=job2: attributes=(lastBuild,
>> status, lastSuccessfulBuild), operations=(build)
>>
>> I had a quick look at the code and it seems that this could be done
>> by wrappers around Job and Hudson objects.
>>
>> What do you think?
>
> Hudson has plugins. Maybe it can be done as a JMX plugin.
Yes, it probably ought to be a plugin - however can a plugin listen in
on Hudson events such as "Job creation" ?
Exposing the model to JMX at startup time is one thing, but updating the
JMX view when this model changes after startup requires some sort of
observer/listener relationship.
I don't know if that's possible in a plugin, but I'll take a look.

 - Renaud

--
Renaud Bruyeron <[hidden email]>
Software Architect, FullSIX France
Tel: +33(1)49 68 75 29

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Kohsuke Kawaguchi-2

JMX support would be an excellent idea. If it were available on JDK 1.4
I'd be happy to make it a part of the core, but IIRC there's no easy way
to run it on JDK1.4, right? Because there's no platform MBean server?

So I'm really looking forward to seeing it as a plugin. If you are
interested, let me know your java.net id so that I can add you as a
developer.

Renaud Bruyeron wrote:
> Yes, it probably ought to be a plugin - however can a plugin listen in
> on Hudson events such as "Job creation" ?
> Exposing the model to JMX at startup time is one thing, but updating the
> JMX view when this model changes after startup requires some sort of
> observer/listener relationship.
> I don't know if that's possible in a plugin, but I'll take a look.

There's no such event model right now, but we can consider adding one.

Another easy approach is to periodically scan the job list and
reexport/unexport them. Since the jobs don't change that often, I think
this might be good enough in practice. OTOH, you might want to do
something immediately after you created a job, so not being able to see
it for a while might be annoying.

Doing so in a plugin would require you export Hudson object to JMX on
Plugin.start(), and submit a periodical job to Trigger.timer. It should
be pretty easy.

If you want the event interface, we need to talk more about what it
should look like.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Renaud Bruyeron-2
Kohsuke Kawaguchi wrote:
>
> JMX support would be an excellent idea. If it were available on JDK
> 1.4 I'd be happy to make it a part of the core, but IIRC there's no
> easy way to run it on JDK1.4, right? Because there's no platform MBean
> server?
>
As a plugin this should be simple enough: mx4j is a standalone JMX agent
that people tend to use on 1.4, and I see that it's available on the
official maven2 repo.
The plugin should check if there is an MBeanServer, and if not use MX4J
to create one. From then on, it should all be transparent to the rest of
the jmx code.
> So I'm really looking forward to seeing it as a plugin. If you are
> interested, let me know your java.net id so that I can add you as a
> developer.
>
Yes I am interested in this - I'll start a prototype here and will
report back if/when I get somewhere. I'll probably take the approach you
outlined -  i.e. on plugin start simply expose Hudson and the jobs, and
use a Timer to check that the list is current on a periodic basis.

However in the long term, having a lifecycle event system for jobs and
Hudson itself would be very useful for many plugins. In fact, I see a
lot of the "built-ins" that could be moved out into plugins :)

 - Renaud

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Kohsuke Kawaguchi-2
Renaud Bruyeron wrote:
>> So I'm really looking forward to seeing it as a plugin. If you are
>> interested, let me know your java.net id so that I can add you as a
>> developer.
>>
> Yes I am interested in this - I'll start a prototype here and will
> report back if/when I get somewhere. I'll probably take the approach you
> outlined -  i.e. on plugin start simply expose Hudson and the jobs, and
> use a Timer to check that the list is current on a periodic basis.

Cool. Let me know your java.net user id so that I can add you.

> However in the long term, having a lifecycle event system for jobs and
> Hudson itself would be very useful for many plugins.

I think you are right. I just added hudson.model.listeners.JobListener.

 > In fact, I see a
> lot of the "built-ins" that could be moved out into plugins :)

Yeah. Historically plugins came into being later than much of the
built-in functionalities. So things that should/could have been written
as plugins are a part of the core.

It might be worthwhile to refactor this eventually, but that would take
some messing with Maven (to create a proper distribution image.)

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Kohsuke Kawaguchi-2
Renaud Bruyeron wrote:
> I just committed the IRC bot publisher. I haven't had time to look at
> the Listener API nor the JMX integration yet as I am a bit pressed for
> time these days ;-)
> I hope to be able to look into it next week or the week between
> christmas and new year.

I think you committed them in a wrong place. I'm responsible for this
confusing layout, but you'd want to put it in
hudson/hudson/plugins/ircbot, not hudson/plugins/ircbot.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Renaud Bruyeron-2
Kohsuke Kawaguchi wrote:

> Renaud Bruyeron wrote:
>> I just committed the IRC bot publisher. I haven't had time to look at
>> the Listener API nor the JMX integration yet as I am a bit pressed
>> for time these days ;-)
>> I hope to be able to look into it next week or the week between
>> christmas and new year.
>
> I think you committed them in a wrong place. I'm responsible for this
> confusing layout, but you'd want to put it in
> hudson/hudson/plugins/ircbot, not hudson/plugins/ircbot.
>
oops sorry, I saw what looked like other plugins there and simply
assumed they should all end up there...
I'll move it sometime today (sure wish it was SVN ;-) ).

 - Renaud

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Renaud Bruyeron-2
In reply to this post by Kohsuke Kawaguchi-2

Hi,

I've taken a look at JMX integration, and I hit a small hurdle: plugins
are started before Hudson loads its state from disk (line 162-164 in
Hudson.java). This means that I do not have the job list available when
the plugin is started.
A simple workaround would be to add a onLoaded() callback to the
JobListener interface so that interested parties can be notified when a
job has been loaded. This would make it easy for the JMX plugin to
register jobs into the mbean server as they are created or loaded.

What do you think?

 - Renaud

Kohsuke Kawaguchi wrote:

> Renaud Bruyeron wrote:
>>> So I'm really looking forward to seeing it as a plugin. If you are
>>> interested, let me know your java.net id so that I can add you as a
>>> developer.
>>>
>> Yes I am interested in this - I'll start a prototype here and will
>> report back if/when I get somewhere. I'll probably take the approach
>> you outlined -  i.e. on plugin start simply expose Hudson and the
>> jobs, and use a Timer to check that the list is current on a periodic
>> basis.
>
> Cool. Let me know your java.net user id so that I can add you.
>
>> However in the long term, having a lifecycle event system for jobs
>> and Hudson itself would be very useful for many plugins.
>
> I think you are right. I just added hudson.model.listeners.JobListener.
>
> > In fact, I see a
>> lot of the "built-ins" that could be moved out into plugins :)
>
> Yeah. Historically plugins came into being later than much of the
> built-in functionalities. So things that should/could have been
> written as plugins are a part of the core.
>
> It might be worthwhile to refactor this eventually, but that would
> take some messing with Maven (to create a proper distribution image.)
>


--
Renaud Bruyeron <[hidden email]>
Software Architect, FullSIX France
Tel: +33(1)49 68 75 29

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JMX support

Kohsuke Kawaguchi-2
Renaud Bruyeron wrote:

> Hi,
>
> I've taken a look at JMX integration, and I hit a small hurdle: plugins
> are started before Hudson loads its state from disk (line 162-164 in
> Hudson.java). This means that I do not have the job list available when
> the plugin is started.
> A simple workaround would be to add a onLoaded() callback to the
> JobListener interface so that interested parties can be notified when a
> job has been loaded. This would make it easy for the JMX plugin to
> register jobs into the mbean server as they are created or loaded.
>
> What do you think?
Done.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment