Component Documentation : WAN Replication User Guide : Monitoring and Managing WAN Replication : Connecting via the REST APIs
Connecting via the REST APIs
The REST APIs are enabled automatically by default. No setup is required.
The REST endpoint for accessing WAN statistics is not available directly from the Orchestrator process. Rather, it is available from the Terracotta Management Server (TMS) and the first stripe of the Terracotta Server Array (TSA).
For example, the following would return a JSON object containing all the WAN-replicated cache managers in the TSA located on "localhost" with a management port of 46266.
http://localhost:46266/tc-management-api/v2/agents/wan/cacheManagers
This would return:
{
"agentId": "embedded",
"apiVersion": "v2",
"entities": [
{
"agentId": "127.0.0.1_63613",
"cacheManagerName": "test",
"cacheNames": [
"test-cache-1"
]
}
],
"exceptionEntities": [

]
}
To narrow the view to just a particular cache manager, you can add names=<cache manager name> to the above URL as follows:
http://localhost:46266/tc-management-api/v2/agents/wan/cacheManagers;names=test
To get the list of caches inside the cache manager, you can further drill down by appending /caches tonames=<cache manager name> as follows:
http://localhost:46266/tc-management-api/v2/agents/wan/cacheManagers;names=test/caches
This would return:
{
"agentId": "embedded",
"apiVersion": "v2",
"entities": [
{
"agentId": "127.0.0.1_63613",
"cacheManagerName": "test",
"cacheName": "test-cache-1",
"attributes": {
"cluster-listener.buffer.size": 0,
"topology.replicas": [
"localhost:11477"
],
"topology.master": "localhost:43051",
"config.replication-mode": "UNIDIRECTIONAL"
}
}
],
"exceptionEntities": [

]
}
The statistics returned from the REST interface are the same as those returned from the JMX interface. They are found inside the attributes map in the returned JSON object.
If you want to drill down into a replica's statistics for a given cache, you can append /replicas tonames=<cache manager name>/caches. The following would give you the full list of connected replicas with their relevant statistics:
http://localhost:46266/tc-management-api/v2/agents/wan/cacheManagers;names=test/
caches/replicas
The following would return only the statistics for the given replica at localhost_25394.
http://localhost:46266/tc-management-api/v2/agents/wan/
cacheManagers;names=test/caches/replicas;names=localhost_25394
For each level of statistics, it is also possible to narrow the view to show only a single statistical attribute by specifying the name of attribute with the ?show= parameter. For example, to restrict the returned attributes to only show the sync.tps.Count attribute, specify this:
http://localhost:46266/tc-management-api/v2/agents/wan/cacheManagers;
names=test/caches/replicas;names=localhost_25394?show=sync.tps.Count
Ths would return:
{
"agentId": "embedded",
"apiVersion": "v2",
"entities": [
{
"agentId": "127.0.0.1_63613",
"cacheManagerName": "test",
"cacheName": "test-cache-1",
"attributes": {
"sync.tps.Count": 0,
},
"replica": "localhost_25394"
}
],
"exceptionEntities": [

]
}
As a convenience, it is also possible to select attributes based on a prefix. This would be useful for returning all the views of a given statistic, or for returning all statistics in a given category. For example:
http://localhost:46266/tc-management-api/v2/agents/wan/cacheManagers;
names=test/caches;names=test-cache-1?showPrefix=topology
The above example would return all attributes beginning with topology, as follows:
{
"agentId": "localhost_62890",
"entities": [
{
"agentId": "embedded",
"cacheManagerName": "test",
"cacheName": "test-cache-1",
"attributes": {
"topology.replicas": [],
"topology.master": "localhost:32567"
}
}
],
"exceptionEntities": [],
"apiVersion": "v2"
}
You can view the configuration for a given orchestrator as follows:
http://localhost:46266/tc-management-api/v2/agents/wan/config
This would return:
{
"agentId":"embedded",
"apiVersion":"v2",
"entities":[
{
"agentId":"127.0.0.1_63613",
"config":
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
<wan-config xmlns=\"http://config.wan.terracottatech.com\">\n
<bind host=\"10.60.29.127\" port=\"9001\"/>\n
<logs>logs</logs>\n
<monitoringEnabled>true</monitoringEnabled>\n\n
<cacheManager ehcacheConfigURI=\"file://<path to ehcache>/ehcache.xml\">\n
<cache name=\"one\">\n
<master host=\"masterip\" port=\"9001\"/>\n
</cache>\n
<cache name=\"two\">\n
<master host=\"master ip\" port=\"9001\"/>\n
</cache>\n
</cacheManager>\n
</wan-config>\n"
}
],
"exceptionEntities":[
]
}
Copyright © 2010-2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback