Java Reference
In-Depth Information
mands and read the response. Then we are connecting to the local AS 7 instance
and issuing a
":jndi-view"
command.
Note
The
connect
command can be used for connecting to a remote AS 7 host as
well by adding the following parameters:
connect
,
(String controller-
Host
,
int co ntrollerPort
,
String username
,
String password)
.
The response variable is an
org.jboss.dmr.ModelNode
type, which can be fur-
ther inspected, as shown in the following example, which goes in to some depth
about platform MBeans, to get some memory statistics:
from org.jboss.as.cli.scriptsupport import CLI
cli = CLI.newInstance()
cli.connect()
cli.cmd("cd /core-service=platform-mbean/
type=memory/")
result =
cli.cmd(":read-resource(recursive=false,proxies=false,include-runtime=true,include-defaults=true)")
response = result.getResponse()
enabled =
response.get("result").get("heap-memory-usage")
used = enabled.get("used").asInt()
if used > 512000000:
print "Over 1/2 Gb Memory usage "
else:
print 'Low usage!'
cli.disconnect()