Re: Assessing Tomcat's State

2003-06-09 Thread Francisco J. Bido
Thanks for the link.   I didn't know about Nagios; it seems like a 
pretty useful tool.  I'll have to take for a spin.

About the Tomcat state issue, I actually got them resolved.  I 
basically followed Tim Funk's tips (see prior posts).
I modified some C code to get the UNIX PIDs straight from the kernel 
and handle the polling for the "shutting down" state, and
also  found some nice URL classes within the Cocoa frameworks 
(Objective-C on Mac OS X) to handle the polling
for the "starting up" state.   I'm a happy camper.

-FB





On Sunday, June 8, 2003, at 07:10  PM, Yoav Shapira wrote:

Howdy,
I use nagios for this: www.nagios.org.
Yoav Shapira

=
Yoav Shapira
[EMAIL PROTECTED]
__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Assessing Tomcat's State

2003-06-08 Thread Yoav Shapira
Howdy,
I use nagios for this: www.nagios.org.

Yoav Shapira


=
Yoav Shapira
[EMAIL PROTECTED]

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Assessing Tomcat's State

2003-06-08 Thread lists
On 8 Jun 2003 at 21:59, Euan Guttridge wrote:

> slightly off subject : has anyone written a 'watchdog' for tomcat? Simply a
> process that checks if tomcat is alive every x seconds, if dead restarts
> tomcat. 

I was after this a couple of months back.  I found the solution in a list and 
accomodated it for 
tomcat.  Nothing briliant, nor is it the only way..  But its quick, short and sweet.  
This past 
week I did this "type" of heartbeat mechanism, currently for an app on BEA 7.0

Criteria for the Tomcat heartbeat:

1. Tomcat request
a. No response no tomcat   -  Down
b. A Response tomcat is up
   > If the requested servlet is not available  then Tomcat throws a 404 
status code

With this in mind:

create a heartbeat servlet  that calls hbURLCon = (HttpURLConnection)   
url.openConnection(); at 
some time interval.

StatusCode  =hbURLCon.getResponseCode();
if (statusCode > 400 & statusCode < 500) {
   // report Tomcat up
}  

You can get more sophisticated if you like.







RE: Assessing Tomcat's State

2003-06-08 Thread Euan Guttridge
slightly off subject : has anyone written a 'watchdog' for tomcat? Simply a
process that checks if tomcat is alive every x seconds, if dead restarts
tomcat. 

Thanks
Euan

-Original Message-
From: Yoav Shapira [mailto:[EMAIL PROTECTED]
Sent: 08 June 2003 03:23
To: Tomcat Users List
Subject: Re: Assessing Tomcat's State


Howdy,
Note that the premise of your question is flawed without a precise
definition
of "starting up" and "shutting down."  Consider a tomcat instance with N
webapps, each of which with one ServletContextListener.  Tomcat on startup
will
send the contextInitialized event to each of these listeners.  Each listener
may do things that take a long time, and may or may not do them in the
background.  

In the above scenario, when is the "starting up" state over and the
"started"
state entered?  Is it when tomcat sends all N events, or when all N events
are
done processing?

Similar scenarios can easily be construed for shutting down, and they are
not
limited to listeners as filters and servlets can all do varying amounts of
processing on startup and shutdown.

All of this may not matter in your scenario, so you may not have to worry
about
it at all ;)  But they are important to keep in mind if you're trying to
come
up with some sort of general solution.

Yoav Shapira


