The Capabilities API allows you to directly discover which functions from the V2 API functionality, including the selectable aggregate functions, are supported by the currently configured storage driver. A capabilities query returns a flattened dictionary of properties with associated boolean values - a ‘False’ or absent value means that the corresponding feature is not available in the backend.
Returns a flattened dictionary of API capabilities.
Capabilities supported by the currently configured storage driver.
Return type: | Capabilities |
---|
A representation of the API and storage capabilities.
Usually constrained by restrictions imposed by the storage driver.
Data samples:
{
"alarm_storage": {
"storage:production_ready": true
},
"api": {
"alarms:history:query:complex": true,
"alarms:history:query:simple": true,
"alarms:query:complex": true,
"alarms:query:simple": true
}
}
<value>
<api>
<item>
<key>alarms:history:query:complex</key>
<value>true</value>
</item>
<item>
<key>alarms:query:complex</key>
<value>true</value>
</item>
<item>
<key>alarms:query:simple</key>
<value>true</value>
</item>
<item>
<key>alarms:history:query:simple</key>
<value>true</value>
</item>
</api>
<alarm_storage>
<item>
<key>storage:production_ready</key>
<value>true</value>
</item>
</alarm_storage>
</value>
Type: | dict(unicode: bool) |
---|
A flattened dictionary of alarm storage capabilities
Type: | dict(unicode: bool) |
---|
A flattened dictionary of API capabilities
Return all alarms, based on the query provided.
Parameters: |
|
---|---|
Return type: | list(Alarm) |
Create a new alarm.
Parameters: |
|
---|---|
Return type: |
Modify this alarm.
Parameters: |
|
---|---|
Return type: |
Delete this alarm.
Assembles the alarm history requested.
Parameters: |
|
---|---|
Return type: | list(AlarmChange) |
Set the state of this alarm.
Parameters: |
|
---|---|
Return type: | Enum(ok, alarm, insufficient data) |
Get the state of this alarm.
Return type: | Enum(ok, alarm, insufficient data) |
---|
Representation of an alarm.
Note
combination_rule and threshold_rule are mutually exclusive. The type of the alarm should be set to threshold or combination and the appropriate rule should be filled.
Data samples:
{
"alarm_actions": [
"http://site:8000/alarm"
],
"alarm_id": null,
"combination_rule": {
"alarm_ids": [
"739e99cb-c2ec-4718-b900-332502355f38",
"153462d0-a9b8-4b5b-8175-9e4b05e9b856"
],
"operator": "or"
},
"description": "An alarm",
"enabled": true,
"insufficient_data_actions": [
"http://site:8000/nodata"
],
"name": "SwiftObjectAlarm",
"ok_actions": [
"http://site:8000/ok"
],
"project_id": "c96c887c216949acbdfbd8b494863567",
"repeat_actions": false,
"severity": "moderate",
"state": "ok",
"state_timestamp": "2017-01-05T20:45:42.850243",
"time_constraints": [
{
"description": "nightly build every night at 23h for 3 hours",
"duration": 10800,
"name": "SampleConstraint",
"start": "0 23 * * *",
"timezone": "Europe/Ljubljana"
}
],
"timestamp": "2017-01-05T20:45:42.850240",
"type": "combination",
"user_id": "c96c887c216949acbdfbd8b494863567"
}
<value>
<alarm_id nil="true" />
<name>SwiftObjectAlarm</name>
<description>An alarm</description>
<enabled>true</enabled>
<ok_actions>
<item>http://site:8000/ok</item>
</ok_actions>
<alarm_actions>
<item>http://site:8000/alarm</item>
</alarm_actions>
<insufficient_data_actions>
<item>http://site:8000/nodata</item>
</insufficient_data_actions>
<repeat_actions>false</repeat_actions>
<type>combination</type>
<time_constraints>
<item>
<name>SampleConstraint</name>
<description>nightly build every night at 23h for 3 hours</description>
<start>0 23 * * *</start>
<duration>10800</duration>
<timezone>Europe/Ljubljana</timezone>
</item>
</time_constraints>
<project_id>c96c887c216949acbdfbd8b494863567</project_id>
<user_id>c96c887c216949acbdfbd8b494863567</user_id>
<timestamp>2017-01-05T20:45:42.850240</timestamp>
<state>ok</state>
<state_timestamp>2017-01-05T20:45:42.850243</state_timestamp>
<severity>moderate</severity>
<combination_rule>
<operator>or</operator>
<alarm_ids>
<item>739e99cb-c2ec-4718-b900-332502355f38</item>
<item>153462d0-a9b8-4b5b-8175-9e4b05e9b856</item>
</alarm_ids>
</combination_rule>
</value>
Type: | list(unicode) |
---|
The actions to do when alarm state change to alarm
Type: | unicode |
---|
The UUID of the alarm
Type: | unicode |
---|
The description of the alarm
Type: | bool |
---|
This alarm is enabled?
Type: | list(unicode) |
---|
The actions to do when alarm state change to insufficient data
Type: | unicode |
---|
The name for the alarm
Type: | list(unicode) |
---|
The actions to do when alarm state change to ok
Type: | unicode |
---|
The ID of the project or tenant that owns the alarm
Type: | bool |
---|
The actions should be re-triggered on each evaluation cycle
Type: | Enum(low, moderate, critical) |
---|
The severity of the alarm
Type: | Enum(ok, alarm, insufficient data) |
---|
The state offset the alarm
Type: | datetime |
---|
The date of the last alarm state changed
Type: | list(AlarmTimeConstraint) |
---|
Describe time constraints for the alarm
Type: | datetime |
---|
The date of the last alarm definition update
Type: | Enum(gnocchi_aggregation_by_metrics_threshold, combination, composite, gnocchi_resources_threshold, gnocchi_aggregation_by_resources_threshold, threshold, event) |
---|
Explicit type specifier to select which rule to follow below.
Type: | unicode |
---|
The ID of the user who created the alarm
Alarm Threshold Rule
Describe when to trigger the alarm based on computed statistics
Data samples:
{
"comparison_operator": "gt",
"evaluation_periods": 1,
"exclude_outliers": false,
"meter_name": "cpu_util",
"period": 60,
"query": [
{
"field": "resource_id",
"op": "eq",
"type": "string",
"value": "2a4d689b-f0b8-49c1-9eef-87cae58d80db"
}
],
"statistic": "avg",
"threshold": 300.0
}
<value>
<meter_name>cpu_util</meter_name>
<query>
<item>
<field>resource_id</field>
<op>eq</op>
<value>2a4d689b-f0b8-49c1-9eef-87cae58d80db</value>
<type>string</type>
</item>
</query>
<period>60</period>
<comparison_operator>gt</comparison_operator>
<threshold>300.0</threshold>
<statistic>avg</statistic>
<evaluation_periods>1</evaluation_periods>
<exclude_outliers>false</exclude_outliers>
</value>
Type: | Enum(lt, le, eq, ne, ge, gt) |
---|
The comparison against the alarm threshold
Type: | integer |
---|
The number of historical periods to evaluate the threshold
Type: | bool |
---|
Whether datapoints with anomalously low sample counts are excluded
Type: | unicode |
---|
The name of the meter
Type: | integer |
---|
The time range in seconds over which query
Type: | list(Query) |
---|
The query to find the data for computing statistics. Ownership settings are automatically included based on the Alarm owner.
Type: | Enum(max, min, avg, sum, count) |
---|
The statistic to compare to the threshold
Type: | float |
---|
The threshold of the alarm
Alarm Combination Rule
Describe when to trigger the alarm based on combining the state of other alarms.
Data samples:
{
"alarm_ids": [
"739e99cb-c2ec-4718-b900-332502355f38",
"153462d0-a9b8-4b5b-8175-9e4b05e9b856"
],
"operator": "or"
}
<value>
<operator>or</operator>
<alarm_ids>
<item>739e99cb-c2ec-4718-b900-332502355f38</item>
<item>153462d0-a9b8-4b5b-8175-9e4b05e9b856</item>
</alarm_ids>
</value>
Type: | list(unicode) |
---|
List of alarm identifiers to combine
Type: | Enum(or, and) |
---|
How to combine the sub-alarms
Data samples:
{
"comparison_operator": "eq",
"evaluation_periods": 1,
"granularity": 60
}
<value>
<comparison_operator>eq</comparison_operator>
<evaluation_periods>1</evaluation_periods>
<granularity>60</granularity>
</value>
Type: | unicode |
---|
The name of the metric
Type: | unicode |
---|
The id of a resource
Type: | unicode |
---|
The resource type
Data samples:
{
"comparison_operator": "eq",
"evaluation_periods": 1,
"granularity": 60
}
<value>
<comparison_operator>eq</comparison_operator>
<evaluation_periods>1</evaluation_periods>
<granularity>60</granularity>
</value>
Type: | unicode |
---|
The name of the metric
Type: | unicode |
---|
The resource type
Data samples:
{
"comparison_operator": "eq",
"evaluation_periods": 1,
"granularity": 60
}
<value>
<comparison_operator>eq</comparison_operator>
<evaluation_periods>1</evaluation_periods>
<granularity>60</granularity>
</value>
Type: | list(unicode) |
---|
A list of metric Ids
Representation of a time constraint on an alarm.
Data samples:
{
"description": "nightly build every night at 23h for 3 hours",
"duration": 10800,
"name": "SampleConstraint",
"start": "0 23 * * *",
"timezone": "Europe/Ljubljana"
}
<value>
<name>SampleConstraint</name>
<description>nightly build every night at 23h for 3 hours</description>
<start>0 23 * * *</start>
<duration>10800</duration>
<timezone>Europe/Ljubljana</timezone>
</value>
Type: | unicode |
---|
The description of the constraint
Type: | integer |
---|
How long the constraint should last, in seconds
Type: | unicode |
---|
The name of the constraint
Type: | cron |
---|
Start point of the time constraint, in cron format
Type: | unicode |
---|
Timezone of the constraint
Representation of an event in an alarm’s history.
Data samples:
{
"alarm_id": "e8ff32f772a44a478182c3fe1f7cad6a",
"detail": "{\"threshold\": 42.0, \"evaluation_periods\": 4}",
"on_behalf_of": "92159030020611e3b26dde429e99ee8c",
"project_id": "b6f16144010811e387e4de429e99ee8c",
"timestamp": "2017-01-05T20:45:43.040929",
"type": "rule change",
"user_id": "3e5d11fda79448ac99ccefb20be187ca"
}
<value>
<alarm_id>e8ff32f772a44a478182c3fe1f7cad6a</alarm_id>
<type>rule change</type>
<detail>{"threshold": 42.0, "evaluation_periods": 4}</detail>
<project_id>b6f16144010811e387e4de429e99ee8c</project_id>
<user_id>3e5d11fda79448ac99ccefb20be187ca</user_id>
<on_behalf_of>92159030020611e3b26dde429e99ee8c</on_behalf_of>
<timestamp>2017-01-05T20:45:43.040929</timestamp>
</value>
Type: | unicode |
---|
The UUID of the alarm
Type: | unicode |
---|
JSON fragment describing change
Type: | unicode |
---|
The UUID of the change event
Type: | unicode |
---|
The tenant on behalf of which the change is being made
Type: | unicode |
---|
The project ID of the initiating identity
Type: | datetime |
---|
The time/date of the alarm change
Type: | Enum(creation, rule change, state transition, deletion) |
---|
The type of change
Type: | unicode |
---|
The user ID of the initiating identity
The filter expressions of the query feature operate on the fields of Alarm and AlarmChange. The following comparison operators are supported: =, !=, <, <=, >, >= and in; and the following logical operators can be used: and or and not. The field names are validated against the database models.
Note
The not operator has different meaning in Mongo DB and in SQL DB engine. If the not operator is applied on a non existent metadata field then the result depends on the DB engine. For example if {“not”: {“metadata.nonexistent_field” : “some value”}} filter is used in a query the Mongo DB will return every Sample object as not operator evaluated true for every Sample where the given field does not exists. See more in the Mongod DB doc. On the other hand SQL based DB engine will return empty result as the join operation on the metadata table will return zero rows as the on clause of the join which tries to match on the metadata field name is never fulfilled.
Complex Query supports defining the list of orderby expressions in the form of [{“field_name”: “asc”}, {“field_name2”: “desc”}, ...].
The number of the returned items can be bounded using the limit option.
The filter, orderby and limit are all optional fields in a query.
Define query for retrieving Alarm data.
Parameters: |
|
---|---|
Return type: | list(Alarm) |
Define query for retrieving AlarmChange data.
Parameters: |
|
---|---|
Return type: | list(AlarmChange) |
Holds a sample query encoded in json.
Data samples:
{
"filter": "{\"and\": [{\"and\": [{\"=\": {\"counter_name\": \"cpu_util\"}}, {\">\": {\"counter_volume\": 0.23}}, {\"<\": {\"counter_volume\": 0.26}}]}, {\"or\": [{\"and\": [{\">\": {\"timestamp\": \"2013-12-01T18:00:00\"}}, {\"<\": {\"timestamp\": \"2013-12-01T18:15:00\"}}]}, {\"and\": [{\">\": {\"timestamp\": \"2013-12-01T18:30:00\"}}, {\"<\": {\"timestamp\": \"2013-12-01T18:45:00\"}}]}]}]}",
"limit": 42,
"orderby": "[{\"counter_volume\": \"ASC\"}, {\"timestamp\": \"DESC\"}]"
}
<value>
<filter>{"and": [{"and": [{"=": {"counter_name": "cpu_util"}}, {">": {"counter_volume": 0.23}}, {"<": {"counter_volume": 0.26}}]}, {"or": [{"and": [{">": {"timestamp": "2013-12-01T18:00:00"}}, {"<": {"timestamp": "2013-12-01T18:15:00"}}]}, {"and": [{">": {"timestamp": "2013-12-01T18:30:00"}}, {"<": {"timestamp": "2013-12-01T18:45:00"}}]}]}]}</filter>
<orderby>[{"counter_volume": "ASC"}, {"timestamp": "DESC"}]</orderby>
<limit>42</limit>
</value>
Type: | unicode |
---|
The filter expression encoded in json.
Type: | int |
---|
The maximum number of results to be returned.
Type: | unicode |
---|
List of single-element dicts for specifing the ordering of the results.
The composite type alarm allows users to specify a composite rule to define an alarm with multiple triggering conditions, using a combination of and and or relations. A composite rule is composed of multiple threshold rules or gnocchi rules. A sample composite alarm request form is as follows:
{
"name": "test_composite",
"type": "composite",
"composite_rule": {
"and": [THRESHOLD_RULE1, THRESHOLD_RULE2, {
'or': [THRESHOLD_RULE3, GNOCCHI_RULE1,
GNOCCHI_RULE2, GNOCCHI_RULE3]
}]
}
}
A sub-rule in composite_rule is same as a threshold_rule in threshold alarm or a gnocchi_rule in gnocchi alarm. Additionally it has a mandatory type field to specify the rule type, like in the following sample:
{
"threshold": 0.8,
"meter_name": "cpu_util",
"type": "threshold"
}