List samples for meter (GET /v2/meters/{meter_name})

Lists samples for the specified meter.

{meter_name}: Name of the meter from which to retrieve samples.

Request headers

Refer to "Common API items".

Request parameters

q.field

Specifies the following fields for query.

  • resource_id: ID of the resource.
  • source: Source meter.
  • timestamp: Datetime of the sample.
    • If timestamp is omitted, the following will be used: "current time - 1 day <= timestamp < current time".
    • If only the start time is specified, the following will be used for end datetime: "start datetime + 1 day > timestamp".
    • If only the end time is specified, the following will be used for start datetime: "end datetime - 1 day <= timestamp".
  • user_id: ID of the user that created the meter.

If omitted, all samples will be targeted.

Data type Cardinality
String 0..10

q.op

Specifies the comparison operator described below.

  • If q.field is "resource_id":

    eq: Equal to

  • If q.field is "source":

    eq: Equal to

  • If q.field is "timestamp":

    gt: Greater than

    ge: Greater than or equal to

    lt: Less than

    le: Less than or equal to

If omitted, "eq" is used.

Data type Cardinality
String 0..10

q.value

Specifies the following data value targeted for comparison.

  • If q.field is "resource_id":

    Resource ID

  • If q.field is "source":

    Source

  • If q.field is "timestamp":

    Datetime (YYYY-MM-DDThh:mm:ss)

Valid characters: Fullwidth characters, halfwidth alphanumeric characters and halfwidth symbols

Number of characters: 1 to 255

Data type Cardinality
String 0..10

limit

Maximum number of samples to retrieve.

Range: 1 to 1440

If omitted, "1440" is used.

Data type Cardinality
Int 0..1

offset

Number of sample to offset.

If omitted, "0" is used.

Data type Cardinality
Int 0..1

Response headers

Status

If normal, the following status is returned.

200: Normal completion

Refer to "Common API error codes" if the state is error.

Data type Cardinality
Int 1..1

Response elements

List (in JSON format) of the samples based on the specified query.

Refer to "type OldSample" for details.

Example of request

Example 1: List samples within the specified time range.


curl -H 'X-Auth-Token: ImFkbWluVVJMIjogImh0dHA6Ly8xMC4x . . .' \
'https://telemetry.jp-east-1.cloud.global.fujitsu.com/v2/meters/my_meter?
q.field=timestamp&q.op=gt&q.value=2014-10-22T00:00:00&q.field=timestamp&
q.op=lt&q.value=2014-10-23T00:00:00'
     

Example 2: List samples concerning the specified resource.


curl -H 'X-Auth-Token: ImFkbWluVVJMIjogImh0dHA6Ly8xMC4x . . .' \
'https://telemetry.jp-east-1.cloud.global.fujitsu.com/v2/meters/my_meter?q.field=resource_id&q.op=eq&q.value=my_resource'
     

Example of response


[
    {
        "counter_name": "my_meter",
        "counter_type": "gauge",
        "counter_unit": "%",
        "counter_volume": 0.0,
        "project_id": "bc835c72f50b48c89ad7ee8a89806bb1",
        "recorded_at": "2014-10-22T00:02:50.171418",
        "resource_id": "my_resource",
        "resource_metadata": {
            "my_metadata": "test",
        },
        "source": "bc835c72f50b48c89ad7ee8a89806bb1:my_source",
        "timestamp": "2014-10-22T00:02:49",
        "user_id": "22fa5e38788d40988b8aa28e749f7a84"
    },
    {
        "counter_name": "my_meter",
        "counter_type": "gauge",
        "counter_unit": "%",
        "counter_volume": 10.0,
        "project_id": "bc835c72f50b48c89ad7ee8a89806bb1",
        "recorded_at": "2014-10-22T00:01:12.511325",
        "resource_id": "my_resource",
        "resource_metadata": {
            "my_metadata": "test",
        },
        "source": "bc835c72f50b48c89ad7ee8a89806bb1:my_source",
        "timestamp": "2014-10-22T00:01:12",
        "user_id": "22fa5e38788d40988b8aa28e749f7a84"
    },
]