users@glassfish.java.net

Re: Accessing GF cluster health programmatically?

From: Fialli Joe <joe.fialli_at_oracle.com>
Date: Wed, 07 Nov 2012 12:38:22 -0500

On 11/7/12 4:32 AM, forums_at_java.net wrote:
> I would like to know programmatically which instances in the cluster are
> running. Preferably form one of the instances itself, i.e. asadmin
> get-health
> but only programmatically. Is this possible?
As a restful web service.

You can access the asadmin get-health command as a restful web service
as of glassfish 3.1.2 and greater versions.

Here is an example url to access info for cluster /***myCluster*/
running on machine /*hostname-running-DAS*/ with 3 clustered instances.

     
http:///*hostname-running-DAS*/:4848/management/domain/clusters/cluster//*myCluster*//get-health.json

{
"extraProperties": {
"commandLog": ["get-health --DEFAULT myCluster --clusterName myCluster"],
"instances": [
{
"status": "RUNNING",
"name": "instance01",
"time": "1352306126796"
},
{
"status": "RUNNING",
"name": "instance02",
"time": "1352306127034"
},
{
"status": "RUNNING",
"name": "instance03",
"time": "1352306126744"
}
]
},
"properties": {},
"message": "instance01 started since Wed Nov 07 11:35:26 EST 2012\ninstance02 started since Wed Nov 07 11:35:27 EST 2012\ninstance03 started since Wed Nov 07 11:35:26 EST 2012"
}


-Joe Fialli

>
> --
>
> [Message sent by forum member 'lprimak']
>
> View Post: http://forums.java.net/node/892052
>
>