apache/tomcat monitoring

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

User avatar
inetquestion
Cacti User
Posts: 67
Joined: Wed Feb 01, 2006 11:13 am
Location: Charlotte NC

apache/tomcat monitoring

Post by inetquestion »

I'm looking for some tools either built into apache/tomcat or auxiliary scripts which could be used to extract performance data and hopefully integrate with cacti. Given that there appear to be quite a few of these out there I was also hoping for some guidance on which ones are the most comprehensive and have the least problems with their use.

Regards,

-Inet
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please search for a set of Templates for Apache. We're using them since long. For Tomcat: no clue, personally. Is there some API or "well defined URL" or perhaps some SNMP stuff for Tomcat? In any of these cases, I would be able to help you create the needed stuff. It's not that difficult
Reinhard
jspilon
Posts: 19
Joined: Wed Jan 17, 2007 6:53 pm
Location: Montreal, QC

Post by jspilon »

I am interested in the same monitoring templates.

I have an idea of how to get the data, but for the moment, I would have to parse a lot of data to get the values

For example, the following URL will return information about memory usage... but it gives a lot of data back.

http://hostname:8080/manager/jmxproxy/? ... oryPool%2C*

I will look into this and post my findings here.
jspilon
Posts: 19
Joined: Wed Jan 17, 2007 6:53 pm
Location: Montreal, QC

Post by jspilon »

For your information, I got this from

http://tomcat.apache.org/tomcat-5.0-doc ... howto.html
myfreeke
Cacti User
Posts: 82
Joined: Tue Dec 04, 2007 10:24 pm

Post by myfreeke »

I have more than 100 servers use tomcat

How to monitor tomcat?

More details?
khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

myfreeke wrote:I have more than 100 servers use tomcat

How to monitor tomcat?

More details?
Tomcat supports quite a diverse amount of information via SNMP, especially if run through JBOSS. You can even publish specific EXEC commands to OIDs and this works nicely.

However, I have found most of the time it's simpler to just create a shell script that parses a health page. E.g., # of connections, free memory, GC information, a script that simulates a connection through Tomcat to the database, and so on. If you don't know where to start with this ask your developers to create a JSP or JMX page with this information.

More examples:
http://www.opennms.org/index.php/Tomcat_5.5_JMX_How-To
http://forums.adventnet.com/viewtopic.php?t=959&start=0
http://jakarta.apache.org/jmeter/userma ... -plan.html
User avatar
sebbs
Cacti User
Posts: 97
Joined: Mon Jan 22, 2007 9:41 am
Location: Ottawa,Canada

Post by sebbs »

then again Jboss has its own internal (pretty advanced) snmp monitoring. But if you dont use Jboss with tomcat....then its a bit harder.

I dont even think tomcat alone supports snmp. However if you choose to use bea jrockit for your java engine...and not sun jdk....then jrockit supports snmp....therefor you could pull some jvm stats from jrockit. I just havent got around to figuring this out.
anyone up for the task? ahah.
If all else fails, rm -rf /
khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

Use JMX or a JSP health page. If you want it in SNMP then make sure to use net-snmp 5+ and put in some exec commands to a shell script that parses the JMX or JSP health page.
khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

Let me give a more concrete example:
</etc/crontab>
* * * * * /usr/bin/yourupdateprogram > /dev/null
</>
<snmpd.conf>
sh .1.3.6.1.4.1.8081 TomcatThreads /usr/local/bin/snmp-tomcat-busythreads
sh .1.3.6.1.4.1.8082 TomcatFreemem /usr/local/bin/snmp-tomcat-freemem
</>
<cacti>
Add data source of type "SNMP - Generic OID Template". Set "Maximum Value" to some very huge number, say 10000000000. Put in OID value 1.3.6.1.4.1.8081.101.1 (for busy threads) and 1.3.6.1.4.1.8082.101.1 (for free memory).
</>

You can use any OIDs you want, they just have to match up and not be in use. Don't forget to restart snmpd after you update it. Test with snmpwalk before you get to cacti's complexity.

In this case, I have crontab running a job every minute that dumps data to /tmp/somefile. The /usr/local/bin programs are executed by SNMPd (from a Cacti request over SNMP-OID). They get data from /tmp/somefile that cron dumped the data into.
timdenike
Posts: 5
Joined: Thu May 31, 2007 3:11 pm
Location: San Francisco

Tomcat Template

Post by timdenike »

If anyone is interested in helping me test - I've got some Tomcat templates/scripts I whipped up. The template relies on a script which polls the standard Tomcat Manager app for data.
Attachments
1graph_image.png
1graph_image.png (43.9 KiB) Viewed 69265 times
2graph_image.png
2graph_image.png (43.22 KiB) Viewed 69265 times
3graph_image.png
3graph_image.png (23.78 KiB) Viewed 69265 times
4graph_image.png
4graph_image.png (38.55 KiB) Viewed 69265 times
User avatar
sebbs
Cacti User
Posts: 97
Joined: Mon Jan 22, 2007 9:41 am
Location: Ottawa,Canada

Post by sebbs »

which version of java are you using with your tomcat install?
If all else fails, rm -rf /
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Re: Tomcat Template

Post by mcutting »

timdenike wrote:If anyone is interested in helping me test - I've got some Tomcat templates/scripts I whipped up. The template relies on a script which polls the standard Tomcat Manager app for data.
Could you post your templates please ? I've got 2 Tomcat servers with JBOSS I'd like to monitor.

Thanks
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
timdenike
Posts: 5
Joined: Thu May 31, 2007 3:11 pm
Location: San Francisco

Re: Tomcat Template

Post by timdenike »

mcutting wrote: Could you post your templates please ? I've got 2 Tomcat servers with JBOSS I'd like to monitor.
Not sure whether this will work with JBoss since this uses the Tomcat manager app to request XML data - if anyone can make this work, please let me know so I can iron the kinks out.
Attachments
TomcatStats-0.1.zip
(8.54 KiB) Downloaded 9696 times
rombert
Posts: 2
Joined: Mon Mar 03, 2008 4:10 pm

Post by rombert »

Thank you for the great work :)

As a note, the script works better ( just tried it ) if you would replace
`GET $xml` with direct usage of LWP::Simple, i.e.

Code: Select all

use LWP::Simple;
at the top and retrieve the XML using

Code: Select all

my $xml = get($url);
Thanks again.

Robert
timdenike
Posts: 5
Joined: Thu May 31, 2007 3:11 pm
Location: San Francisco

Post by timdenike »

rombert wrote: As a note, the script works better ( just tried it ) if you would replace
`GET $xml` with direct usage of LWP::Simple, i.e.
Thanks!

I tried using LWP initially but had issues getting it to work (easily) with the HTTP auth... The GET is definitely a cheap and dirty hack. :) Were you able to make it work with a http://user:pass@host:port/uri type URL?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest