Show Alarm History

Overview

  • shows the history for an alarm, by alarm ID.
  • This API performs the same function as "OpenStack Telemetry API: GET /v2/alarms/{alarm_id}/history".

Classification

  • Show

API Operation Object

  • Alarm

Synchronous / Asynchronous

  • Synchronous

Request

HTTP Request Method

  • GET

HTTP Request Path

{api_endpoint}/v2/alarms/{alarm_id}/history

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
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
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>"
    },
    <<repeat>>
]

Response Parameter

item format description
alarm List(AlarmChange) alarm history listed by the request

Sample Request and Response

Sample API Request

Request URL

GET /v2/alarms/2d3ce366-b842-43a4-af12-18d705ce0f62/history

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": "2d3ce366-b842-43a4-af12-18d705ce0f62",
    "event_id": "",
    "on_behalf_of": "8bd27d40cca549aaaeed0ad719c77a3f",
    "project_id": "8bd27d40cca549aaaeed0ad719c77a3f",
    "user_id": "",
    "type": "state transition",
    "detail": "{\"state\": \"ok\"}",
    "timestamp": "2015-11-09T05:06:35+00:00"
}, {
    "alarm_id": "2d3ce366-b842-43a4-af12-18d705ce0f62",
    "event_id": "",
    "on_behalf_of": "8bd27d40cca549aaaeed0ad719c77a3f",
    "project_id": "8bd27d40cca549aaaeed0ad719c77a3f",
    "user_id": "",
    "type": "state transition",
    "detail": "{\"state\": \"alarm\"}",
    "timestamp": "2015-11-09T04:17:23+00:00"
}, {
    "alarm_id": "2d3ce366-b842-43a4-af12-18d705ce0f62",
    "event_id": "",
    "on_behalf_of": "8bd27d40cca549aaaeed0ad719c77a3f",
    "project_id": "8bd27d40cca549aaaeed0ad719c77a3f",
    "user_id": "46c6b2ab04b5408da8f5eca60c40387e",
    "type": "creation",
    "detail": "{\"alarm_id\":\"2d3ce366-b842-43a4-af12-18d705ce0f62\",\"user_id\":\"46c6b2ab04b5408da8f5eca60c40387e\",\"name\":\"alarm-test-member2-1\",\"description\":\"alarm-test-description\",\"enabled\":true,\"repeat_actions\":false,\"severity\":\"moderate\",\"type\":\"threshold\",\"timestamp\":\"2015-11-09T04:05:12+00:00\",\"project_id\":\"8bd27d40cca549aaaeed0ad719c77a3f\",\"time_constraints\":[],\"threshold_rule\":{\"meter_name\":\"nova.hv.status.bool\",\"period\":10,\"exclude_outliers\":false,\"evaluation_periods\":1,\"evaluation_type\":\"0\",\"comparison_operator\":\"eq\",\"statistic\":\"max\",\"threshold\":1.0,\"query\":[{\"field\":\"resource_id\",\"op\":\"eq\",\"type\":\"string\",\"value\":\"nova_imamuratest-lab1-member2-1\"}]},\"alarm_actions\":[],\"ok_actions\":[],\"insufficient_data_actions\":[],\"state\":\"insufficient data\",\"state_timestamp\":\"\"}",
    "timestamp": "2015-11-09T04:05:12+00:00"
}]

Sample Error Response

HTTP Request

GET /v2/alarms/2d3ce366-b842-43a4-af12-18d705ce0f62/history?q.field=timestamp&q.value=2015%2d11%2d09T04%3a17%3a23%2b00%3a00&q.op=eq
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: Mon, 09 Nov 2015 07:18:09 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 'eq' for timestamp. valid operators: [\"ge\", \"le\"]","title":"Bad Request"}}