Jump to: navigation, search

Difference between revisions of "Monasca/UI UX Support"

m (Alarm Sorting)
m (New Request Query Parameters)
Line 55: Line 55:
 
===New Request Query Parameters===
 
===New Request Query Parameters===
 
* sort_by (string) - A comma separated list of fields to sort by, defaults to 'alarm_id'
 
* sort_by (string) - A comma separated list of fields to sort by, defaults to 'alarm_id'
* sort_descending (boolean) - If true, returns results in descending order, defaults to false
 

Revision as of 21:58, 15 December 2015

Introduction

The following additions and modifications are a work in progress to support UI/UX related queries including alarm counts, advanced filtering, and sorted results.

Alarm Count Resource

This is the proposed specification for a resource that will provide a way to query how many alarms match the specified criteria. There are a few important things to note about the resource. First, the group_by field is limited to 'alarm_definition_id', 'name', 'state', 'severity', 'link', 'lifecycle_state', 'metric_name', 'dimension_name', 'dimension_value'. Secondly, if metric_name, dimension_name, or dimension_value are specified, the resulting counts are not guaranteed to add up to the total number of alarms in the system. Alarms may contain multiple different metrics (based on the alarm definition) and could be included in multiple counts when grouped by any of these three fields.

Alarm Count

  • GET /v2.0/alarms/count
    • alarm_definition_id (string, optional) - Alarm definition ID to filter by.
    • metric_name (string(255), optional) - Name of metric to filter by.
    • metric_dimensions ({string(255): string(255)}, optional) - Dimensions of metrics to filter by specified as a comma separated array of (key, value) pairs as key1:value1,key1:value1, ...
    • state (string, optional) - State of alarm to filter by, either OK, ALARM or UNDETERMINED.
    • lifecycle_state (string(50), optional) - Lifecycle state to filter by.
    • link (string(512), optional) - Link to filter by.
    • state_updated_start_time (string, optional) - The start time in ISO 8601 combined date and time format in UTC.
    • offset (string, optional)
    • limit (integer, optional)
    • group_by (string, optional) – a list of fields to group the results by as ```field1,field2,…```. See above for the permitted values.

Request Example

GET /v2.0/alarms/count?metric_name=cpu.system_perc&metric_dimensions=hostname:devstack&group_by=state,lifecycle_state

Response Body

Returns a JSON object containing the following fields:

  • links ([link]) - Links to alarms count resource
  • columns ([string]) - List of the column names, in the order they were returned
  • counts ([array[]]) - A two dimensional array of the counts returned

Response Example

Note in the example below that the category for 'OK', 'ACKNOWLEDGED' does not exist. This occurs when no alarms in the system match the category.

   {
       "links": [
           {
               "rel": "self",
               "href": "http://192.168.10.4:8080/v2.0/alarms?name=cpu.system_perc&dimensions=hostname%3Adevstack&group_by=state,lifecycle_state"
           }
       ],
       "columns": ["count", "state", "lifecycle_state"],
       "counts": [
           [124, "ALARM", "ACKNOWLEDGED"],
           [12, "ALARM", "RESOLVED"],
           [235, "OK", "OPEN"],
           [61, "OK", "RESOLVED"],
           [13, "UNDETERMINED", "ACKNOWLEDGED"],
           [1, "UNDETERMINED", "OPEN"],
           [2, "UNDETERMINED", "RESOLVED"],
       ]
   }


Alarm Sorting

Proposed specification for sorting alarms. If no values are selected, the default of alarm_id will be used. Alarms can be sorted by one or more of the following fields: 'alarm_id', 'alarm_definition_id', 'state', 'severity', 'lifecycle_state', 'link', 'state_updated_timestamp', 'updated_timestamp', 'created_timestamp'.

New Request Query Parameters

  • sort_by (string) - A comma separated list of fields to sort by, defaults to 'alarm_id'