Metrics

When Monitoring checks run, they generate metrics. These metrics are stored as full resolution data points in the Rackspace Monitoring system. Full resolution data points are periodically rolled up (condensed) into coarser data points.

Depending on your needs, you can use the metrics API to fetch individual data points (fine-grained) or rolled up data points (coarse-grained) over a period of time.

The following sections describe the different types of metrics and provide information about the metrics API operations you can use to review metrics data.

Cumulative and instantaneous metrics

Numeric metrics present numbers in one of the two ways, as cumulative values or instantaneous (snapshot) values.

TypeAlarmGraphDescription
Cumulative metricif (rate(metric[$metricname]) > $threshold) {return new AlarmStatus(CRITICAL, ‘rate is greater than $threshold’); }Draw the change rates of the values, the “derivative of order of one.”The value presents cumulative statistics from the time the metric was created. The value keeps growing.

Example: agent.network - rx-bytes
Instantaneous metricif (metric[$metricname]) > $threshold) { return new AlarmStatus(CRITCAL, ‘value is greater than $threshold’); }Typically draw the value directly.The value presents the state at the time the metric is collected. The value can change in any direction.

Example: agent.filesystem - used

Data granularity

Rackspace Monitoring supports several granularities of data: full resolution data and rollups computed at 5, 20, 60, 240 and 1440 minute intervals.

When you fetch metrics data points, you specify several parameters to control the granularity of data returned:

  • A time range for the points
  • Either the number of points you want returned or the resolution of the data you want returned

When you query by points, the API selects the resolution that will return you the number of points you requested. The API makes the assumption of a 30 second frequency, performs the calculation, and selects the appropriate resolution.

Note

Because the API performs calculations to determine the points returned for a particular resolution, the number of points returned may differ from the specific number of points you request.

You specify resolutionAPI returns points
FULL5760
MIN5576
MIN20144
MIN6048
MIN24012
MIN14402

Alternately, the next table shows the resolution the API calculates depending upon the number of points you request:

You specify points in the rangeAPI calculates resolution
3168-infiniteFULL
360-3167MIN5
96-359MIN20
30-95MIN60
7-29MIN240
0-6MIN1440

Data point expiration

Rackspace Monitoring expires data points according to the following schedule:

ResolutionExpiration
FULL2 days
MIN510 days
MIN2020 days
MIN60155 days
MIN240300 days
MIN14405 years

Metrics API operations

Use the following metrics API operations to create, view, and manage metrics resources.

List metrics by check ID

GET /entities/{entityId}/checks/{checkId}/metrics

Lists the metrics associated with the specified checkId.

This operation can be paginated. For information, see Paginated collections

This operation does not require a request body.

This operation returns a response body that lists the metrics associated with your check. A single check usually generates several metrics. For example, http checks generate the following metrics: bytes, code, duration, truncated, tt_connect, tt_firstbyte.

Metrics generated by remote checks are generated for each monitoring zone where the check is issued.

Metric names use the syntax:

monitoringZone.``metricName``

where:

monitoringZone

is the monitoring zone where the check was issued.

metricName

is the name of the metric.

For example a metric called tt_connect, generated from the dfw monitoring zone, is labeled as mzdfw.tt_connect.

Note

Metrics generated by agent checks have no monitoring zone.

The following table shows the possible response codes for this operation:

Response CodeNameDescription
200OKThe request completed.
400Bad requestThe system received an invalid value in a request.
401UnauthorizedThe system received a request from a user that is not authenticated.
403ForbiddenThe system received a request that the user is not authorized to make.
405Method Not AllowedThe method specified in the request is not supported for the resource. A list of valid methods for the requested resource is included in the response.
413Over LimitThe response body is too large.
500Internal Server ErrorAn unexpected condition was encountered.
503Service UnavailableThe system is experiencing heavy load or another system failure.

Request

The following table shows the header parameters for the request:

