Monitoring Tomcat and JVM via Tomcat jmxproxy
Moderators: Developers, Moderators
Monitoring Tomcat and JVM via Tomcat jmxproxy
Uses the jmxproxy that comes built in with tomcat manager to monitor Tomcat and the JVM. Lets you monitor the following:
Garbage Collectors
Time spent garbage collecting
Numer of collections
Memory Pools
Max
Used
Committed
Tomcat Thread Pools
Size
Numer of busy threads
Web Modules (contexts)
Total processing time for module.
Servlets
Requests / second
Total time
Time / Request
Any MBean
You can use the query script to get data from any MBean.
Data is collected using a perl script. Tested on Ubuntu 8.04 and cacti 0.8.7b
Garbage Collectors
Time spent garbage collecting
Numer of collections
Memory Pools
Max
Used
Committed
Tomcat Thread Pools
Size
Numer of busy threads
Web Modules (contexts)
Total processing time for module.
Servlets
Requests / second
Total time
Time / Request
Any MBean
You can use the query script to get data from any MBean.
Data is collected using a perl script. Tested on Ubuntu 8.04 and cacti 0.8.7b
- Attachments
-
- GC
- gc.png (32.25 KiB) Viewed 33988 times
-
- Mem Pool
- oldgen.png (27.24 KiB) Viewed 33988 times
-
- Servlet
- servlet.png (30.66 KiB) Viewed 33988 times
-
- cacti-tomcat-0.8.tar.gz
- Thread Pool
- (13.02 KiB) Downloaded 2731 times
-
- threadpool.png (27.14 KiB) Viewed 33988 times
Re: Monitoring Tomcat and JVM via Tomcat jmxproxy
I am not able to get the graphs working. I can access the tomcat url from the cacti server:
1. when open this url from cacti, I get results withing the browser: http://<ip address of tomcat server>:7101/manager/jmxproxy/?qry=
2:
3. when I try to add the data query or manually execute the script against this tom cat server, I get nothing back:
D:\cacti\scripts>tomcat_stats.pl <ip address of tomcat > gc index
D:\cacti\scripts>
what am I missing, I think I am very close. please help.
thanks
1. when open this url from cacti, I get results withing the browser: http://<ip address of tomcat server>:7101/manager/jmxproxy/?qry=
2:
Code: Select all
OK - Number of results: 50
Name: FetchCatalina:type=Manager,path=/,host=localhost
modelerType: org.apache.catalina.session.StandardManager
algorithm: MD5
randomFile: /dev/urandom
className: org.apache.catalina.session.StandardManager
distributable: false
entropy: org.apache.catalina.session.StandardManager@eaf40c
maxActiveSessions: -1
maxInactiveInterval: 1800
processExpiresFrequency: 6
sessionIdLength: 16
name: StandardManager
pathname: SESSIONS.ser
activeSessions: 0
sessionCounter: 1
maxActive: 10
sessionMaxAliveTime: 1859
sessionAverageAliveTime: 1823
rejectedSessions: 0
expiredSessions: 20
processingTime: 0
duplicates: 0
Name: FetchCatalina:type=RequestProcessor,worker=http-7101,name=HttpRequest3
modelerType: org.apache.coyote.RequestInfo
bytesSent: 90471
remoteAddr: 172.25.207.147
requestBytesSent: 0
contentLength: -1
bytesReceived: 0
requestProcessingTime: 25610
globalProcessor: org.apache.coyote.RequestGroupInfo@12cd8d4
maxRequestUri: /agent/admin/status
requestBytesReceived: 0
serverPort: -1
stage: 7
requestCount: 115
maxTime: 16
processingTime: 92
errorCount: 64
D:\cacti\scripts>tomcat_stats.pl <ip address of tomcat > gc index
D:\cacti\scripts>
what am I missing, I think I am very close. please help.
thanks
Re: Monitoring Tomcat and JVM via Tomcat jmxproxy
Hi, I have the same probleme
"
3. when I try to add the data query or manually execute the script against this tom cat server, I get nothing back:
D:\cacti\scripts>tomcat_stats.pl <ip address of tomcat > gc index"
any feedback ?
Tomcat6
"
3. when I try to add the data query or manually execute the script against this tom cat server, I get nothing back:
D:\cacti\scripts>tomcat_stats.pl <ip address of tomcat > gc index"
any feedback ?
Tomcat6
- phalek
- Developer
- Posts: 2838
- Joined: Thu Jan 31, 2008 6:39 am
- Location: Kressbronn, Germany
- Contact:
Re: Monitoring Tomcat and JVM via Tomcat jmxproxy
Hi all,
The script needs to be changed for Tomcat 6, as the jmxurls changed:
At around line 66 replace the qry strings with the following:
The script needs to be changed for Tomcat 6, as the jmxurls changed:
At around line 66 replace the qry strings with the following:
Code: Select all
if($mode eq "tp")
{
$qry = "*%3Atype%3DThreadPool%2C*";
}
elsif($mode eq "gc")
{
$qry = "*%3Atype%3DGarbageCollector%2C*";
}
elsif($mode eq "mp")
{
$qry = "*%3Atype%3DMemoryPool%2C*";
}
elsif($mode eq "wm")
{
$qry = "Catalina%3Aj2eeType%3DWebModule%2CJ2EEApplication%3Dnone%2CJ2EEServer%3Dnone%2C*";
}
elsif($mode eq "sv")
{
$qry = "Catalina%3Aj2eeType%3DServlet%2CJ2EEApplication%3Dnone%2CJ2EEServer%3Dnone%2C*";
}
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Re: Monitoring Tomcat and JVM via Tomcat jmxproxy
hi,
First very good template and good work.
The template work for:
Tomcat Servlet
Tomcat ThreadPool
Tomcat WebModule
But not for:
Tomcat GC Stats
Tomcat MemPool
My problem come from tomcat because i don't have any output from this URL:
http://host:port/manager/jmxproxy/?qry=*:type=%28GarbageCollector|MemoryPool%29,*
I don't understand why.
Is there anyone that know why?
I'm on a linux tomcat test box with:
OS: debian 5.3
Tomcat: Tomcat 5.5
JDK: 1.6.0_22-b04 and 1.5.0_22-b03 (same issue with both)
Thanks!
First very good template and good work.
The template work for:
Tomcat Servlet
Tomcat ThreadPool
Tomcat WebModule
But not for:
Tomcat GC Stats
Tomcat MemPool
My problem come from tomcat because i don't have any output from this URL:
http://host:port/manager/jmxproxy/?qry=*:type=%28GarbageCollector|MemoryPool%29,*
I don't understand why.
Is there anyone that know why?
I'm on a linux tomcat test box with:
OS: debian 5.3
Tomcat: Tomcat 5.5
JDK: 1.6.0_22-b04 and 1.5.0_22-b03 (same issue with both)
Thanks!
Re: Monitoring Tomcat and JVM via Tomcat jmxproxy
Anyone actively using this with Tomcat 6? It looks immensely helpful, but I am not having much success with it. I've been messing around with Tomcat Mempool data query and verbose logging spits out the following:
I've updated the script as phalek recommended.
Code: Select all
+ Running data query [36].
+ Found type = '4' [Script Query].
+ Found data query XML file at '/var/data/cacti/resource/script_queries/tomcat_jmxproxy_mp.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting arg_index entries
+ Executing script for list of indexes '/var/data/cacti/scripts/tomcat_stats.pl <servername_goes_here> mp index' Index Count: 0
+ Executing script query '/var/data/cacti/scripts/tomcat_stats.pl <servername_goes_here> mp query index'
+ Executing script query '/var/data/cacti/scripts/tomcat_stats.pl <servername_goes_here> query Name'
-
- Posts: 1
- Joined: Wed Sep 12, 2012 7:52 am
Re: Monitoring Tomcat and JVM via Tomcat jmxproxy
hi
I used this template good for monitoring Garbage Collectors ,Memory Pools ,Web Modules (contexts) ,
but when create threadpool graph,the poller always give warning like this:
09/12/2012 03:45:01 PM - POLLER: Poller[0] WARNING: Poller Output Table not Empty.
Issues Found: 6, Data Sources: currentThreadCount(DS[466]), currentThreadsBusy(DS[466]), maxThreads(DS[466]), currentThreadCount(DS[467]), currentThreadsBusy(DS[467]), maxThreads(DS[467])
with manual checking,all data were got from tomcat server, and wrote to the temp cache file.
every time the poller run, there were some records in cacti database table poller_output,
is any body can tell me why,how to deal with this problem?
thanks
I used this template good for monitoring Garbage Collectors ,Memory Pools ,Web Modules (contexts) ,
but when create threadpool graph,the poller always give warning like this:
09/12/2012 03:45:01 PM - POLLER: Poller[0] WARNING: Poller Output Table not Empty.
Issues Found: 6, Data Sources: currentThreadCount(DS[466]), currentThreadsBusy(DS[466]), maxThreads(DS[466]), currentThreadCount(DS[467]), currentThreadsBusy(DS[467]), maxThreads(DS[467])
with manual checking,all data were got from tomcat server, and wrote to the temp cache file.
every time the poller run, there were some records in cacti database table poller_output,
is any body can tell me why,how to deal with this problem?
thanks
Re: Monitoring Tomcat and JVM via Tomcat jmxproxy
Anybody knows what to put inside the index field (marked in the attached screenshot)? They're always empty if I add the source to a host :/
(and I can't add them via device > create Graphs for this host, since the graph template won't show up there...all xml files are imported, though, and I see it in the graph template section).
Thanks in advance
(and I can't add them via device > create Graphs for this host, since the graph template won't show up there...all xml files are imported, though, and I see it in the graph template section).
Thanks in advance
- Attachments
-
- tomcat jvm stats.png (65.27 KiB) Viewed 14766 times
Re: Monitoring Tomcat and JVM via Tomcat jmxproxy
Patch tomcat7 ThreadPool
Add following bold lines in script tomcat_stats.pl section get:
elsif($ARGV[2] eq "get")
{
my $attr = $ARGV[3];
my $index = $ARGV[4];
my $qry = $ARGV[4];
my $search = "ajp-bio-8009";
my $replace = "\"ajp-bio-8009\"";
$qry =~ s/$search/$replace/g;
$index =~ s/$search/$replace/g;
my $search = "http-bio-8080";
my $replace = "\"http-bio-8080\"";
$qry =~ s/$search/$replace/g;
$index =~ s/$search/$replace/g;
my $search = "http-bio-8443";
my $replace = "\"http-bio-8443\"";
$qry =~ s/$search/$replace/g;
$index =~ s/$search/$replace/g;
if($attr eq "" or $index eq "")
{
die("index och attribute missing");
}
my $objs = doQuery($qry);
if(not defined $objs->{$index})
{
print "$index not found\n";
}
if(not defined $objs->{$index}->{$attr})
{
print "$attr not found\n";
}
print $objs->{$index}->{$attr} ."\n";
}
Add following bold lines in script tomcat_stats.pl section get:
elsif($ARGV[2] eq "get")
{
my $attr = $ARGV[3];
my $index = $ARGV[4];
my $qry = $ARGV[4];
my $search = "ajp-bio-8009";
my $replace = "\"ajp-bio-8009\"";
$qry =~ s/$search/$replace/g;
$index =~ s/$search/$replace/g;
my $search = "http-bio-8080";
my $replace = "\"http-bio-8080\"";
$qry =~ s/$search/$replace/g;
$index =~ s/$search/$replace/g;
my $search = "http-bio-8443";
my $replace = "\"http-bio-8443\"";
$qry =~ s/$search/$replace/g;
$index =~ s/$search/$replace/g;
if($attr eq "" or $index eq "")
{
die("index och attribute missing");
}
my $objs = doQuery($qry);
if(not defined $objs->{$index})
{
print "$index not found\n";
}
if(not defined $objs->{$index}->{$attr})
{
print "$attr not found\n";
}
print $objs->{$index}->{$attr} ."\n";
}
Who is online
Users browsing this forum: No registered users and 8 guests