The following example illustrates how the asadmin tool might be used for monitoring purposes.
A user wants to inspect the number of calls made to a method in the sample PetStore application after it has been deployed onto the Application Server. The instance onto which it has been deployed is named server. A combination of the list and get commands are used to access desired statistics on a method.
Start the Application Server and the asadmin tool.
Set some useful environment variables to avoid entering them for every command:
asadmin> export AS_ADMIN_USER=admin AS_ADMIN_PASSWORD=admin123 asadmin>export AS_ADMIN_HOST=localhost AS_ADMIN_PORT=4849 |
List monitorable components for instance server:
asadmin> list --user adminuser --monitor server* |
Returns (output will be similar to):
server server.applications server.applications.CometEJB server.applications.ConverterApp server.applications.petstore server.http-service server.resources server.thread-pools |
The list of monitorable components includes thread-pools, http-service, resources, and all deployed (and enabled) applications.
List the monitorable subcomponents in the PetStore application (-m can be used instead of --monitor):
asadmin> list -m server.applications.petstore
Returns:
server.applications.petstore.signon-ejb_jar server.applications.petstore.catalog-ejb_jar server.applications.petstore.uidgen-ejb_jar server.applications.petstore.customer-ejb_jar server.applications.petstore.petstore-ejb_jar server.applications.petstore.petstore\.war server.applications.petstore.AsyncSenderJAR_jar server.applications.petstore.cart-ejb_jar |
List the monitorable subcomponents in the EJB module signon-ejb_jar of the PetStore application:
asadmin> list -m server.applications.petstore.signon-ejb_jar |
Returns:
server.applications.petstore.signon-ejb_jar.SignOnEJB server.applications.petstore.signon-ejb_jar.UserEJB |
List the monitorable subcomponents in the entity bean UserEJB for the EJB module signon-ejb_jar of the PetStore application:
asadmin> list -m server.applications.petstore.signon-ejb_jar.UserEJB |
Returns (with dotted name removed for space considerations):
server.applications.petstore.signon-ejb_jar.UserEJB.bean-cache server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods server.applications.petstore.signon-ejb_jar.UserEJB.bean-pool |
List the monitorable subcomponents in the method getUserName for the entity bean UserEJB in the EJB module signon-ejb_jar of the PetStore application:
asadmin> list -m server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods.getUserName |
Returns:
Nothing to list at server.applications.petstore.signon-ejb_jar. UserEJB.bean-methods.getUserName. To get the valid names beginning with a string, use the wildcard "*" character. For example, to list all names that begin with "server", use "list server*". |
There are no monitorable subcomponents for methods. Get all monitorable statistics for the method getUserName.
asadmin> get -m server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods.getUserName.* |
Returns:
server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.executiontime-count = 0 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.executiontime-description = Provides the time in milliseconds spent during the last successful/unsuccessful attempt to execute the operation. server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.executiontime-lastsampletime = 1079981809259 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.executiontime-name = ExecutionTime server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.executiontime-starttime = 1079980593137 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.executiontime-unit = count server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-count = 0 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-description = Provides the number of times an operation was called, the total time that was spent during the invocation and so on. server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-lastsampletime = 1079980593137 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-maxtime = 0 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-mintime = 0 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-name = ExecutionTime server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-starttime = 1079980593137 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-totaltime = 0 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.methodstatistic-unit = server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumerrors-count = 0 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumerrors-description = Provides the total number of errors that occured during invocation or execution of an operation. server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumerrors-lastsampletime = 1079981809273 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumerrors-name = TotalNumErrors server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumerrors-starttime = 1079980593137 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumerrors-unit = count server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumsuccess-count = 0 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumsuccess-description = Provides the total number of successful invocations of the method. server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumsuccess-lastsampletime = 1079981809255 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumsuccess-name = TotalNumSuccess server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumsuccess-starttime = 1079980593137 server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.totalnumsuccess-unit = count |
To also get a specific statistic, such as execution time, use a command such as the following:
asadmin> get -m server.applications.petstore.signon-ejb_jar. UserEJB.bean-methods.getUserName.executiontime-count |
Returns:
server.applications.petstore.signon-ejb_jar.UserEJB.bean-methods. getUserName.executiontime-count = 1 |