NameTypeDescription
X-Auth-TokenString (Required)A valid authentication token with administrative access. For details, see Get your credentials

Note

This operation does not accept a request body.

Response

Example List metrics by check ID: JSON response

{
"values": [
{
"name": "mzdfw.available",
"unit": "percent",
"type": "D"
},
{
"name": "mzdfw.average",
"unit": "seconds",
"type": "D"
}
],
"metadata": {
"count": 2,
"limit": null,
"marker": null,
"next_marker": null,
"next_href": null
}
}

Get data points by metric name

GET /entities/{entityId}/checks/{checkId}/metrics/{metricName}/plot

Queries for all data points of metricName between two points in time.

metricName refers to the fully concatenated metric described in Metrics API operations.

This operation does not require a request body.

This operation returns a response body that lists all data points between two points in time for metricName. To control the data points returned in the response body, specify the required request URI parameters described in the following table.

Note

Rackspace Monitoring is currently limited to 1440 data points returned per request. If all your data is not returned, break your request into multiple requests across smaller time ranges.

The following table shows the possible response codes for this operation:

Response CodeNameDescription
200OKThe request completed.
400Bad requestThe system received an invalid value in a request.
401UnauthorizedThe system received a request from a user that is not authenticated.
403ForbiddenThe system received a request that the user is not authorized to make.
405Method Not AllowedThe method specified in the request is not enabled for the resource. A list of valid methods for the requested resource is included in the response.
413Over LimitThe response body is too large.
500Internal Server ErrorAn unexpected condition was encountered.
503Service UnavailableThe system is experiencing heavy load or another system failure.

Request

The following table shows the header parameters for the request:

NameTypeDescription
X-Auth-TokenString (Required)A valid authentication token with administrative access. For details, see Get your credentials

The following table shows the URI parameters for the request:

NameTypeDescription
{fromTimeStamp}String (Required)from={fromTimeStamp} The timestamp marking the beginning of the time range. The timestamp should be represented as the number of milliseconds that have elapsed since January 1, 1970. Note that “Unix time” is typically represented in seconds, so in many cases it will be necessary to convert this to milliseconds.
{toTimeStamp}String (Required)to={toTimeStamp} The timestamp marking the end of the time range. The timestamp should be represented as the number of milliseconds that have elapsed since January 1, 1970. Note that “Unix time” is typically represented in seconds, so in many cases it will be necessary to convert this to milliseconds.
{numberPoints}String (Required)points={numberPoints} The number of points you want in the results. Either points or resolution is required. If both are absent, the query will not validate and will return an error. For more information about querying by points, see Data granularity.
{granularity}String (Required)resolution={granularity} The granularity of data to query. Valid values include: FULL, MIN5, MIN20, MIN60, MIN240 or MIN1440. Either points or resolution is required. If both are absent, the query will not validate and will return an error. For more information about querying by resolution, see Data granularity.
{stats}String (Required)select={stats} The stats that you want returned for the data. The stats available for selection are average, variance, min and max. By default, the response includes the average stat only. You can use multiple select parameters in a single request. For example, select=variance & select=max displays both variance and max in the response.

Note

This operation does not accept a request body.

Response

Example Fetch data points, full resolution: JSON response

{
"values": [
{
"numPoints": 1,
"average": 4,
"timestamp": 1335744000000
},
{
"numPoints": 1,
"average": 6,
"timestamp": 1335744000030
}
],
"metadata": {
"count": 2,
"limit": null,
"marker": null,
"next_marker": null,
"next_href": null
}
}

Example Fetch data points, rollup: JSON response

{
"values": [
{
"numPoints": 1141,
"average": 4.1,
"timestamp": 1335744000000
},
{
"numPoints": 2880,
"average": 6.05,
"timestamp": 1335830400000
}
],
"metadata": {
"count": 2,
"limit": null,
"marker": null,
"next_marker": null,
"next_href": null
}
}