New and Improved CLI Monitoring in GlassFish V2
By janeyoung on Apr 04, 2007
Before GlassFish V2, the only way to monitor attributes in CLI is using the "dotted-name" get command.
asadmin get --monitor (-m) dotted name...
The output looks like this for jvm uptime:
>asadmin get -m server.jvm.update-time
server.jvm.uptime-count = 1115738 (in millisec)
If user would like to monitor multiple attributes, they would have to provide the "dotted-names" as operands: "asadmin get --monitor <dotted-name1> <dotted-name2>...
This is rather cumbersome since user will need to find out the dotted-names for the attributes plus the output is difficult to read for multiple attributes. In addition, the output cannot be saved to a file for further analysis.
In GlassFish V2, there is a new command called monitor.
The output of the monitor command models Unix's vmstat.
The syntax of the monitor command is as follow:
monitor --type monitor_type --user admin_user [--terse=false] [--echo=false] [--interactive=true] [--host localhost] [--port 4848|4849] [--secure | -s] [--passwordfile file_name] [--interval 30] [--filter filter] [--filename filename] instance_name
To monitor jvm in server instance:
>asadmin monitor --type jvm --interval=5 server
The filename option allows user to save the monitoring attributes to a file in comma separated format.
The type option can have the following values: httplistener, keepalive, filecache, connectionqueue, jdbcpool, jvm, threadpool, servlet, connecton, connectorpool, endpoint, entitybean, messagedriven, statefulsession, statelesssession, httpservice, webmodule.
The filter option is used to filter out multiple elements. For example if --type is httplistener and there are two httplisteners in server instance (admin-server), the --filter option is used to specify the httplistener you'd like to monitor.
>asadmin monitor --type httplistener --filter http-listener-1 --interval=5 server
The heading may look a bit crypted, but when you type the "h" key a legend is displayed:
To exit from the monitor command, press the "q" key.
Download GlassFish V2 and give this feature a try.