Tomcat & JMX extensions

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Whatty
Posts: 2
Joined: Tue May 16, 2006 10:23 am
Location: Canada
Contact:

Tomcat & JMX extensions

Post by Whatty »

Good afternoon,

I would like to know whether or not Cacti can be used to gather JMX based information on the internals of a Tomcat server.

I have seen a couple of posts regarding overall response times (assuming through HTTP GETS), but would like to gather more detailed statistics that can be established through JMX.

Any assistance would be greatly appreciated.

Thanks in advance.
Steve Whatmore
Technical Lead Web Development
Sigma Software Solutions
55 York St., Suite 1100
Toronto, ON
M5J 1R7

Phone: 416.368.2000 x2293
Email: stevenw@sigmasoft.ca
MSN: steven.whatmore@hotmail.com
Web: www.sigmasoft.ca
Skype: steven.whatmore
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

If you can write a script to gather the information, then Cacti can graph it.

It's simply as that.

The complex part might be writing the script.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Tomcat & JMX extensions

Post by gandalf »

Whatty wrote:Good afternoon,

I would like to know whether or not Cacti can be used to gather JMX based information on the internals of a Tomcat server.

I have seen a couple of posts regarding overall response times (assuming through HTTP GETS), but would like to gather more detailed statistics that can be established through JMX.

Any assistance would be greatly appreciated.

Thanks in advance.
If you make any progress in this, I'd would be very interested about your findings. If you have problems putting your data into cacti, I will help. But for this I would need the structure of the data you want to put into cacti
Reinhard
Whatty
Posts: 2
Joined: Tue May 16, 2006 10:23 am
Location: Canada
Contact:

Post by Whatty »

As far as I can tell, the easiest way to go about this would be to utilize a JMX SNMP agent extension.

Of course this unto itself would require further effort to determine how it would work.
Steve Whatmore
Technical Lead Web Development
Sigma Software Solutions
55 York St., Suite 1100
Toronto, ON
M5J 1R7

Phone: 416.368.2000 x2293
Email: stevenw@sigmasoft.ca
MSN: steven.whatmore@hotmail.com
Web: www.sigmasoft.ca
Skype: steven.whatmore
User avatar
inetquestion
Cacti User
Posts: 67
Joined: Wed Feb 01, 2006 11:13 am
Location: Charlotte NC

Tomcat with JMX

Post by inetquestion »

Has anyone made any progress on this front?
User avatar
schurzi
Posts: 42
Joined: Sat Oct 11, 2008 8:45 am
Location: Germany
Contact:

Post by schurzi »

maybe you can look into: http://forums.cacti.net/viewtopic.php?t ... sc&start=0

we wrote some tomcat scripts our self. for that we used the jmxproxy Servlet.

for example with perl you can do:
#!/usr/bin/perl
#
#

use strict;
use LWP::Simple;

my $host = shift;
my $username = shift;
my $password = shift;
my $MBean = shift;
my $url = 'http://' . $username . ':' . $password .'@' . $host . '/manager/jmxproxy/?qry= . $MBean;

The Output is nearly cacti compatible. If you dont specify an qry Parameter you get a full list. You can use every Name from this List to specify the Query, if you want multiple MBeans you can use an '*'
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
roland
Posts: 7
Joined: Mon Jul 06, 2009 2:37 pm

jmx4perl

Post by roland »

FYI, there is a package called jmx4perl
(http://search.cpan.org/~roland/jmx4perl/) which might be of
interest for those needing a JMX integration with Cacti. This package
allows for scripting JMX access to remote Java application servers without
the need of a locally installed Java runtime environment (behind the
scenes this is done with JSON over HTTP). You need to install a small
(<100k) agent servlet on the app server, though.

The distribution includes a Nagios Plugin which can serve as a good
example for how to use JMX::Jmx4Perl programmatically. The
documentation is not that bad, too.

If you need some help for integrating JMX::Jmx4Perl for Cacti (which I
use myself and really like), don't hesitate to ask.

roland (author of jmx4perl)

And, yes, sorry for the plug. But I thought it might be of interest for you ;-)
davetbo
Posts: 2
Joined: Tue Sep 21, 2010 11:48 am

Cacti/JMX4Perl module?

Post by davetbo »

Roland,

You mentioned that you use Cacti with JMX4Perl. Do you have an example script you could share?

Best,
Dave
roland
Posts: 7
Joined: Mon Jul 06, 2009 2:37 pm

Re: Cacti/JMX4Perl module?

Post by roland »

Dabe,
davetbo wrote: You mentioned that you use Cacti with JMX4Perl. Do you have an example script you could share?
Actually, there is no cacti script within the jmx4perl distribution (but it is planned). But you can refer to http://forums.cacti.net/post-197459.html which is a nice howto for using jmx4perl with cacti.

roland.
davetbo
Posts: 2
Joined: Tue Sep 21, 2010 11:48 am

RE: Tomcat & JMX Extensions

Post by davetbo »

Thanks for the quick reply, Roland. I will check that out!

Dave
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests