You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Miguel González Castaños <mi...@yahoo.es> on 2012/04/02 21:02:42 UTC

Bash script for monitoring status of the Tomcat server

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.


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


Re: Bash script for monitoring status of the Tomcat server

Posted by Leon Rosenberg <ro...@gmail.com>.
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

On Tue, Apr 3, 2012 at 1:20 AM, Darryl Lewis <da...@unsw.edu.au> wrote:
> 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:chris@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,
>
> On 4/2/12 3:28 PM, Caldarale, Charles R wrote:
>>> From: Miguel González Castaños
>>> [mailto:miguel_3_gonzalez@yahoo.es] 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...
>>
>> 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.
>
>> 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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


RE: Bash script for monitoring status of the Tomcat server

Posted by Darryl Lewis <da...@unsw.edu.au>.
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:chris@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,

On 4/2/12 3:28 PM, Caldarale, Charles R wrote:
>> From: Miguel González Castaños
>> [mailto:miguel_3_gonzalez@yahoo.es] 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...
> 
> 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.

> 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Bash script for monitoring status of the Tomcat server

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 4/2/12 3:28 PM, Caldarale, Charles R wrote:
>> From: Miguel González Castaños
>> [mailto:miguel_3_gonzalez@yahoo.es] 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...
> 
> 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.

> 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Bash script for monitoring status of the Tomcat server

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Miguel González Castaños [mailto:miguel_3_gonzalez@yahoo.es] 
> 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.


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