--- "Francisco J. Bido" <[EMAIL PROTECTED]> wrote:
> That's a good idea.  Thanks!
> 
> Take care,
> -FB
> 
> 
> On Saturday, June 7, 2003, at 03:23  PM, Tim Funk wrote:
> 
> > The easy kluge is to hack the startup scripts  (or write wrappers) 
> > around the startup scripts to maintain this status in some file, for 
> > arguements sake: cowbell.txt
> >
> > In startup.sh --> echo "starting" > cowbell.txt
> > In startup.sh, a timer does wgets on a static asset. Once the asset is 
> > returned correctly: echo "started" > cowbell.txt
> >
> > In shutdown.sh --> echo "stopping" > cowbell.txt
> > In shutdown.sh --> A timer looking for the java process id. Once the 
> > process ID is gone, echo "stopped" > cowbell.txt
> >
> >
> > -Tim
> >
> > Francisco J. Bido wrote:
> >> Thanks Tim,
> >> Those suggestions work pretty well for checking the "running" and the 
> >> "stopped" states.  The ones giving me a headache are really "starting 
> >> up" and "shutting down".The only thing I can think of at this 
> >> point is to monitor the size of catalina.out and trigger an event 
> >> went it doesn't change.
> >> This is nasty since many things can cause the file to appear idle 
> >> i.e., a busy CPU.  Any thoughts on these assessing these remaining 
> >> states?
> >> -FB
> >> On Saturday, June 7, 2003, at 02:41  PM, Tim Funk wrote:
> >>> Depending on your needs if you just need UP or down, you can use 
> >>> wget or a similar agent.
> >>>
> >>> You can also set CATALINA_PID in unix before calling the startup 
> >>> scripts and the file referenced by CATALINA_PID will contain the 
> >>> process ID.
> >>>
> >>> Or you can write a LifeCycle Listener to trap startup and shutdown 
> >>> events.
> >>>
> >>>
> >>> -Tim
> >>>
> >>> Francisco J. Bido wrote:
> >>>
> >>>> Is there any way to assess Tomcat's state via an environment 
> >>>> variable?  For example, I would like to poll an environment 
> >>>> variable to see if Tomcat is:
> >>>> 1. starting up
> >>>> 2. running
> >>>> 3. shutting down
> >>>> 4. stopped
> >>>> There're a bunch of other states out there but the above fulfill my 
> >>>> immediate needs.
> >>>> Parsing through the catalina.out log file is the only way I know 
> >>>> how to do this but this is approach is way too clumsy and ugly.
> >>>> Thanks!
> >>>> -FB
> >>>>
> >>>
> >>>
> >>> -
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


=
Yoav Shapira
[EMAIL PROTECTED]

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Assessing Tomcat's State

2003-06-08 Thread Yoav Shapira
Howdy,
Note that the premise of your question is flawed without a precise definition
of "starting up" and "shutting down."  Consider a tomcat instance with N
webapps, each of which with one ServletContextListener.  Tomcat on startup will
send the contextInitialized event to each of these listeners.  Each listener
may do things that take a long time, and may or may not do them in the
background.  

In the above scenario, when is the "starting up" state over and the "started"
state entered?  Is it when tomcat sends all N events, or when all N events are
done processing?

Similar scenarios can easily be construed for shutting down, and they are not
limited to listeners as filters and servlets can all do varying amounts of
processing on startup and shutdown.

All of this may not matter in your scenario, so you may not have to worry about
it at all ;)  But they are important to keep in mind if you're trying to come
up with some sort of general solution.

Yoav Shapira


