List Meters

Overview

  • Lists all meters.

  • Narrow down the result by specifying the following parameters in a query.

    • meter id
    • meter name
    • meter type
    • resource id
    • resource name
    • namespace
    • project id
  • This API performs the same function as "OpenStack Telemetry API: GET /v2/meters".

Classification

  • List

API Operation Object

  • meter

Synchronous / Asynchronous

  • Synchronous

Request

HTTP Request Method

  • GET

HTTP Request Path

{api_endpoint}/v2/meters

HTTP Request Header

Content-Type: application/json
Accept: application/json
X-Auth-Token: <token_id>

HTTP Request Body

  • none

Request Parameter

Input Parameters
name style format description required/optional default value action for invalid parameter response code for invalid parameter
q Query list queries of the meter retrieval condition (Key-Value) optional - Terminate 400
page Query integer target page number optional 1 Terminate 400
per_page Query integer number of meters contained in a page optional 100 Terminate 400
token_id Header authentication token string authentication token required - Terminate 401

A query key can be designated by describing after a dot(.) . (ex. q.field, q.op)

Valied query keys
key name format description required/optional default value
field string a meter column of retrieving target required -
op string a comparison operator optional eq
value string a field value for retrieving meters required -
type string format used to convert the value for comparison optional -

A query field can be designated by describing after "q.field=". (ex. q.field=meter_id)

Valied query fields
key name format description default value
meter_id string meter id -
name string meter name -
project_id string project(tenant) id -
resource_id string resource id -
resource_name string resource name -
type string meter type -
namespace string namespace of the services -

A query operator can be designated by describing after "q.op=". (ex. q.op=eq)

Valied operators in a query
operator description
eq equal to

A query type can be designated by describing after "q.type=". (ex. q.type=integer)

Valied types in a query
type ex. (q.value)
integer 1234
float 1234.1234
boolean 0 or 1
string abcd
datetime 2015-12-01T12:34:00+09:00

Response

Response Header

Format

HTTP/1.1 <response_code> <status>       (ex. 200 OK)
Per-Page: <per_page>
Link: <link>; rel="<rel>", <link>; rel="<rel>", <link>; rel="<rel>", <link>; rel="<rel>"
Total: <total>
Content-Type: application/json; charset=utf-8
  • <response_code>: see "Response Code" section
  • <status>: message based on the response code
  • <per_page>: number of meters contained in a page

The following are the information about pagination.

  • <link>: url of a specific page (ex. http://monitoring-jp1-ecl.api.ntt.com/v2/meters?page=3)

  • <rel>: property of the url
    • "next": url of the next page
    • "last": url of the last page
    • "prev": url of the previous page
    • "first": url of the first page
  • <total>: total number of corresponding meters

注釈

Not including auto-insert fields such as "Transfer-Encoding", "Date" and others.

Response Code

Response Codes
response code status condition message
200 ok normal end  
400 bad request specified non query field Field can't be blank.
    invalid query field Unrecognized field in query. valid keys:["project_id", "timestamp", "resource_id", "resource_name", "meter"]
    invalid query op Unimplemented operator 'xxxx' for specified field.
    specified non query value Value can't be blank.
    invalid meter type Invalid meter type. valid meter types: ['cumulative', 'delta', 'gauge']
    invalid query data type The data type 'xxxx' is not supported. The supported data type list is: ['integer', 'float', 'boolean', 'string', 'datetime']
    invalid value (1) Unable to convert the value 'xxxx' to the expected data type 'integer'.
    invalid value (2) Unexpected exception converting 'xxxx' to the expected data type "datetime".
401 unauthorized authentication failure The request you have made requires authentication.
    invalid project id Not authorized to access project.
500 internal server error internal server error The request processing has failed due to some unknown error, exception or failure

Response Body

Format

[
    {
        "meter_id": "<meter_id>",
        "name": "<name>",
        "display_name": "<display_name>",
        "project_id": "<project_id>",
        "resource_id": "<resource_id>",
        "namespace": "<namespace>",
        "source":"",
        "type": "<type>",
        "unit": "<unit>",
        "user_id": ""
    },
    <<repeat>>
]

Response Parameter

Response Parameters
item format   description
meter_id UUID   the unique meter id
name String   the meter name
display_name String   display name of the meter
project_id String   ID of the project which the resource is belonging to
resource_id String   the unique id of the metering resource
namespace String   namespace of the metering SDP
source -   source (non-use)
type String   MeterType
unit String   the unit of the meter
user_id -   user id (non-use)

Sample Request and Response

Sample API Request

Request URL

GET /v2/meters/?q.field=resource_id&q.op=eq&q.type=string&q.value=nova_bd9431c1-8d69-4ad3-803a-8d4a6b89fd36?page=2&per_page=100

Request Header

Content-Type: application/json
Accept: application/json
X-Auth-Token: 61389973e52b49c394ba3b89179b290b

Request Body

  • none

Sample API Response

Response Header

HTTP/1.1 200 OK

Response Body

[
    {
        "meter_id": "YmQ5NDMxYzEtOGQ2OS00YWQzLTgwM2EtOGQ0YTZiODlmZDM2K2luc3RhbmNl\n",
        "name": "nova.cpu.utilization.percents",
        "display_name": "CpuUtilization",
        "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68",
        "resource_id": "nova_bd9431c1-8d69-4ad3-803a-8d4a6b89fd36",
        "namespace": "nova",
        "source":"",
        "type": "gauge",
        "unit": "percent",
        "user_id": ""
    },
    {
        "meter_id": "hogeNDMxYzEtOGQ2OS00YWQzLTgwM2EtOGQ0YTZiODlmZDM2K2luc3RhbmNl\n",
        "name": "nova.disk.read.bytes",
        "display_name": "DiskReadBytes",
        "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68",
        "resource_id": "nova_bd9431c1-8d69-4ad3-803a-8d4a6b89fd36",
        "namespace": "nova",
        "source":"",
        "type": "delta",
        "unit": "byte",
        "user_id": ""
    }
]

Sample Error Response

HTTP Request

GET /v2/meters?q.field=resource_id&q.op=eq&q.type=string&q.value=
User-Agent: curl/7.19.7
Content-Type: application/json
Accept: application/json
X-Auth-Token: 61389973e52b49c394ba3b89179b290b

HTTP Response

HTTP/1.1 400 Bad Request
Date: Tue, 01 Dec 2015 06:45:10 GMT
Server: Apache
Cache-Control: no-cache
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Status: 400 Bad Request
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8

{"error":{"code":400,"message":"Value can't be blank.","title":"Bad Request"}}