DaeYoung
DaeYoung

Reputation: 1229

checking tomcat server status

When I run following command in linux platform where tomcat server is installed/running, I get footprint of the app server is running. Please refer to an attachment.

ps -ef | grep tomcat

However, I do not have much understanding how to interpret it. If the server is down, then I would get command that I just ran.

[update] I was searching for Nagios plugin for checking status of tomcat server.

enter image description here

Upvotes: 0

Views: 2515

Answers (3)

Christopher Schultz
Christopher Schultz

Reputation: 20862

If you really want to monitor Tomcat, have a look at Tomcat's monitoring FAQ.

Basically, what you want to do is use JMX to connect to your JVM, and then you can observe all kinds of great things: heap usage, class loading, thread utilization, etc. Tomcat exposes a great amount of Tomcat-related information via JMX as well.

If JMX itself is a non-starter (it can be non-trivial to connect to a JMX server, plus going it periodically means that you have to launch a JVM every minute or so just to fetch one sample of one value... e.g. session count), then you can use Tomcat's JMXProxyServlet, which gives an a friendly HTTP interface to the JMX tree, and you can use tools like curl and other command-line things that run much more quickly than launching a Java VM.

There exists a Perl script, check_jmxproxy.pl that can be used with Tomcat's JMXProxyServlet to check samples from something like Nagios/Ichinga, or probably adapted for whatever monitoring software you use.

Upvotes: 1

Édipo Féderle
Édipo Féderle

Reputation: 4257

Here a simples script in Ruby (this one I use to checking Jetty Status):

#!/bin/ruby

def log(message)
  time = Time.now.strftime("%m/%d/%Y at %I:%M%p")
  File.open("/foo/scripts/jetty-watch.log", 'a') do |file|
    file.write "#{time} - #{message}"
    file.write "\n"
  end
end

jetty_on = %x( pgrep -f solr)
unless jetty_on != ""
  log("down....")
  %x( /etc/init.d/jetty start ) #start
end

Upvotes: 0

Henrik Pingel
Henrik Pingel

Reputation: 3193

I can't comment yet. So this might not a fully qualified answer.

You should check out Jolokia. Jolokia is an JMX over HTTP bridge. Means you deploy the Jolokia war on your Tomcat and Jolokia will give you status information about the deployed apps on the Tomcat via HTTP.

http://www.jolokia.org/

Once you deployed Jolokia you can the Nagios plugin check_jmx4perl to monitor your tomcat.

http://search.cpan.org/~roland/jmx4perl/scripts/check_jmx4perl

It will give you a better monitoring over your tomcat. As the Jolokia bridge is deployed on the Tomcat the check also covers the upstate of the Tomcat process. Once the Tomcat gets done Jolokia will get no more data and the check will go into warning.

Upvotes: 0

Related Questions