Skip to main content

Writing probes for Glassfish container events

10 replies [Last post]
Comerford, Sean...
Offline
Joined: 2010-11-05
Points: 0

We're finally about to turn the keys on V3 in production here at ESPN.

Been doing a bit of reading on the probes that have been added to the V3 monitoring framework.

These look really promising.

But I'm a little stuck on how to actually go about creating and deploying one that listens for container events.

For example, I want to create a probe to be notified of things like when an http-listener's connection queue overflows or even when it reaches a certain threshold (i.e. more than X requests are queued).

Can anyone point me in the right direction?

--
Sean Comerford
ESPN.com Site Architecture

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bnevins
Offline
Joined: 2005-03-28
Points: 0

See this blog that demonstrates how to make and use your own probes
inside apps.
*https://blogs.oracle.com/foo/entry/mort_learns_how_to_use
*
As a bonus -- it does what list-probes does!

On 2/15/2012 6:21 PM, Comerford, Sean wrote:
> We're finally about to turn the keys on V3 in production here at ESPN.
>
> Been doing a bit of reading on the probes that have been added to the
> V3 monitoring framework.
>
> These look really promising.
>
> But I'm a little stuck on how to actually go about creating and
> deploying one that listens for container events.
>
> For example, I want to create a probe to be notified of things like
> when an http-listener's connection queue overflows or even when it
> reaches a certain threshold (i.e. more than X requests are queued).
>
> Can anyone point me in the right direction?
>
> --
> Sean Comerford
> ESPN.com Site Architecture
>>
>

bnevins
Offline
Joined: 2005-03-28
Points: 0

I created a simple webapp that listens to 2 of the 137 built-in
GlassFish probes. When either of the probes fire, the listener class in
the app is called with the parameters that the probe received. I simply
write the info out to the server.log but a real app could do anything it
likes. Including, e.g. sending an email when a limit is exceeded etc.

This sample app will give you an idea of the power of Monitoring in
GlassFish 3.x

Details -

