Skip to content
Cheuk Lam edited this page Oct 1, 2015 · 7 revisions

REST API

Description Persist new samples
URL /samples
Method POST
URL Params (none)
Data Params

Method takes as input, a JSON array of sample objects.

[
  {
    'resource': [object],
    'timestamp': [milliseconds],
    'name': [string],
    'type': [string],
    'value': [numeric],
    'attributes': [associative array]
  }
  ...
]

Note: the type attribute is one of: COUNTER or GAUGE.

Note: Sample attributes are optional.

Example:

[
  {
    'resource': {
      'id': '/hosts/web/cpu0',
      'attributes': { 'os': 'linux' }
    },
    'timestamp': 1412009776000,
    'name': 'temperature',
    'type': 'GAUGE',
    'value': 99.9
  }
]
Success Response 201 Created
Error Response 400 Bad Request
Sample Call
curl -D - -X POST \
    -H "Content-Type: application/json" \
    -d @samples.txt \
    http://0.0.0.0:8080/samples
Notes (none)
Description Query for raw (unaggregated) samples.
URL /samples/{resource_id}
Method GET
URL Params

Optional:

start=[timespec]
Query start time, specified as seconds since the Unix epoch, or an ISO 8601 timestamp.
end=[timespec]
Query end time, specified as seconds since the Unix epoch, or an ISO 8601 timestamp.
Data Params (none)
Success Response

Method returns a JSON array of "row" arrays, each containing one or more sample representation objects. The inner, or "row" arrays contain results with common timestamps; They represent the available samples in a group, for some time period.

[
  [
    {
      "timestamp": [milliseconds],
      "name": [string],
      "type": [string],
      "value": [numeric]
    },
    ...
  ],
  ...
]

Note: The type attribute is one of: COUNTER or GAUGE.

Note: Sample attributes are optional.

Example:

[
  [
    {
      "timestamp": 900007800000,
      "name": "speed",
      "type": "GAUGE",
      "value": 500.0
    }
  ]
]
Error Response (none)
Sample Call
curl http://localhost:8080/samples/hosts/web
Notes (none)
Description Query for aggregated measurements.
URL /measurements/{report}/{resource}
Method GET
URL Params

Required:

resolution=[period]

The resolution of measurements returned, specified as an integer value, followed by a resolution unit specifier character. Valid unit specifiers are s, m, h, d, and w.

Examples: 15m, 1d, 1w (for 15 minutes, 1 day, and 1 week respectively).

Optional:

start=[timespec]
Query start time, specified as seconds since the Unix epoch, or an ISO 8601 timestamp.
end=[timespec]
Query end time, specified as seconds since the Unix epoch, or an ISO 8601 timestamp.
Data Params (none)
Success Response

Method returns a JSON array of "row" arrays, each containing one or more measurement representation objects. The inner, or "row" arrays contain results with common timestamps; They represent the aggregate results for a group, at some time interval.

[
  [
    {
      "timestamp": [milliseconds],
      "name": [string],
      "value": [numeric]
    },
    ...
  ],
  ...
]

Example:

[
  [
    {
      "timestamp": 900007800000,
      "name": "speed",
      "value": 500.0
    }
  ]
]
Error Response (none)
Sample Call  
Notes (none)
Description Search resources.
URL /search
Method GET
URL Params

Required:

q=[search query]
Search query string (see: Search).
Data Params (none)
Success Response

Returns an array of search result objects. Each search result object contains an attribute for the corresponding resource, and an array of the associated metric names.

[
  {
    "resource" : [object]
    "metrics" : [string array]
  }
  ..
]

Example:

[
  {
    "resource" : {
      "id" : "/hosts/web/processors",
      "attributes" : {
         "location" : "americas"
      }
    },
    "metrics" : [
      "cpu0",
      "cpu1",
      "cpu2",
      "cpu3"
    ]
  }
  ..
]
Error Response (none)
Sample Call
curl http://host:8080/search?q=americas
Notes (none)
Clone this wiki locally