Java Reference
In-Depth Information
In the previous example, we are tracking the resources contained in
/core-
service=platform-mbean/type=memory
. The available resources are
however child resources of the two kinds of available heap memory areas (
heap-
memory-usage
and
non-heap-memory-usage
), as shown by the following code:
[standalone@localhost:9999 /]
/core-service=platform-mbean/
type=memory:read-resource(recursive=false,proxies=false,include-runtime=true,include-defaults=true)
{
"outcome" => "success",
"result" => {
"heap-memory-usage" => {
"init" => 67108864L,
"used" => 59572256L,
"committed" => 170852352L,
"max" => 477233152L
},
"non-heap-memory-usage" => {
"init" => 24313856L,
"used" => 90491328L,
"committed" => 90701824L,
"max" => 369098752L
},
"object-pending-finalization-count" =>
0,
"verbose" => false
}
}
By using just the
get
command of the
ModelNode
object, you can reference the
child resources of the memory type, and reach all the single attributes. Once you
have got the attributes, it's easy to cast them to an integer using the
asInt()
func-
tion of the
ModelNode
object, and use the cool Python constructs to alert your ad-
ministrator.