Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JBoss 7 CLI to query all the deployed applications

Using JBoss 7's jboss-cli I can query the deployed applications:

[standalone@localhost:9999 /] deployment-info --headers=
NAME                 RUNTIME-NAME         PERSISTENT ENABLED STATUS
jboss-ejb-in-ear.ear jboss-ejb-in-ear.ear true       true    OK
singleton_in_war.war singleton_in_war.war true       true    OK

Programatically I can query any CLI query starting with /, for example this:

/path=jboss.server.log.dir:read-attribute(name=path)

where the address is

/path=jboss.server.log.dir

and the operation is

read-attribute(name=path)

My question is, for the CLI query

deployment-info --headers=

what is the address and what is the operation?

Best regards, SK

like image 378
Kilátó Avatar asked Feb 21 '14 08:02

Kilátó


2 Answers

I've found this solution useful for querying the deployed applications in standalone mode by using CLI api.

The CLI query is:

/deployment=*:read-attribute(name=name)

where the address "/deployment=*" will target all the deployments. And basically requests the name attribute for all deployments in current server.

Finally this snippet shows the code for executing the query by using the model controller api:

ModelControllerClient client = "...create the controller client";

ModelNode operation = new ModelNode( );
operation.get( "address" ).add( "deployment", "*" );
operation.get( "operation" ).set( "read-attribute" );
operation.get( "name" ).set( "name" );

ModelNode result = client.execute( operation );

List<ModelNode> deployments = result.get( "result" ).asList();
String deploymentName;

// finally we can iterate and get the deployment names.
for ( ModelNode deployment : deployments ) {
    deploymentName = deployment.get( "result" ).asString();
    System.out.println( "deploymentName = " + deploymentName );
}

Works for both WF10 and EAP7

like image 53
Walter Medvedeo Avatar answered Sep 16 '22 19:09

Walter Medvedeo


Did you try this command?

/server-group=*/deployment=*/:read-resource(recursive=false,proxies=true,include-runtime=true,include-defaults=true)

You can navigate the model nodes and get the details you needed.

like image 33
akumaras Avatar answered Sep 18 '22 19:09

akumaras