Using REST monitoring
REST monitoring uses a similar API to Jolokia, but with a subset of the
features. The REST API is hosted on ${base-url}/${REST-monitoring-Context-Root}/rest
,
by default localhost:4848/rest-monitoring/rest
.
Operations
REST monitoring supports a subset of operations defined in the Jolokia API. It
will expand to include more, but the technical preview currently only supports
the read
operation.
Read
The read
operation reads the details of the requested MBean.
The read
operation accepts GET requests on URLs in the following format:
${base-url}/read/${mbean-name}/${attribute-name}
For example, if you want to read the MBean java.lang:type=Memory
on the
default configuration, you would make a GET request to:
http://localhost:4848/rest-monitoring/rest/read/java.lang:type=Memory
.
A sample output of this request is shown below:
{
"request": {
"mbean": "java.lang:type=Memory",
"type": "read"
,
"value": {
"HeapMemoryUsage": {
"committed": 450363392,
"init": 264241152,
"max": 477626368,
"used": 97480984
,
"ObjectPendingFinalizationCount": 0,
"NonHeapMemoryUsage": {
"committed": 139460608,
"init": 2555904,
"max": -1,
"used": 122389432
,
"Verbose": false,
"ObjectName": "java.lang:type=Memory"
,
"timestamp": 1502799650273,
"status": 200
}
A couple of quick notes:
-
The attribute name can be empty
-
A list of attribute names can be found in the request of an empty attribute name under
value
. So in the example MBean above,HeapMemoryUsage
andNonHeapMemoryUsage
are both attribute names.