List Overall Alarm Histories

Overview

  • List the histories of all alarms in reverse chronological order

  • "OpenStack Telemetry API" doesn't provide the equivalent of the "List Overall Alarm Histories" API

Classification

  • List

API Operation Object

  • Alarm

Synchronous / Asynchronous

  • Synchronous

Request

HTTP Request Method

  • GET

HTTP Request Path

{api_endpoint}/v2/alarm_histories

HTTP Request Header

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

HTTP Request Body

  • none

Request Parameter

name

style

format

description

required/optional

default value

action for invalid parameter

response code for invalid parameter

q

Query

string

Filter rules for listing alarms

optional

-

Terminate

400

page

Query

Integer

A page number when alarms are paginated

optional

100

Terminate

400

per_page

Query

Integer

A page number when alarms are paginated

optional

100

Terminate

400

token_id

Header

authentication token string

authentication token

required

-

Terminate

401

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

Valied query fields

key name

format

description

required/optional

default value

valied operator

project_id

string

the uuid of a tenant

optional

-

eq

project

string

an alias of 'project_id'

optional

-

eq

alarm_name

string

the alarm name (exact match)

optional

-

eq

alarm_name

string

the alarm name (partial match)

optional

-

pm

user_id

string

the uuid of a user

optional

-

eq

user

string

an alias of 'user_id'

optional

-

eq

type

string

the type of an alarm history

optional

-

eq

timestamp

datetime

start time of the retrieving range

optional

-

ge

timestamp

datetime

end time of the retrieving range

optional

-

le

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

pm

partial match (available only "alarm_name" field)

le

less than or equal to

ge

greater than or 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)
  • <response_code>: see "Response Code" section

  • <status>: message based on the response code

注釈

skip auto-insert fields such as "Content-Length" and "Date"

Response Code

Response Codes :header-rows: 1

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', 'type', 'timestamp','user_id']

invalid query op

Unimplemented operator 'xxxx' for specified field.

specified non query value

Value can't be blank.

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'.

invalid timestamp value

Please designate end_timestamp newer than start_timestamp.

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

[
    {
        "alarm_id": "<alarm_id>",
        "event_id": "",
        "on_behalf_of": "<tenant_id>",
        "project_id": "<tenant_id>",
        "user_id": "<user_id>",
        "type": "<type>",
        "detail": "<detail>",
        "timestamp": "<timestamp>"
        "alarm_name": "<alarm_name>"
    },
    <<repeat>>
]

Response Parameter

item

format

description

alarm

List(AlarmChange)

overall alarm history listed in reverse chronological order

Sample Request and Response

Sample API Request

Request URL

GET /v2/alarm_histories

Request Header

Content-Type: application/json
Accept: application/json
X-Auth-Token: e8c788fbaeb14964ae19759eb1df4ff1

Request Body

  • none

Sample API Response

Response Header

HTTP/1.1 200 OK

Response Body

[
    {
        "alarm_id": "d1ae7fb6-452a-456d-8baa-61752c92c909",
        "detail": "{\"alarm_actions\": [\"http://target.com/\"], \"user_id\": \"77fc13282468432d8905b42fcc01d61a\", \"name\": \"sample\", \"state\": \"ok\", \"timestamp\": \"2015-07-16T07:01:21+00:00\", \"enabled\": true, \"state_timestamp\": \"2015-07-16T07:02:07+00:00\", \"threshold_rule\": {\"meter_name\": \"instance\", \"evaluation_periods\": 1, \"evaluation_type\": 0, \"period\": 300, \"statistic\": \"sum\", \"threshold\": 3.0, \"query\": [{\"field\": \"resource_id\", \"oq\": \"eq\", \"type\": \"string\", \"value\": \"bd9431c1-8d69-4ad3-803a-8d4a6b89fd36\"}], \"comparison_operator\": \"eq\", \"exclude_outliers\": false}, \"alarm_id\": \"d1ae7fb6-452a-456d-8baa-61752c92c909\", \"time_constraints\": [], \"insufficient_data_actions\": [], \"repeat_actions\": true, \"ok_actions\": [\"http://target.com/\"], \"project_id\": \"35b17138-b364-4e6a-a131-8f3099c5be68\", \"type\": \"threshold\", \"description\": \"test description\", \"severity\": "low", \"resource_name\": \"resource_test\", \"deleted\": true}",
        "event_id": "",
        "on_behalf_of": "35b17138-b364-4e6a-a131-8f3099c5be68",
        "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68",
        "timestamp": "2015-07-16T07:04:41+00:00",
        "type": "deletion",
        "user_id": "77fc13282468432d8905b42fcc01d61a",
        "alarm_name": "sample"
    },
    {
        "alarm_id": "d1ae7fb6-452a-456d-8baa-61752c92c909",
        "detail": "{\"state\": \"alarm\"}",
        "event_id": "",
        "on_behalf_of": "35b17138-b364-4e6a-a131-8f3099c5be68",
        "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68",
        "timestamp": "2015-07-16T07:02:07+00:00",
        "type": "state transition",
        "user_id": "",
        "alarm_name": "sample"
    },
    {
        "alarm_id": "d1ae7fb6-452a-456d-8baa-61752c92c909",
        "detail": "{\"alarm_actions\": [\"http://target.com/\"], \"user_id\": \"77fc13282468432d8905b42fcc01d61a\", \"name\": \"sample\", \"state\": \"ok\", \"timestamp\": \"2015-07-16T07:01:21+00:00\", \"enabled\": true, \"state_timestamp\": \"2015-07-16T07:01:21+00:00\", \"threshold_rule\": {\"meter_name\": \"instance\", \"evaluation_periods\": 1, \"evaluation_type\": 0, \"period\": 300, \"statistic\": \"sum\", \"threshold\": 3.0, \"query\": [{\"field\": \"resource_id\", \"oq\": \"eq\", \"type\": \"string\", \"value\": \"bd9431c1-8d69-4ad3-803a-8d4a6b89fd36\"}], \"comparison_operator\": \"eq\", \"exclude_outliers\": false}, \"alarm_id\": \"d1ae7fb6-452a-456d-8baa-61752c92c909\", \"time_constraints\": [], \"insufficient_data_actions\": [], \"repeat_actions\": true, \"ok_actions\": [\"http://target.com/\"], \"project_id\": \"35b17138-b364-4e6a-a131-8f3099c5be68\", \"type\": \"threshold\", \"description\": \"test description\", \"severity\": "low", \"resource_name\": \"resource_test\", \"deleted\": false}",
        "event_id": "",
        "on_behalf_of": "35b17138-b364-4e6a-a131-8f3099c5be68",
        "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68",
        "timestamp": "2015-07-16T07:01:21+00:00",
        "type": "creation",
        "user_id": "77fc13282468432d8905b42fcc01d61a",
        "alarm_name": "sample"
    }
]

Sample Error Response

HTTP Request

GET /v2/alarm_histories?q.field=type&q.op=pm&q.type=string&q.value=cre
User-Agent: curl/7.35.0
Content-Type: application/json
Accept: application/json
X-Auth-Token: 61389973e52b49c394ba3b89179b290b

HTTP Response

HTTP/1.1 400 Bad Request
Date: Wed, 20 Jul 2016 07:58:54 GMT
Server: Apache
Cache-Control: no-cache
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
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":"Unimplemented operator 'pm' for specified field.","title":"Bad Request"}}