--- "Francisco J. Bido" <[EMAIL PROTECTED]> wrote:
> That's a good idea.  Thanks!
> 
> Take care,
> -FB
> 
> 
> On Saturday, June 7, 2003, at 03:23  PM, Tim Funk wrote:
> 
> > The easy kluge is to hack the startup scripts  (or write wrappers) 
> > around the startup scripts to maintain this status in some file, for 
> > arguements sake: cowbell.txt
> >
> > In startup.sh --> echo "starting" > cowbell.txt
> > In startup.sh, a timer does wgets on a static asset. Once the asset is 
> > returned correctly: echo "started" > cowbell.txt
> >
> > In shutdown.sh --> echo "stopping" > cowbell.txt
> > In shutdown.sh --> A timer looking for the java process id. Once the 
> > process ID is gone, echo "stopped" > cowbell.txt
> >
> >
> > -Tim
> >
> > Francisco J. Bido wrote:
> >> Thanks Tim,
> >> Those suggestions work pretty well for checking the "running" and the 
> >> "stopped" states.  The ones giving me a headache are really "starting 
> >> up" and "shutting down".The only thing I can think of at this 
> >> point is to monitor the size of catalina.out and trigger an event 
> >> went it doesn't change.
> >> This is nasty since many things can cause the file to appear idle 
> >> i.e., a busy CPU.  Any thoughts on these assessing these remaining 
> >> states?
> >> -FB
> >> On Saturday, June 7, 2003, at 02:41  PM, Tim Funk wrote:
> >>> Depending on your needs if you just need UP or down, you can use 
> >>> wget or a similar agent.
> >>>
> >>> You can also set CATALINA_PID in unix before calling the startup 
> >>> scripts and the file referenced by CATALINA_PID will contain the 
> >>> process ID.
> >>>
> >>> Or you can write a LifeCycle Listener to trap startup and shutdown 
> >>> events.
> >>>
> >>>
> >>> -Tim
> >>>
> >>> Francisco J. Bido wrote:
> >>>
>  Is there any way to assess Tomcat's state via an environment 
>  variable?  For example, I would like to poll an environment 
>  variable to see if Tomcat is:
>  1. starting up
>  2. running
>  3. shutting down
>  4. stopped
>  There're a bunch of other states out there but the above fulfill my 
>  immediate needs.
>  Parsing through the catalina.out log file is the only way I know 
>  how to do this but this is approach is way too clumsy and ugly.
>  Thanks!
>  -FB
> 
> >>>
> >>>
> >>> -
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


=
Yoav Shapira
[EMAIL PROTECTED]

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Assessing Tomcat's State

2003-06-07 Thread Francisco J. Bido
That's a good idea.  Thanks!

Take care,
-FB
On Saturday, June 7, 2003, at 03:23  PM, Tim Funk wrote:

The easy kluge is to hack the startup scripts  (or write wrappers) 
around the startup scripts to maintain this status in some file, for 
arguements sake: cowbell.txt

In startup.sh --> echo "starting" > cowbell.txt
In startup.sh, a timer does wgets on a static asset. Once the asset is 
returned correctly: echo "started" > cowbell.txt

In shutdown.sh --> echo "stopping" > cowbell.txt
In shutdown.sh --> A timer looking for the java process id. Once the 
process ID is gone, echo "stopped" > cowbell.txt

-Tim

Francisco J. Bido wrote:
Thanks Tim,
Those suggestions work pretty well for checking the "running" and the 
"stopped" states.  The ones giving me a headache are really "starting 
up" and "shutting down".The only thing I can think of at this 
point is to monitor the size of catalina.out and trigger an event 
went it doesn't change.
This is nasty since many things can cause the file to appear idle 
i.e., a busy CPU.  Any thoughts on these assessing these remaining 
states?
-FB
On Saturday, June 7, 2003, at 02:41  PM, Tim Funk wrote:
Depending on your needs if you just need UP or down, you can use 
wget or a similar agent.

You can also set CATALINA_PID in unix before calling the startup 
scripts and the file referenced by CATALINA_PID will contain the 
process ID.

Or you can write a LifeCycle Listener to trap startup and shutdown 
events.

-Tim

Francisco J. Bido wrote:

Is there any way to assess Tomcat's state via an environment 
variable?  For example, I would like to poll an environment 
variable to see if Tomcat is:
1. starting up
2. running
3. shutting down
4. stopped
There're a bunch of other states out there but the above fulfill my 
immediate needs.
Parsing through the catalina.out log file is the only way I know 
how to do this but this is approach is way too clumsy and ugly.
Thanks!
-FB



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Assessing Tomcat's State

2003-06-07 Thread Tim Funk
The easy kluge is to hack the startup scripts  (or write wrappers) around the 
startup scripts to maintain this status in some file, for arguements sake: 
cowbell.txt

In startup.sh --> echo "starting" > cowbell.txt
In startup.sh, a timer does wgets on a static asset. Once the asset is 
returned correctly: echo "started" > cowbell.txt

