docs.openstack.org Telemetry API Reference December 16, 2014 OpenStack Telemetry API v2 Reference Copyright © 2010-2014 OpenStack Foundation All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ii Telemetry API Reference December 16, 2014 Table of Contents 1. Telemetry API v2 (CURRENT) ....................................................................................... 1 1.1. Alarms .............................................................................................................. 1 1.1.1. List alarms ............................................................................................. 2 1.1.2. Create alarm .......................................................................................... 4 1.1.3. Show alarm ........................................................................................... 6 1.1.4. Update alarm ........................................................................................ 8 1.1.5. Delete alarm ........................................................................................ 10 1.1.6. Update alarm state .............................................................................. 11 1.1.7. Show alarm state ................................................................................. 12 1.1.8. Show alarm history .............................................................................. 13 1.2. Meters ............................................................................................................ 13 1.2.1. List meters ........................................................................................... 14 1.2.2. Show meter ......................................................................................... 15 1.2.3. Create meter ....................................................................................... 17 1.2.4. Show meter statistics ........................................................................... 19 1.3. Resources ....................................................................................................... 20 1.3.1. List resources ....................................................................................... 21 1.3.2. Show resource information .................................................................. 23 iii Telemetry API Reference December 16, 2014 1. Telemetry API v2 (CURRENT) Manage telemetry operations. 1.1. Alarms List, create, gets details for, update, and delete alarms. Method URI Description GET /v2/alarms{?q} Lists alarms, based on the specified query. POST /v2/alarms{?data} Creates an alarm. GET /v2/alarms/{alarm_id} Shows information for a specified alarm. PUT /v2/alarms/{alarm_id}{?data} Updates a specified alarm. DELETE /v2/alarms/{alarm_id} Deletes a specified alarm. PUT /v2/alarms/{alarm_id}/state{? state} Sets the state of a specified alarm. GET /v2/alarms/{alarm_id}/state Gets the state of a specified alarm. GET /v2/alarms/{alarm_id}/history{?q} Assembles the history for a specified alarm. 1 Telemetry API Reference December 16, 2014 1.1.1. List alarms Method GET URI Description Lists alarms, based on the specified query. /v2/alarms{?q} Normal response codes: 200 1.1.1.1. Request This table shows the query parameters for the list alarms request: Name Type List q Description Filter rules for the alarms to be returned. (Optional) This operation does not accept a request body. 1.1.1.2. Response Example 1.1. List alarms: JSON response [ { "alarm_actions": [ "http://site:8000/alarm" ], "alarm_id": null, "combination_rule": null, "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, "state": "ok", "state_timestamp": "2013-11-21T12:33:08.486228", "threshold_rule": null, "timestamp": "2013-11-21T12:33:08.486221", "type": "threshold", "user_id": "c96c887c216949acbdfbd8b494863567" } ] Example 1.2. List alarms: XML response <?xml version="1.0" encoding="UTF-8"?> <values> <value> <alarm_actions> 2 Telemetry API Reference December 16, 2014 <item>http://site:8000/alarm</item> </alarm_actions> <alarm_id nil="true" /> <combination_rule nil="true" /> <description>An alarm</description> <enabled>true</enabled> <insufficient_data_actions> <item>http://site:8000/nodata</item> </insufficient_data_actions> <name>SwiftObjectAlarm</name> <ok_actions> <item>http://site:8000/ok</item> </ok_actions> <project_id>c96c887c216949acbdfbd8b494863567</project_id> <repeat_actions>false</repeat_actions> <state>ok</state> <state_timestamp>2013-11-21T12:33:08.486228</state_timestamp> <threshold_rule nil="true" /> <timestamp>2013-11-21T12:33:08.486221</timestamp> <type>threshold</type> <user_id>c96c887c216949acbdfbd8b494863567</user_id> </value> </values> This operation does not return a response body. 3 Telemetry API Reference December 16, 2014 1.1.2. Create alarm Method POST URI Description Creates an alarm. /v2/alarms{?data} Normal response codes: 200 1.1.2.1. Request This table shows the query parameters for the create alarm request: Name data Type Alarm Description a alarm within the request body. (Optional) This operation does not accept a request body. 1.1.2.2. Response Example 1.3. Create alarm: JSON response { "alarm_actions": [ "http://site:8000/alarm" ], "alarm_id": null, "combination_rule": null, "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, "state": "ok", "state_timestamp": "2013-11-21T12:33:08.486228", "threshold_rule": null, "timestamp": "2013-11-21T12:33:08.486221", "type": "threshold", "user_id": "c96c887c216949acbdfbd8b494863567" } Example 1.4. Create alarm: XML response <?xml version="1.0" encoding="UTF-8"?> <value> <alarm_actions> <item>http://site:8000/alarm</item> </alarm_actions> <alarm_id nil="true" /> 4 Telemetry API Reference December 16, 2014 <combination_rule nil="true" /> <description>An alarm</description> <enabled>true</enabled> <insufficient_data_actions> <item>http://site:8000/nodata</item> </insufficient_data_actions> <name>SwiftObjectAlarm</name> <ok_actions> <item>http://site:8000/ok</item> </ok_actions> <project_id>c96c887c216949acbdfbd8b494863567</project_id> <repeat_actions>false</repeat_actions> <state>ok</state> <state_timestamp>2013-11-21T12:33:08.486228</state_timestamp> <threshold_rule nil="true" /> <timestamp>2013-11-21T12:33:08.486221</timestamp> <type>threshold</type> <user_id>c96c887c216949acbdfbd8b494863567</user_id> </value> This operation does not return a response body. 5 Telemetry API Reference December 16, 2014 1.1.3. Show alarm Method GET URI Description Shows information for a specified alarm. /v2/alarms/{alarm_id} Normal response codes: 200 1.1.3.1. Request This operation does not accept a request body. 1.1.3.2. Response Example 1.5. Show alarm: JSON response { "alarm_actions": [ "http://site:8000/alarm" ], "alarm_id": null, "combination_rule": null, "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, "state": "ok", "state_timestamp": "2013-11-21T12:33:08.486228", "threshold_rule": null, "timestamp": "2013-11-21T12:33:08.486221", "type": "threshold", "user_id": "c96c887c216949acbdfbd8b494863567" } Example 1.6. Show alarm: XML response <?xml version="1.0" encoding="UTF-8"?> <value> <alarm_actions> <item>http://site:8000/alarm</item> </alarm_actions> <alarm_id nil="true" /> <combination_rule nil="true" /> <description>An alarm</description> <enabled>true</enabled> <insufficient_data_actions> <item>http://site:8000/nodata</item> </insufficient_data_actions> <name>SwiftObjectAlarm</name> <ok_actions> 6 Telemetry API Reference December 16, 2014 <item>http://site:8000/ok</item> </ok_actions> <project_id>c96c887c216949acbdfbd8b494863567</project_id> <repeat_actions>false</repeat_actions> <state>ok</state> <state_timestamp>2013-11-21T12:33:08.486228</state_timestamp> <threshold_rule nil="true" /> <timestamp>2013-11-21T12:33:08.486221</timestamp> <type>threshold</type> <user_id>c96c887c216949acbdfbd8b494863567</user_id> </value> This operation does not return a response body. 7 Telemetry API Reference December 16, 2014 1.1.4. Update alarm Method PUT URI Description Updates a specified alarm. /v2/alarms/{alarm_id}{?data} Normal response codes: 200 1.1.4.1. Request This table shows the query parameters for the update alarm request: Name data Type Alarm Description a alarm within the request body. (Optional) This operation does not accept a request body. 1.1.4.2. Response Example 1.7. Update alarm: JSON response { "alarm_actions": [ "http://site:8000/alarm" ], "alarm_id": null, "combination_rule": null, "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, "state": "ok", "state_timestamp": "2013-11-21T12:33:08.486228", "threshold_rule": null, "timestamp": "2013-11-21T12:33:08.486221", "type": "threshold", "user_id": "c96c887c216949acbdfbd8b494863567" } Example 1.8. Update alarm: XML response <?xml version="1.0" encoding="UTF-8"?> <value> <alarm_actions> <item>http://site:8000/alarm</item> </alarm_actions> <alarm_id nil="true" /> 8 Telemetry API Reference December 16, 2014 <combination_rule nil="true" /> <description>An alarm</description> <enabled>true</enabled> <insufficient_data_actions> <item>http://site:8000/nodata</item> </insufficient_data_actions> <name>SwiftObjectAlarm</name> <ok_actions> <item>http://site:8000/ok</item> </ok_actions> <project_id>c96c887c216949acbdfbd8b494863567</project_id> <repeat_actions>false</repeat_actions> <state>ok</state> <state_timestamp>2013-11-21T12:33:08.486228</state_timestamp> <threshold_rule nil="true" /> <timestamp>2013-11-21T12:33:08.486221</timestamp> <type>threshold</type> <user_id>c96c887c216949acbdfbd8b494863567</user_id> </value> This operation does not return a response body. 9 Telemetry API Reference December 16, 2014 1.1.5. Delete alarm Method DELETE URI Description Deletes a specified alarm. /v2/alarms/{alarm_id} Normal response codes: 204 1.1.5.1. Request This operation does not accept a request body. 10 Telemetry API Reference December 16, 2014 1.1.6. Update alarm state Method PUT URI Description /v2/alarms/{alarm_id}/state{? state} Sets the state of a specified alarm. Normal response codes: 200 1.1.6.1. Request This table shows the query parameters for the update alarm state request: Name state Type Dict (Optional) Description An alarm state within the request body. Valid values are ok, alarm, or insufficient data. This operation does not accept a request body. 11 Telemetry API Reference December 16, 2014 1.1.7. Show alarm state Method GET URI Description Gets the state of a specified alarm. /v2/alarms/{alarm_id}/state Normal response codes: 200 12 Telemetry API Reference December 16, 2014 1.1.8. Show alarm history Method GET URI Description /v2/alarms/{alarm_id}/history{?q} Assembles the history for a specified alarm. Normal response codes: 200 1.1.8.1. Request This table shows the query parameters for the show alarm history request: Name Type List q Description Filter rules for the changes to be described. (Optional) This operation does not accept a request body. 1.2. Meters Get information for meters. Method URI Description GET /v2/meters{?q} Lists meters, based on the data recorded so far. GET /v2/meters/{meter_name}{?q,limit} Gets samples for a specified meter. POST /v2/meters/{meter_name}{?samples} Posts list of samples to Telemetry. GET /v2/meters/{meter_name}/statistics Computes the statistics of the samples in a specified time {?q,groupby,period} range. 13 Telemetry API Reference December 16, 2014 1.2.1. List meters Method GET URI Description Lists meters, based on the data recorded so far. /v2/meters{?q} Normal response codes: 200 1.2.1.1. Request This table shows the query parameters for the list meters request: Name Type List q Description Filter rules for the meters to be returned. (Optional) This operation does not accept a request body. 1.2.1.2. Response Example 1.9. List meters: JSON response [ { "meter_id": "YmQ5NDMxYzEtOGQ2OS00YWQzLTgwM2EtOGQ0YTZiODlmZDM2K2luc3RhbmNl\n", "name": "instance", "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68", "resource_id": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "source": "openstack", "type": "gauge", "unit": "instance", "user_id": "efd87807-12d2-4b38-9c70-5f5c2ac427ff" } ] Example 1.10. List meters: XML response <?xml version="1.0" encoding="UTF-8"?> <values> <value> <meter_id>YmQ5NDMxYzEtOGQ2OS00YWQzLTgwM2EtOGQ0YTZiODlmZDM2K2luc3RhbmNl </meter_id> <name>instance</name> <project_id>35b17138-b364-4e6a-a131-8f3099c5be68</project_id> <resource_id>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</resource_id> <source>openstack</source> <type>gauge</type> <unit>instance</unit> <user_id>efd87807-12d2-4b38-9c70-5f5c2ac427ff</user_id> </value> </values> This operation does not return a response body. 14 Telemetry API Reference December 16, 2014 1.2.2. Show meter Method GET URI Description /v2/meters/{meter_name}{?q,limit} Gets samples for a specified meter. Normal response codes: 200 1.2.2.1. Request This table shows the query parameters for the show meter request: Name Type List q Description Filter rules for the data to be returned. (Optional) Int limit Maximum number of samples to return. (Optional) This operation does not accept a request body. 1.2.2.2. Response Example 1.11. Show meter: JSON response [ { "counter_name": "instance", "counter_type": "gauge", "counter_unit": "instance", "counter_volume": 1.0, "message_id": "5460acce-4fd6-480d-ab18-9735ec7b1996", "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68", "resource_id": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "resource_metadata": { "name1": "value1", "name2": "value2" }, "source": "openstack", "timestamp": "2013-11-21T12:33:08.323533", "user_id": "efd87807-12d2-4b38-9c70-5f5c2ac427ff" } ] Example 1.12. Show meter: XML response <?xml version="1.0" encoding="UTF-8"?> <values> <value> <counter_name>instance</counter_name> <counter_type>gauge</counter_type> <counter_unit>instance</counter_unit> <counter_volume>1.0</counter_volume> <message_id>5460acce-4fd6-480d-ab18-9735ec7b1996</message_id> <project_id>35b17138-b364-4e6a-a131-8f3099c5be68</project_id> 15 Telemetry API Reference December 16, 2014 <resource_id>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</resource_id> <resource_metadata> <item> <key>name2</key> <value>value2</value> </item> <item> <key>name1</key> <value>value1</value> </item> </resource_metadata> <source>openstack</source> <timestamp>2013-11-21T12:33:08.323533</timestamp> <user_id>efd87807-12d2-4b38-9c70-5f5c2ac427ff</user_id> </value> </values> This operation does not return a response body. 16 Telemetry API Reference December 16, 2014 1.2.3. Create meter Method POST URI Description /v2/meters/{meter_name}{?samples} Posts list of samples to Telemetry. Normal response codes: 200 1.2.3.1. Request This table shows the query parameters for the create meter request: Name Type List samples Description A list of samples within the request body. (Optional) This operation does not accept a request body. 1.2.3.2. Response Example 1.13. Create meter: JSON response [ { "counter_name": "instance", "counter_type": "gauge", "counter_unit": "instance", "counter_volume": 1.0, "message_id": "5460acce-4fd6-480d-ab18-9735ec7b1996", "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68", "resource_id": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "resource_metadata": { "name1": "value1", "name2": "value2" }, "source": "openstack", "timestamp": "2013-11-21T12:33:08.323533", "user_id": "efd87807-12d2-4b38-9c70-5f5c2ac427ff" } ] Example 1.14. Create meter: XML response <?xml version="1.0" encoding="UTF-8"?> <values> <value> <counter_name>instance</counter_name> <counter_type>gauge</counter_type> <counter_unit>instance</counter_unit> <counter_volume>1.0</counter_volume> <message_id>5460acce-4fd6-480d-ab18-9735ec7b1996</message_id> <project_id>35b17138-b364-4e6a-a131-8f3099c5be68</project_id> <resource_id>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</resource_id> <resource_metadata> <item> 17 Telemetry API Reference December 16, 2014 <key>name2</key> <value>value2</value> </item> <item> <key>name1</key> <value>value1</value> </item> </resource_metadata> <source>openstack</source> <timestamp>2013-11-21T12:33:08.323533</timestamp> <user_id>efd87807-12d2-4b38-9c70-5f5c2ac427ff</user_id> </value> </values> This operation does not return a response body. 18 Telemetry API Reference December 16, 2014 1.2.4. Show meter statistics Method GET URI Description /v2/meters/{meter_name}/statistics Computes the statistics of the samples in a specified time {?q,groupby,period} range. Normal response codes: 200 1.2.4.1. Request This table shows the query parameters for the show meter statistics request: Name Type List q Description Filter rules for the data to be returned. (Optional) List groupby Fields for group by aggregation (Optional) Int period (Optional) Returned result will be an array of statistics for a period long of that number of seconds. This operation does not accept a request body. 1.2.4.2. Response Example 1.15. Show meter statistics: JSON response [ { "avg": 4.5, "count": 10, "duration": 300.0, "duration_end": "2013-01-04T16:47:00", "duration_start": "2013-01-04T16:42:00", "max": 9.0, "min": 1.0, "period": 7200, "period_end": "2013-01-04T18:00:00", "period_start": "2013-01-04T16:00:00", "sum": 45.0, "unit": "GiB" } ] Example 1.16. Show meter statistics: XML response <?xml version="1.0" encoding="UTF-8"?> <values> <value> <avg>4.5</avg> <count>10</count> <duration>300.0</duration> <duration_end>2013-01-04T16:47:00</duration_end> 19 Telemetry API Reference December 16, 2014 <duration_start>2013-01-04T16:42:00</duration_start> <max>9.0</max> <min>1.0</min> <period>7200</period> <period_end>2013-01-04T18:00:00</period_end> <period_start>2013-01-04T16:00:00</period_start> <sum>45.0</sum> <unit>GiB</unit> </value> </values> This operation does not return a response body. 1.3. Resources Get information for resources. Method URI Description GET /v2/resources{?q} Lists definitions for all resources. GET /v2/resources/{resource_id}{? resource_id} Gets details for a specified resource. 20 Telemetry API Reference December 16, 2014 1.3.1. List resources Method GET URI Description Lists definitions for all resources. /v2/resources{?q} Normal response codes: 200 1.3.1.1. Request This table shows the query parameters for the list resources request: Name Type List q Description Filter rules for the resources to be returned. (Optional) This operation does not accept a request body. 1.3.1.2. Response Example 1.17. List resources: JSON response [ { "links": [ { "href": "http://localhost:8777/v2/resources/ bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "rel": "self" }, { "href": "http://localhost:8777/v2/meters/volume?q.field= resource_id&q.value=bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "rel": "volume" } ], "metadata": { "name1": "value1", "name2": "value2" }, "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68", "resource_id": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "source": "openstack", "timestamp": "2013-11-21T12:33:08.189843", "user_id": "efd87807-12d2-4b38-9c70-5f5c2ac427ff" } ] Example 1.18. List resources: XML response <?xml version="1.0" encoding="UTF-8"?> <values> <value> <links> <item> 21 Telemetry API Reference December 16, 2014 <href>http://localhost:8777/v2/resources/ bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</href> <rel>self</rel> </item> <item> <href>http://localhost:8777/v2/meters/volume?q.field=resource_id& amp;q.value=bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</href> <rel>volume</rel> </item> </links> <metadata> <item> <key>name2</key> <value>value2</value> </item> <item> <key>name1</key> <value>value1</value> </item> </metadata> <project_id>35b17138-b364-4e6a-a131-8f3099c5be68</project_id> <resource_id>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</resource_id> <source>openstack</source> <timestamp>2013-11-21T12:33:08.189843</timestamp> <user_id>efd87807-12d2-4b38-9c70-5f5c2ac427ff</user_id> </value> </values> This operation does not return a response body. 22 Telemetry API Reference December 16, 2014 1.3.2. Show resource information Method GET URI Description /v2/resources/{resource_id}{? resource_id} Gets details for a specified resource. Normal response codes: 200 1.3.2.1. Request This table shows the query parameters for the show resource information request: Name resource_id Type String Description The UUID of the resource. (Optional) This operation does not accept a request body. 1.3.2.2. Response Example 1.19. Show resource information: JSON response { "links": [ { "href": "http://localhost:8777/v2/resources/ bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "rel": "self" }, { "href": "http://localhost:8777/v2/meters/volume?q.field= resource_id&q.value=bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "rel": "volume" } ], "metadata": { "name1": "value1", "name2": "value2" }, "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68", "resource_id": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36", "source": "openstack", "timestamp": "2013-11-21T12:33:08.189843", "user_id": "efd87807-12d2-4b38-9c70-5f5c2ac427ff" } Example 1.20. Show resource information: XML response <?xml version="1.0" encoding="UTF-8"?> <value> <links> <item> <href>http://localhost:8777/v2/resources/ bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</href> 23 Telemetry API Reference December 16, 2014 <rel>self</rel> </item> <item> <href>http://localhost:8777/v2/meters/volume?q.field=resource_id&q. value=bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</href> <rel>volume</rel> </item> </links> <metadata> <item> <key>name2</key> <value>value2</value> </item> <item> <key>name1</key> <value>value1</value> </item> </metadata> <project_id>35b17138-b364-4e6a-a131-8f3099c5be68</project_id> <resource_id>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</resource_id> <source>openstack</source> <timestamp>2013-11-21T12:33:08.189843</timestamp> <user_id>efd87807-12d2-4b38-9c70-5f5c2ac427ff</user_id> </value> This operation does not return a response body. 24
© Copyright 2024