Upload metrics data to the Rackspace Metrics database

Upload metrics data to the Rackspace Metrics database#

You can use the Rackspace Metrics Ingestion API operations to upload metrics to the Rackspace Metrics database by posting data to the following Rackspace Metrics Ingestion API endpoint:

https://global.metrics-ingest.api.rackspacecloud.com/v2.0

Sending numeric metrics

To send numeric metrics to the Rackspace Metrics database, submit a POST request to the Rackspace Metrics Ingestion API endpoint. Include the metrics you want to upload in the request body as shown in the following example.

Example: Send a set of metrics to the database cURL request:

$ curl -s https://global.metrics-ingest.api.rackspacecloud.com/v2.0/$TENANT_ID/ingest \
-X POST \
-d '[
{
"collectionTime": 1376509892612,
"ttlInSeconds": 172800,
"metricValue": 66,
"metricName": "example.metric.one"
},
{
"collectionTime": 1376509892612,
"ttlInSeconds": 172800,
"metricValue": 66,
"metricName": "example.metric.two"
},
{
"collectionTime": 1376509892612,
"ttlInSeconds": 172800,
"metricValue": 66,
"metricName": "example.metric.three"
}
]
' \
-H 'X-Auth-Token: $AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'

Response

If the data is uploaded successfully, the API service returns a 200 or 202 response code.

If the data is partially uploaded with some errors, the API service returns a 207 response code, and the response body contains a json payload of all metrics that were rejected along with the reason for the failures.

For information about error codes, see the Send metrics operation in the API reference.

Note

You can also include a unit parameter to describe the data included in the metrics set, for example seconds, bytes, percentage, and so on.

Rackspace Metrics lets you send a set of pre-aggregated metrics to the Rackspace Metrics database.

You can upload the following aggregated metric types: - counter metrics - gauge metrics - timer metrics

To send a set of preaggregated metrics to the Rackspace Metrics database, submit a POST request to the Rackspace Metrics Ingestion API endpoint. Include the metric type (counter, gage, timer) you want to upload in the request body, along with the corresponding attributes, as shown in the following example, which uploads an aggregated timer metric to the database.

Example: Send a set of metrics to the database cURL request:

$ curl -s https://global.metrics-ingest.api.rackspacecloud.com/v2.0/$TENANT_ID/ingest/aggregated \
-X POST \
-d '
{
"tenantId": $TENANT_ID,
"timestamp": 1438207399001,
"timers": [
{
"name": "timer_name",
"count": 32,
"rate": 2.3,
"min": 1,
"max": 5,
"sum": 21,
"avg": 2.1,
"median": 3,
"std": 1.01,
"histogram": {
"bin_50": 0,
"bin_100": 0,
"bin_inf": 0
}
}
]
}' \
-H 'X-Auth-Token: $AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'

Response

If the data is uploaded successfully, the API service returns a 200_OK response code.

If the data is partially uploaded with some errors, the API service returns a 207 response code, and the response body contains a json payload of all metrics that were rejected along with the reason for the failures.

For information about error codes, see the Send metrics operation in the API reference.