1. the source is available from subversion here:
*https://svn.java.net/svn/glassfish~svn/trunk/v2/appserv-tests/devtests/admin/cli/apps/ConnectionProber*
2. Run the app like so:
http://localhost:8080/ConnectionProber
3. On the page from (2) notice these 2 lines -- these are the 2 probes
of interest:
* glassfish:web:http-service:requestStartEvent (java.lang.String
appName, java.lang.String hostName, java.lang.String serverName,
int serverPort,
java.lang.String contextPath, java.lang.String servletPath)
* glassfish:jdbc:connection-pool:connectionAcquiredEvent
(java.lang.String poolName, java.lang.String appName,
java.lang.String moduleName
4. Hit the page a few times to get some typical output like this in the
server.log
(ugly logging junk deleted)
Web Start Event with these params:ConnectionProber, server,
localhost, 8080, /ConnectionProber, /
Connection Accepted! name=http-listener-1, connection: 27419954,
address: /127.0.0.1:53313

Take a look at the sample code and you can see how easy it is to create
a listener and register it at run-time.

On 2/16/2012 3:13 PM, Byron Nevins wrote:
> See this blog that demonstrates how to make and use your own probes
> inside apps.
> *https://blogs.oracle.com/foo/entry/mort_learns_how_to_use
> *
> As a bonus -- it does what list-probes does!
>
>
> On 2/15/2012 6:21 PM, Comerford, Sean wrote:
>> We're finally about to turn the keys on V3 in production here at ESPN.
>>
>> Been doing a bit of reading on the probes that have been added to the
>> V3 monitoring framework.
>>
>> These look really promising.
>>
>> But I'm a little stuck on how to actually go about creating and
>> deploying one that listens for container events.
>>
>> For example, I want to create a probe to be notified of things like
>> when an http-listener's connection queue overflows or even when it
>> reaches a certain threshold (i.e. more than X requests are queued).
>>
>> Can anyone point me in the right direction?
>>
>> --
>> Sean Comerford
>> ESPN.com Site Architecture
>>>
>>

liang.x.zhao
Offline
Joined: 2011-12-18
Points: 0

The value could be got via GlassFish REST Interface for Management and Monitorin:

1. Turn on Monitoring.Http=HIGH under Configurations -> Server Config -> Monitoring through Admin GUI.

2. Restart GlassFish.

3. Open browser and input url "http://yourserver:4848/monitoring/domain/server/network/http-listener-1/connection-queue". Then you will see someting like below. The value of countqueued may be the thing you are interested in.

countopenconnections
count : 0
lastsampletime : 1329379340596
description : The+number+of+open%2Factive+connections
unit : count
name : CountOpenConnections
starttime : 1329379340596
countoverflows
count : 0
lastsampletime : 1329379336199
description : Number+of+times+the+queue+has+been+too+full+to+accommodate+a+connection
unit : count
name : CountOverflows
starttime : 1329379265986
countqueued
count : 0
lastsampletime : 1329379336199
description : Number+of+connections+currently+in+the+queue
unit : count
name : CountQueued
starttime : 1329379265986
countqueued15minutesaverage
count : 0
lastsampletime : 1329379340601
description : Average+number+of+connections+queued+in+the+last+15+minutes
unit : count
name : CountQueued15MinutesAverage
starttime : 1329379340601
countqueued1minuteaverage
count : 0
lastsampletime : 1329379340601
description : Average+number+of+connections+queued+in+the+last+1+minute
unit : count
name : CountQueued1MinuteAverage
starttime : 1329379340601
countqueued5minutesaverage
count : 0
lastsampletime : 1329379340601
description : Average+number+of+connections+queued+in+the+last+5+minutes
unit : count
name : CountQueued5MinutesAverage
starttime : 1329379340601
counttotalconnections
count : 0
lastsampletime : 1329379336199
description : Total+number+of+connections+that+have+been+accepted
unit : count
name : CountTotalConnections
starttime : 1329379265986
counttotalqueued
count : 0
lastsampletime : 1329379336199
description : Total+number+of+connections+that+have+been+queued
unit : count
name : CountTotalQueued
starttime : 1329379265986
maxqueued
count : 4096
lastsampletime : 1329379336199
description : Maximum+size+of+the+connection+queue
unit : count
name : MaxQueued
starttime : 1329379265986
peakqueued
count : 0
lastsampletime : 1329379336199
description : Largest+number+of+connections+that+were+in+the+queue+simultaneously
unit : count
name : PeakQueued
starttime : 1329379265986
tickstotalqueued
count : 0
lastsampletime : 1329379336199
description : %28Unsupported%29+Total+number+of+ticks+that+connections+have+spent+in+the+queue
unit : count
name : TicksTotalQueued
starttime : 1329379265986

Jennifer Chou Guest
Offline
Joined: 2011-01-04
Points: 0

Did you see the doc on Monitoring Scripting Client?
http://docs.oracle.com/cd/E19226-01/821-1008/index.html

There is a sample script you can follow to see how it works.

There may not be probes specifically for 'http-listener's connection
queue overflows or even when it reaches a certain threshold'. You can
run 'asadmin list-probes' to list all the probes available, and
'list-probes --details name_of_probe' to get more info. I know there
are many that are begin and end events for the containers.

Jennifer

On 2/15/12 9:21 PM, Comerford, Sean wrote:
> We're finally about to turn the keys on V3 in production here at ESPN.
>
> Been doing a bit of reading on the probes that have been added to the
> V3 monitoring framework.
>
> These look really promising.
>
> But I'm a little stuck on how to actually go about creating and
> deploying one that listens for container events.
>
> For example, I want to create a probe to be notified of things like
> when an http-listener's connection queue overflows or even when it
> reaches a certain threshold (i.e. more than X requests are queued).
>
> Can anyone point me in the right direction?
>
> --
> Sean Comerford
> ESPN.com Site Architecture
>>
>

Comerford, Sean...
Offline
Joined: 2010-11-05
Points: 0

When I run list-probes in asadmin to see what's available I get this:

asadmin> list-probes
Command list-probes not found.
Check the entry of command name. This command may be provided by a package that is not installed.
Closest matching local and remote command(s):
list-nodes
Command list-probes executed successfully.

I'm using v3.1.1 if that matters.

--
Sean Comerford
ESPN.com Site Architecture

From: Jennifer Galloway >
Date: Wed, 15 Feb 2012 23:07:12 -0500
To: Sean Comerford >
Cc: "users@glassfish.java.net" >
Subject: Re: Writing probes for Glassfish container events

Did you see the doc on Monitoring Scripting Client?
http://docs.oracle.com/cd/E19226-01/821-1008/index.html

There is a sample script you can follow to see how it works.

There may not be probes specifically for 'http-listener's connection queue overflows or even when it reaches a certain threshold'. You can run 'asadmin list-probes' to list all the probes available, and 'list-probes --details name_of_probe' to get more info. I know there are many that are begin and end events for the containers.

Jennifer

On 2/15/12 9:21 PM, Comerford, Sean wrote:
We're finally about to turn the keys on V3 in production here at ESPN.

Been doing a bit of reading on the probes that have been added to the V3 monitoring framework.

These look really promising.

But I'm a little stuck on how to actually go about creating and deploying one that listens for container events.

For example, I want to create a probe to be notified of things like when an http-listener's connection queue overflows or even when it reaches a certain threshold (i.e. more than X requests are queued).

Can anyone point me in the right direction?

--
Sean Comerford
ESPN.com Site Architecture

________________________________
Please consider the environment before printing this e-mail.

pauldavies
Offline
Joined: 2007-01-03
Points: 0

Hi,

Are you using Oracle GlassFish Server or GlassFish Server Open Source
Edition?

The list-probes subcommand and the monitoring scripting client are
available only in Oracle GlassFish Server, not GlassFish Server Open
Source Edition.

Regards,
-Paul Davies

On 2/16/2012 9:11 AM, Comerford, Sean wrote:
> When I run list-probes in asadmin to see what's available I get this:
>
> /asadmin> list-probes/
> /Command list-probes not found. /
> /Check the entry of command name. This command may be provided by a
> package that is not installed./
> /Closest matching local and remote command(s): /
> / list-nodes/
> /Command list-probes executed successfully./
>
> I'm using v3.1.1 if that matters.
>
> --
> Sean Comerford
> ESPN.com Site Architecture
>
> From: Jennifer Galloway >
> Date: Wed, 15 Feb 2012 23:07:12 -0500
> To: Sean Comerford >
> Cc: "users@glassfish.java.net "
> >
> Subject: Re: Writing probes for Glassfish container events
>
> Did you see the doc on Monitoring Scripting Client?
> http://docs.oracle.com/cd/E19226-01/821-1008/index.html
>
> There is a sample script you can follow to see how it works.
>
> There may not be probes specifically for 'http-listener's connection
> queue overflows or even when it reaches a certain threshold'. You
> can run 'asadmin list-probes' to list all the probes available, and
> 'list-probes --details name_of_probe' to get more info. I know there
> are many that are begin and end events for the containers.
>
> Jennifer
>
> On 2/15/12 9:21 PM, Comerford, Sean wrote:
>> We're finally about to turn the keys on V3 in production here at ESPN.
>>
>> Been doing a bit of reading on the probes that have been added to the
>> V3 monitoring framework.
>>
>> These look really promising.
>>
>> But I'm a little stuck on how to actually go about creating and
>> deploying one that listens for container events.
>>
>> For example, I want to create a probe to be notified of things like
>> when an http-listener's connection queue overflows or even when it
>> reaches a certain threshold (i.e. more than X requests are queued).
>>
>> Can anyone point me in the right direction?
>>
>> --
>> Sean Comerford
>> ESPN.com Site Architecture
>>>
>>
>
>

Comerford, Sean...
Offline
Joined: 2010-11-05
Points: 0

Ahh, I did not realize that.

I knew the dtrace stuff was commercial edition but didn't realize probes too.

We're currently evaluating buying Oracle support / using commercial version so that's good to know.

Can someone send me the output of the list-probes command (or point me to doc) so I can see what's available?

--
Sean Comerford
ESPN.com Site Architecture

From: Paul Davies >
Reply-To: "users@glassfish.java.net" >
Date: Thu, 16 Feb 2012 12:17:19 -0500
To: "users@glassfish.java.net" >
Subject: Re: Writing probes for Glassfish container events

Hi,

Are you using Oracle GlassFish Server or GlassFish Server Open Source Edition?

The list-probes subcommand and the monitoring scripting client are available only in Oracle GlassFish Server, not GlassFish Server Open Source Edition.

Regards,
-Paul Davies

On 2/16/2012 9:11 AM, Comerford, Sean wrote:
When I run list-probes in asadmin to see what's available I get this:

asadmin> list-probes
Command list-probes not found.
Check the entry of command name. This command may be provided by a package that is not installed.
Closest matching local and remote command(s):
list-nodes
Command list-probes executed successfully.

I'm using v3.1.1 if that matters.

--
Sean Comerford
ESPN.com Site Architecture

From: Jennifer Galloway >
Date: Wed, 15 Feb 2012 23:07:12 -0500
To: Sean Comerford >
Cc: "users@glassfish.java.net" >
Subject: Re: Writing probes for Glassfish container events

Did you see the doc on Monitoring Scripting Client?
http://docs.oracle.com/cd/E19226-01/821-1008/index.html

There is a sample script you can follow to see how it works.

There may not be probes specifically for 'http-listener's connection queue overflows or even when it reaches a certain threshold'. You can run 'asadmin list-probes' to list all the probes available, and 'list-probes --details name_of_probe' to get more info. I know there are many that are begin and end events for the containers.

Jennifer

On 2/15/12 9:21 PM, Comerford, Sean wrote:
We're finally about to turn the keys on V3 in production here at ESPN.

Been doing a bit of reading on the probes that have been added to the V3 monitoring framework.

These look really promising.

But I'm a little stuck on how to actually go about creating and deploying one that listens for container events.

For example, I want to create a probe to be notified of things like when an http-listener's connection queue overflows or even when it reaches a certain threshold (i.e. more than X requests are queued).

Can anyone point me in the right direction?

--
Sean Comerford
ESPN.com Site Architecture

________________________________
Please consider the environment before printing this e-mail.

pauldavies
Offline
Joined: 2007-01-03
Points: 0

Hi,

The probes are documented in section 5GFP

of the Oracle GlassFish Server Reference Manual.

Regards,
-Paul Davies

On 2/16/2012 9:25 AM, Comerford, Sean wrote:
> Ahh, I did not realize that.
>
> I knew the dtrace stuff was commercial edition but didn't realize
> probes too.
>
> We're currently evaluating buying Oracle support / using commercial
> version so that's good to know.
>
> Can someone send me the output of the list-probes command (or point me
> to doc) so I can see what's available?
>
> --
> Sean Comerford
> ESPN.com Site Architecture
>
> From: Paul Davies >
> Reply-To: "users@glassfish.java.net "
> >
> Date: Thu, 16 Feb 2012 12:17:19 -0500
> To: "users@glassfish.java.net "
> >
> Subject: Re: Writing probes for Glassfish container events
>
> Hi,
>
> Are you using Oracle GlassFish Server or GlassFish Server Open Source
> Edition?
>
> The list-probes subcommand and the monitoring scripting client are
> available only in Oracle GlassFish Server, not GlassFish Server Open
> Source Edition.
>
> Regards,
> -Paul Davies
>
> On 2/16/2012 9:11 AM, Comerford, Sean wrote:
>> When I run list-probes in asadmin to see what's available I get this:
>>
>> /asadmin> list-probes/
>> /Command list-probes not found. /
>> /Check the entry of command name. This command may be provided by a
>> package that is not installed./
>> /Closest matching local and remote command(s): /
>> / list-nodes/
>> /Command list-probes executed successfully./
>>
>> I'm using v3.1.1 if that matters.
>>
>> --
>> Sean Comerford
>> ESPN.com Site Architecture
>>
>> From: Jennifer Galloway > >
>> Date: Wed, 15 Feb 2012 23:07:12 -0500
>> To: Sean Comerford > >
>> Cc: "users@glassfish.java.net "
>> >
>> Subject: Re: Writing probes for Glassfish container events
>>
>> Did you see the doc on Monitoring Scripting Client?
>> http://docs.oracle.com/cd/E19226-01/821-1008/index.html
>>
>> There is a sample script you can follow to see how it works.
>>
>> There may not be probes specifically for 'http-listener's connection
>> queue overflows or even when it reaches a certain threshold'. You
>> can run 'asadmin list-probes' to list all the probes available, and
>> 'list-probes --details name_of_probe' to get more info. I know there
>> are many that are begin and end events for the containers.
>>
>> Jennifer
>>
>> On 2/15/12 9:21 PM, Comerford, Sean wrote:
>>> We're finally about to turn the keys on V3 in production here at ESPN.
>>>
>>> Been doing a bit of reading on the probes that have been added to
>>> the V3 monitoring framework.
>>>
>>> These look really promising.
>>>
>>> But I'm a little stuck on how to actually go about creating and
>>> deploying one that listens for container events.
>>>
>>> For example, I want to create a probe to be notified of things like
>>> when an http-listener's connection queue overflows or even when it
>>> reaches a certain threshold (i.e. more than X requests are queued).
>>>
>>> Can anyone point me in the right direction?
>>>
>>> --
>>> Sean Comerford
>>> ESPN.com Site Architecture
>>>>
>>>
>>
>>

scatari
Offline
Joined: 2005-06-17
Points: 0

See if this helps..
https://blogs.oracle.com/Prashanth/entry/making_your_app_monitoring_in

Thanks
Sathyan

On 2/15/12 6:21 PM, Comerford, Sean wrote:
> We're finally about to turn the keys on V3 in production here at ESPN.
>
> Been doing a bit of reading on the probes that have been added to the
> V3 monitoring framework.
>
> These look really promising.
>
> But I'm a little stuck on how to actually go about creating and
> deploying one that listens for container events.
>
> For example, I want to create a probe to be notified of things like
> when an http-listener's connection queue overflows or even when it
> reaches a certain threshold (i.e. more than X requests are queued).
>
> Can anyone point me in the right direction?
>
> --
> Sean Comerford
> ESPN.com Site Architecture
>>
>

bnevins
Offline
Joined: 2005-03-28
Points: 0

First of all I have a simple WebApp at [1] and [2]. Try it. It will
show you every probe in GlassFish. And for every probe notice that it
gives both the types and names of all the parameters -- very important
info if you want to write a listener!

Run it like so: http://localhost:8080/MonApp

[1] SOURCE CODE -->
https://svn.java.net/svn/glassfish~svn/trunk/v2/appserv-tests/devtests/a...
[2] Pre-built war file -->
https://svn.java.net/svn/glassfish~svn/trunk/v2/appserv-tests/devtests/a...

More to come that addresses your precise needs...

On 2/15/2012 6:44 PM, Sathyan Catari wrote:
> See if this helps..
> https://blogs.oracle.com/Prashanth/entry/making_your_app_monitoring_in
>
> Thanks
> Sathyan
>
> On 2/15/12 6:21 PM, Comerford, Sean wrote:
>> We're finally about to turn the keys on V3 in production here at ESPN.
>>
>> Been doing a bit of reading on the probes that have been added to the
>> V3 monitoring framework.
>>
>> These look really promising.
>>
>> But I'm a little stuck on how to actually go about creating and
>> deploying one that listens for container events.
>>
>> For example, I want to create a probe to be notified of things like
>> when an http-listener's connection queue overflows or even when it
>> reaches a certain threshold (i.e. more than X requests are queued).
>>
>> Can anyone point me in the right direction?
>>
>> --
>> Sean Comerford
>> ESPN.com Site Architecture
>>>
>>