Query views#
This section describes the query view operations for Rackspace Metrics.
Get data for metrics#
GET /views/{metric_name}
Retrieves data for a single metric for a specific tenant.
For a list of supported query parameters that can be used to filter metrics data, see query parameters.
This table shows the possible response codes for this operation:
Response Code | Name | Description |
---|---|---|
200 | Success | This status code is returned when the metrics have been successfully retrieved for the tenant. |
401 | Unauthorized | The request header has an invalid authentication token. |
415 | Unsupported Media Type | The Accept request
header contains media
type that is
unsupported.
Supported media type:
application/json |
500 | Internal Server Error | The system encountered an unexpected condition. |
503 | Service unavailable | The system is experiencing heavy load or another system failure. |
Request#
This table shows the URI parameters for the request:
Name | Type | Description |
---|---|---|
{metric_name} | String (Required) | This parameter specifies the name of the metric to be retrieved. |
Example Get data for metrics: JSON request
curl -K "https://global.metrics.api.rackspacecloud.com/v2.0/tenantId/views/example.metric.one?from=1376509892611&to=1376509892613&points=200" \
-X GET
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Auth-Token: $AUTH_TOKEN"
Response#
Example Get data for metrics: JSON response
{
"unit": "unknown",
"values": [
{
"numPoints": 1,
"average": 66
"sum": 66,
"timestamp": 1376509892612,
}
],
"metadata": {
"limit": null,
"next_href": null,
"count": 1,
"marker": null
}
}
Note
The attribute sum
represents the sum of all data point values in the
given range. This attribute was released for numeric metrics on
July 5, 2016. All numeric metrics data submitted before that date will
have a sum
value of 0. All numeric metrics data submitted after that
date will have an accurate sum
value. A query which spans July 5, 2016
will have a sum
value which only represents data submitted after
July 5, 2016.
Query for a set of metrics#
GET /views/metrics/search
Retrieves a list of available metrics.
For a list of supported query parameters that can be used to filter metrics data, see query parameters.
This table shows the possible response codes for this operation:
Response Code | Name | Description |
---|---|---|
200 | Success | This status code is returned when the metric names have been successfully retrieved. |
401 | Unauthorized | The request header has an invalid authentication token. |
415 | Unsupported Media Type | The Accept request
header contains media
type that is
unsupported.
Supported media type:
application/json |
500 | Internal Server Error | The system encountered an unexpected condition. |
503 | Service unavailable | The system is experiencing heavy load or another system failure. |
Request#
Example Query for a set of metrics: JSON request
curl -k "https://global.metrics.api.rackspacecloud.com/v2.0/tenantId/metrics/search?query=rackspace.monitoring.entities.*.byte*" \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Auth-Token: $AUTH_TOKEN"
Response#
Example Query for a set of metrics: JSON response
[
{
"metric":"rackspace.monitoring.entities.enta1WzfiH.checks.agent.apache.chTwd4Ahi1.bytes_per_second",
"unit":"unknown"
},
{
"metric":"rackspace.monitoring.entities.enta1WzfiH.checks.agent.apache.chTwd4Ahi1.bytes_per_request",
"unit":"unknown"
},
{
"metric":"rackspace.monitoring.entities.enk7owuM6b.checks.remote.http.chR1MDzv0W.mzlon.bytes",
"unit":"bytes"
},
{
"metric":"rackspace.monitoring.entities.enk7owuM6b.checks.remote.http.chR1MDzv0W.mzord.bytes",
"unit":"bytes"
},
{
"metric":"rackspace.monitoring.entities.enk7owuM6b.checks.remote.http.chR1MDzv0W.mzdfw.bytes",
"unit":"bytes"
}
]
Retrieve an aggregated set of metrics#
GET /views
You can retrieve pre-aggregated counter metrics by submitting a GET
request against the
https://global.metrics.api.rackspacecloud.com/v2.0/tenantId/views/metrics_name
URI and adding a question mark (?) after the endpoint, as well as a
query syntax that includes the from= and to= parameters, which specify a
time span (using time stamps), as well as the points= parameter, which
specifies the number of points to list in the result. In addition, you
can add a select query parameter at the end of the URI, and then add a
quantifier, such as =sum, or =max to retrieve the desired amount
aggregated.
For a list of supported query parameters that can be used to filter metrics data, see Using query parameters.
The maximum number of metrics that can be retrieved is set to 100 by default.
This table shows the possible response codes for this operation:
Response Code | Name | Description |
---|---|---|
200 | Success | This status code is returned when the metric names have been successfully retrieved. |
401 | Unauthor ized | The request header has an invalid authentication token. |
415 | Unsupport ed Media | The Accept request header header contains media type that is unsupported. Supported media type: application/json |
500 | Internal Server Error | The system encountered an unexpected condition. |
503 | Service unavaila ble | The system is experiencing heavy load or another system failure. |
Request#
This table shows the URI parameters for the request:
Name | Type | Description |
---|---|---|
{project_id} | String | The project ID for the user. If you do not set the X-
Project-Id header in the request, use project_id in the
URI. For example: GET
https://global.cdn.api.rackspacecloud.com/v1.0/{project_id} |
This table shows the query parameters for the request:
Name | Type | Description |
---|---|---|
marker | String (Optional) | Specifies the
service_id that
represents the last
service listed. |
limit | Integer (Optional) | Specifies the number of
resources to list. The
maximum value that you
can specify for
limit is 20. |
This operation does not accept a request body.
Example Retrieve an aggregated set of metrics metrics using the select parameter: JSON request
curl -K "https://global.metrics.api.rackspacecloud.com/v2.0/5405533/views/metric_name?from=1433435826000&to=1433781426000&points=20&select=sum"
-X GET
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Auth-Token: $AUTH_TOKEN"
Response#
Example Retrieve an aggregated set of **counter metrics using the select parameter: JSON response**
HTTP/1.1 200 OK
Content-Length: 185
{
"unit": "unknown",
"values": [
{
"timestamp": 1433606400000,
"sum": 32
}
],
"metadata": {
"limit": null,
"next_href": null,
"count": 1,
"marker": null
}
}
Retrieve an annotation#
GET /events/
Retrieves an annotation.
You can retrieve annotation data by submitting a GET
request against the
https://global.metrics.api.rackspacecloud.com/v2.0/tenant-Id/events/getEvents
URI and adding a question mark (?) after the endpoint, as well as a query
syntax that includes the from=
and until=
parameters, which specify a
time span (using time stamps).
For a list of supported query parameters that can be used to filter metrics data, see query parameters.
This table shows the possible response codes for this operation:
Response Code | Name | Description |
---|---|---|
200 | Success | This status code is returned when the metric names have been successfully retrieved. |
401 | Unauthorized | The request header has an invalid authentication token. |
415 | Unsupported Media Type | The Accept request
header contains media
type that is
unsupported.
Supported media type:
application/json |
500 | Internal Server Error | The system encountered an unexpected condition. |
503 | Service unavailable | The system is experiencing heavy load or another system failure. |
Request#
Example Retrieve an annotation by using the from= and until= query parameters: JSON request
curl -i 'http://global.metrics.api.rackspacecloud.com/v2.0/737305/events/getEvents?from=1452105863000&until=1452105883000' \
-X GET
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-Auth-Token: $AUTH_TOKEN'
Response#
Example Retrieve an annotation by using the from= and until= query parameters: JSON response
HTTP/1.1 200 OK
Content-Length: 114
[
{
"tags":"deployment",
"tenantId":"737305",
"what":"app03 deployment",
"when":1452105873000,
"data":"deploying prod"
}
]
Get data for a list of metrics#
POST /views
You can retrieve data for a list of metrics by submitting a POST
request
against the
https://global.metrics.api.rackspacecloud.com/v2.0/tenantId/views
URI and
adding a question mark (?) after the endpoint, as well as a query syntax that
includes the from=
and to=
parameters, which specify a time span (using
time stamps), as well as the points=
parameter, which specifies the number
of points to list in the result.
The maximum number of metrics that can be retrieved is set to 100 by default.
This table shows the possible response codes for this operation:
Response Code | Name | Description |
---|---|---|
200 | Success | This status code is returned when the data for the specified list of metrics has been successfully retrieved. |
401 | Unauthorized | The request header has an invalid authentication token. |
415 | Unsupported Media Type | The Content-Type request
header contains media
type that is
unsupported.
Supported media type:
application/json |
500 | Internal Server Error | The system encountered an unexpected condition. |
503 | Service unavailable | The system is experiencing heavy load or another system failure. |
Request#
Example Get data for a list of metrics: JSON request
curl -s https://global.metrics.api.rackspacecloud.com/v2.0/tenantId/views?from=1413337468000&to=1413397348000&points=200 \
-X POST \
-d '
['rackspace.monitoring.entities.enk7owuM6b.checks.remote.ping.chEZPLuOxp.mzdfw.available','rackspace.monitoring.entities.enk7owuM6b.checks.remote.ping.chEZPLuOxp.mzdfw.average']
' \
-H 'X-Auth-Token: $AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
Response#
Example Get data for a list of metrics: JSON response
{
"metrics": [
{
"unit": "seconds",
"metric": "rackspace.monitoring.entities.enk7owuM6b.checks.remote.ping.chEZPLuOxp.mzdfw.average",
"data": [],
"type": "number"
},
{
"unit": "percent",
"metric": "rackspace.monitoring.entities.enk7owuM6b.checks.remote.ping.chEZPLuOxp.mzdfw.available",
"data": [],
"type": "number"
}
]
}