Reputation: 91
I've been searching on the internet and I found something I need these days. But having differencies to use it. I want to learn status of Tomcat service by a command.
And I believe Tomcat haven't got a status command. So, I saw this:
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -XX:+HeapDumpOnOutOfMemoryError -Djava.rmi.server.hostname=192.168.1.250"
export CATALINA_OPTS;
They say add this to beginning of your catalina.sh file and execute it to use JMX with JConsole. But I'm command prompter so I can't use GUI. I need command version of it.
Looking for something can work like:
root@ubuntu:# $TOMCAT_HOME/bin/catalina.sh --connect command=:status'
and print the result to me...
What can I do?
Upvotes: 0
Views: 2878
Reputation: 2525
You could also have a look at the Jolokia and Jmx4Perl combo which comes with quite some tool support (like the mighty j4psh Shell or the full featured Nagios Plugin check_jmx4perl which includes about 10 to 20 specific Tomcat checks.
Upvotes: 1
Reputation: 26713
These -Dcom.sun...
parameters are necessary for Tomcat/JVM so it allows clients to connect to it via JMX. Without these, you can only connect to the running JVM if it is on the same host and running under the same user. By the way, -XX:+HeapDumpOnOutOfMemoryError
and the following bits are completely irrelevant. Once you get this running, connect to your JVM using jconsole
and look what's available first.
jconsole
is a GUI tool. If you want console-only JMX client, look here or here.
There are also other ways to monitor Tomcat status. You can do this by:
wget
against itUpvotes: 1