-
Notifications
You must be signed in to change notification settings - Fork 39
RestAPI
Table of Contents
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: |
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:
Optional: |
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:
|
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) |
- Getting Started
- Data Model
- Running a REST Service
- Using the Java API
- Aggregation
- Search
- API Reference * Java * REST
- Hacking Newts