In shutdown.sh --> echo "stopping" > cowbell.txt
In shutdown.sh --> A timer looking for the java process id. Once the process 
ID is gone, echo "stopped" > cowbell.txt

-Tim

Francisco J. Bido wrote:
Thanks Tim,

Those suggestions work pretty well for checking the "running" and the 
"stopped" states.  The ones giving me a headache are really "starting 
up" and "shutting down".The only thing I can think of at this point 
is to monitor the size of catalina.out and trigger an event went it 
doesn't change.
This is nasty since many things can cause the file to appear idle i.e., 
a busy CPU.  Any thoughts on these assessing these remaining states?

-FB

On Saturday, June 7, 2003, at 02:41  PM, Tim Funk wrote:

Depending on your needs if you just need UP or down, you can use wget 
or a similar agent.

You can also set CATALINA_PID in unix before calling the startup 
scripts and the file referenced by CATALINA_PID will contain the 
process ID.

Or you can write a LifeCycle Listener to trap startup and shutdown 
events.

-Tim

Francisco J. Bido wrote:

Is there any way to assess Tomcat's state via an environment 
variable?  For example, I would like to poll an environment variable 
to see if Tomcat is:
1. starting up
2. running
3. shutting down
4. stopped
There're a bunch of other states out there but the above fulfill my 
immediate needs.
Parsing through the catalina.out log file is the only way I know how 
to do this but this is approach is way too clumsy and ugly.
Thanks!
-FB



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Assessing Tomcat's State

2003-06-07 Thread Francisco J. Bido
Thanks Tim,

Those suggestions work pretty well for checking the "running" and the 
"stopped" states.  The ones giving me a headache are really "starting 
up" and "shutting down".The only thing I can think of at this point 
is to monitor the size of catalina.out and trigger an event went it 
doesn't change.
This is nasty since many things can cause the file to appear idle i.e., 
a busy CPU.  Any thoughts on these assessing these remaining states?

-FB

On Saturday, June 7, 2003, at 02:41  PM, Tim Funk wrote:

Depending on your needs if you just need UP or down, you can use wget 
or a similar agent.

You can also set CATALINA_PID in unix before calling the startup 
scripts and the file referenced by CATALINA_PID will contain the 
process ID.

Or you can write a LifeCycle Listener to trap startup and shutdown 
events.

-Tim

Francisco J. Bido wrote:
Is there any way to assess Tomcat's state via an environment 
variable?  For example, I would like to poll an environment variable 
to see if Tomcat is:
1. starting up
2. running
3. shutting down
4. stopped
There're a bunch of other states out there but the above fulfill my 
immediate needs.
Parsing through the catalina.out log file is the only way I know how 
to do this but this is approach is way too clumsy and ugly.
Thanks!
-FB



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Assessing Tomcat's State

2003-06-07 Thread Tim Funk
Depending on your needs if you just need UP or down, you can use wget or a 
similar agent.

You can also set CATALINA_PID in unix before calling the startup scripts and 
the file referenced by CATALINA_PID will contain the process ID.

Or you can write a LifeCycle Listener to trap startup and shutdown events.

-Tim

Francisco J. Bido wrote:
Is there any way to assess Tomcat's state via an environment variable?  
For example, I would like to poll an environment variable to see if 
Tomcat is:

1. starting up
2. running
3. shutting down
4. stopped
There're a bunch of other states out there but the above fulfill my 
immediate needs.

Parsing through the catalina.out log file is the only way I know how to 
do this but this is approach is way too clumsy and ugly.

Thanks!
-FB
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Assessing Tomcat's State

2003-06-07 Thread Francisco J. Bido
Is there any way to assess Tomcat's state via an environment variable?  
For example, I would like to poll an environment variable to see if 
Tomcat is:

1. starting up
2. running
3. shutting down
4. stopped
There're a bunch of other states out there but the above fulfill my 
immediate needs.

Parsing through the catalina.out log file is the only way I know how to 
do this but this is approach is way too clumsy and ugly.

Thanks!
-FB
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]