How to enable/disable monitoring and attach btrace-agent in GlassFish v3
By msreddy on Sep 09, 2009
The monitoring funcationality including attaching btrace-agent is done based on the 'monitoring-enabled' attribute of 'monitoring-service' element. If monitoring-enabled is true then the btrace-agent is attached as part of startup. When monitoring-enabled is false, btrace-agent is not attached at startup time. However when user changes monitoring-enabled to true while the server is running, it should be possible to attach the btrace-agent and start monitoring functionality.
Purpose of this pair of commands is to provide enable /disable monitoring during run time without having to restart the server (Alternatively user should be able to use asadmin set command to enbale/disable the monitoring-enabled flag, but have to restart the server to take effect). It does attach btrace-agent based on the given pid and optionally sets the monitoring level for given modules.
enable-monitoring [--mbean=false] [--dtrace\*=true] [--level web-container="LOW":ejb-container="HIGH"] [--options="debug=true"] [--pid=<pid>]
sets the attribute 'monitoring-enabled' to 'true'
enable-monitoring --mbean=true --dtrace\*=false
sets the attribute 'monitoring-enabled' to 'true', mbean-enabled to true and dtrace-enabled to false
enable-monitoring --options="debug=true" --pid=<pid>
sets the attribute 'monitoring-enabled' to 'true' and attaches btrace agent using --options
enable-monitoring --level web-container="LOW":ejb="HIGH"
sets the levels for given modules in addition to 'monitoring-enabled'
sets the attribute 'monitoring-enabled' to 'false'
this command will just set the levels for given modules to 'OFF' and it does not change the value for 'monitoring-enabled'
\*- Available as a value-add feature, made available only to the paid customers.
Above also caters an important use case of adhoc monitoring, i.e. turning monitoring on in production while server is running, for ex. enable dtrace on the fly.