Discussion:
Bash script for monitoring status of the Tomcat server
Miguel González Castaños
2012-04-02 19:02:42 UTC
Permalink
Dear all,

Recently we had to restart our standalone Tomcat server because
apparently the 150 max threads setting was not enough. I have been
googling a bit and it seems it's possible to monitor the performance of
the server and also get the numbers when the connection pool or the
threads are about to be exhausted.

I would like to run a bash script to monitor these values and warn me
if the reach a certain level. Also a tool that generates some graphs
would be great.

I haven't found anything googling. Any ideas of how to build my own
script?

Regards,

Miguel

This message and any attachments are intended for the use of the addressee or addressees only. The unauthorised disclosure, use, dissemination or copying (either in whole or in part) of its content is not permitted. If you received this message in error, please notify the sender and delete it from your system. Emails can be altered and their integrity cannot be guaranteed by the sender.

Please consider the environment before printing this email.
Caldarale, Charles R
2012-04-02 19:28:35 UTC
Permalink
Subject: Bash script for monitoring status of the Tomcat server
I would like to run a bash script to monitor these values and warn
me if the reach a certain level. Also a tool that generates some
graphs would be great.
Not quite sure how you can put "bash" and "graphs" together, but nonetheless...

1) Use JConsole or VisualVM to graphically monitor what's going on inside Tomcat and the JVM via JMX. (Obviously not a bash script, but it's the easiest thing to do.)

2) Use wget or curl to access Tomcat's text-mode manager app and parse the results.

3) Use a command-line JMX tool like jmxsh (http://code.google.com/p/jmxsh/) to extract information and parse out whatever you want.

4) Use one of the enhanced versions of Tomcat (e.g., tc Server) that includes automatic monitoring and notification.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Christopher Schultz
2012-04-02 19:49:55 UTC
Permalink
Chuck,
Post by Caldarale, Charles R
From: Miguel González Castaños
monitoring status of the Tomcat server
I would like to run a bash script to monitor these values and
warn me if the reach a certain level. Also a tool that generates
some graphs would be great.
Not quite sure how you can put "bash" and "graphs" together, but nonetheless...
2) Use wget or curl to access Tomcat's text-mode manager app and parse the results.
+1 -- and use the JMXProxyServlet, which lets you query specific
components like the connectors. We've been doing this lately to great
success.

You can use a tool like rrdtool to store the data and generate
nice-looking graphs over time. You can also easily use the same feed
to do real-time monitoring using a tool like Nagios, Ichinga, etc.
Post by Caldarale, Charles R
3) Use a command-line JMX tool like jmxsh
(http://code.google.com/p/jmxsh/) to extract information and parse
out whatever you want.
While this is a tempting idea, when you start probing many different
values via JMX, you'll find that starting a dozen JVMs and connecting
via JMX starts to strain the server unnecessarily. That's why I
recommend using JMXProxyServlet -- you get the power of JMX without
actually making a JMX connection.

- -chris
Darryl Lewis
2012-04-02 23:20:55 UTC
Permalink
Try JavaMelody. It does a lot of monitoring straight out of the 'box'.
For there, it is a small step to use wget to screen scrape values from Melody and send emails once they exceed a threshold.

-----Original Message-----
From: Christopher Schultz [mailto:***@christopherschultz.net]
Sent: Tuesday, 3 April 2012 5:50 AM
To: Tomcat Users List
Subject: Re: Bash script for monitoring status of the Tomcat server

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,
Post by Caldarale, Charles R
From: Miguel González Castaños
monitoring status of the Tomcat server
I would like to run a bash script to monitor these values and
warn me if the reach a certain level. Also a tool that generates
some graphs would be great.
Not quite sure how you can put "bash" and "graphs" together, but nonetheless...
2) Use wget or curl to access Tomcat's text-mode manager app and parse the results.
+1 -- and use the JMXProxyServlet, which lets you query specific
components like the connectors. We've been doing this lately to great
success.

You can use a tool like rrdtool to store the data and generate
nice-looking graphs over time. You can also easily use the same feed
to do real-time monitoring using a tool like Nagios, Ichinga, etc.
Post by Caldarale, Charles R
3) Use a command-line JMX tool like jmxsh
(http://code.google.com/p/jmxsh/) to extract information and parse
out whatever you want.
While this is a tempting idea, when you start probing many different
values via JMX, you'll find that starting a dozen JVMs and connecting
via JMX starts to strain the server unnecessarily. That's why I
recommend using JMXProxyServlet -- you get the power of JMX without
actually making a JMX connection.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk96AuMACgkQ9CaO5/Lv0PAMqwCgnMEf3G54uFmERY1h/ezDRhCk
aKIAnibgy+FJlo2Qcr87iOE6+43EP+gR
=NIfs
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org

Т���������������������������������������������������������������������ХF�V�7V'67&�&R�R���âW6W'2�V�7V'67&�&TF��6B�6�R��&pФf�"FF�F����6����G2�R�
Leon Rosenberg
2012-04-03 13:32:30 UTC
Permalink
or...
you take moskito which comes with buildin threadmonitoring, configure
your thresholds, and watch logfile with your bashscript for
RED,YELLOW,ORANGE messages...
regards
Leon

P.S.
http://moskito.anotheria.net/moskitodemo/mui/mskThresholds
Post by Darryl Lewis
Try JavaMelody. It does a lot of monitoring straight out of the 'box'.
For there, it is a small step to use wget to screen scrape values from Melody and send emails once they exceed a threshold.
-----Original Message-----
Sent: Tuesday, 3 April 2012 5:50 AM
To: Tomcat Users List
Subject: Re: Bash script for monitoring status of the Tomcat server
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chuck,
Post by Caldarale, Charles R
From: Miguel González Castaños
monitoring status of the Tomcat server
I would like to run a bash script to monitor these values and
warn me if the reach a certain level. Also a tool that generates
some graphs would be great.
Not quite sure how you can put "bash" and "graphs" together, but nonetheless...
2) Use wget or curl to access Tomcat's text-mode manager app and parse the results.
+1 -- and use the JMXProxyServlet, which lets you query specific
components like the connectors. We've been doing this lately to great
success.
You can use a tool like rrdtool to store the data and generate
nice-looking graphs over time. You can also easily use the same feed
to do real-time monitoring using a tool like Nagios, Ichinga, etc.
Post by Caldarale, Charles R
3) Use a command-line JMX tool like jmxsh
(http://code.google.com/p/jmxsh/) to extract information and parse
out whatever you want.
While this is a tempting idea, when you start probing many different
values via JMX, you'll find that starting a dozen JVMs and connecting
via JMX starts to strain the server unnecessarily. That's why I
recommend using JMXProxyServlet -- you get the power of JMX without
actually making a JMX connection.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk96AuMACgkQ9CaO5/Lv0PAMqwCgnMEf3G54uFmERY1h/ezDRhCk
aKIAnibgy+FJlo2Qcr87iOE6+43EP+gR
=NIfs
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
Loading...