Retrieving Statistics

Retrieving Statistics

To retrieve statistics for a node, first retrieve a list of nodes

Description

To obtain statistics for a node:
  1. Retrieve a list of nodes in a cluster.
  2. Send the statistics request using the IP address and port for a node in the cluster.

HTTP method and URI

GET /pools/default/buckets/default/nodes/[host]:[port]/stats

Syntax

Curl request syntax to retrieve a list of nodes:

curl -u [admin]:[password] http://[localhost]:[port]/pools/default/buckets/default/nodes

Curl request syntax to retrieve statistics about a node:

curl -u a[admin]:[password] http://[localhost]: \
          [port]/pools/default/buckets/default/nodes/[localhost]%3A[port]/stats

Example

Curl request example that retrieves a list of nodes from a cluster:

curl -u Administrator:password http://10.5.2.118:8091/pools/default/buckets/default/nodes

The curl request for a node list sends the following HTTP request:

GET /pools/default/buckets/default/nodes HTTP/1.1
User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
Host: 10.5.2.118:8091
Accept: */*

If Couchbase Server successfully handles the request, a response similar to the following displays:

{"servers":[
  {"hostname":"10.5.2.118:8091",
  "uri":"/pools/default/buckets/default/nodes/10.5.2.118%3A8091",
  "stats":
      {"uri":"/pools/default/buckets/default/nodes/10.5.2.118%3A8091/stats"}}
    ....

Curl request example to retrieve statistics for a specific server node. Use the node's IP address and port shown in the response and add /stats as the endpoint:

curl -u Administrator:password \
 http://10.5.2.118:8091/pools/default/buckets/default/nodes/10.5.2.118%3A8091/stats

The curl request for a node's statistics sends the following HTTP request:

GET /pools/default/buckets/default/nodes/10.4.2.4%3A8091/stats HTTP/1.1
User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
Host: 10.4.2.4:8091
Accept: */*

Response

The following statistics returned are for the individual bucket associated with that node in the previous example.

{"hostname":"10.5.2.118:8091","hot_keys":[{"name":"[2012-11-05::3:47:01]"
....
"samplesCount":60,"isPersistent":true,"lastTStamp":1352922180718,"interval":1000}}