summaryrefslogtreecommitdiff
path: root/ceilometerclient/common
Commit message (Collapse)AuthorAgeFilesLines
* switch to oslo.utilsgordon chung2014-09-291-12/+11
| | | | | | | oslo.utils is released and corresponding code in oslo-incubator has been removed. Change-Id: Ic3a13380809a8b00c979e5ac405b4084f486a31d
* Verify alarm found before modifyingEric Pendergrass2014-08-291-1/+5
| | | | | | | | | | | | | | | | | | | Current behavior is to retrieve alarm by id and conduct operations on the object. If the tenant doesn't own the alarm or isn't admin, the user will receive the message: 'NoneType' object has no attribute 'to_dict' Above message doesn't provide any useful diagnostic information and indicates a programming error since an unexpected None-type is encountered and not handled. This change verifies the alarm is found before using the object. If alarm not found it prints the same message for a not found Alarm as other PUT operations like alarm-state-set: Alarm not found: <alarm_id>. This message is more useful for diagnosis and gets rid of the uncaught None-type error. Change-Id: I66abcd4498b24ac7cadcf29fe3ced3fcda08458c Closes-Bug: #1348387
* Use HTTPClient from common Oslo codeekudryashova2014-07-312-317/+4
| | | | | | | | | In the process of unification of the clients code we should reuse common functionality from Oslo. bp common-client-library-2 Change-Id: I0e027c33ee42b6de032d33269caeea33e7837f40
* Don't expose X-Auth-Token in ceilometer CLIZhi Kun Liu2014-07-181-1/+13
| | | | | | | | | | | Ceilometer CLI exposes X-Auth-Token in debug mode. This patch replaces X-Auth-Token's value with '{SHA1}<sha1oftoken>'. Some credentials are exposed by keystoneclient as ceilometerclient uses keystoneclient to authenticate, it will be fixed in bug: 100414. Change-Id: Ia6364314e4b4d26301f974582c0c2ba34b054c86 Partial-Bug: #1327019
* Fix hacking rules: H302,H305,H307,H402ZhiQiang Fan2014-06-112-5/+6
| | | | | | | | | | Currently, OpenStack Proposal Bot tries to update requirements with global requirements, while the upgraded hacking has introduced some new rules which are not fully handled by current code. This patch fixes some simple rules which are quite straight-forward. Change-Id: If8334f69fb1ad34fbbd6ad898e0e92eb3f81e95a
* Merge "fixed several pep8 issues"Jenkins2014-05-291-1/+1
|\
| * fixed several pep8 issuesChristian Berendt2014-05-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | * E122 continuation line missing indentation or outdented * E126 continuation line over-indented for hanging indent * E128 continuation line under-indented for visual indent * E265 block comment should start with '# ' Tested with pep8 version 1.5.6 (2014-04-14). Change-Id: Iaea72c74d3678061b0ac837eb8fe8c85a883bb4a
* | Fix exception handling of CLIliu-sheng2014-05-231-3/+3
|/ | | | | | | | | | | Because exc.Unauthorized exception has been removed for commit "Remove out-dated exceptions"(https://review.openstack.org/#/c/93852/). but it still in use in ceilometerclient.shell.CeilometerShell#main(). This patch replace exc.Unauthorized with exc.HTTPUnauthorized. And other three places of exc.NotFound are in use too. Change-Id: I3e010db20cb6f6636126cceed5c62a9817213739 Closes-bug: #1321649
* Adds alarm time constraint support to ceilometer CLIUros Jovanovic2014-03-261-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time constraints can be specified for create and update families of commands with the following format: --time-constraint name=constraint1;start='0 11 * * *';duration=300 This switch can be specified multiple times in the case of multiple time constraints. With update commands, time constraints are updated by name, e.g. --time-constraint name=constraint1;duration=500 updates the constraint 'constraint1' with a new duration 500. Time constraints can be removed with update commands using the switch --remove-time-constraint=constraint1,constraint2 . Example of display outputs: > ceilometer alarm-list +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ | Alarm ID | Name | State | Enabled | Continuous | Alarm condition | Time constraints | +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ | 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 | test2 | insufficient data | True | False | cpu == 50.0 during 1 x 60s | cons1 at 0 11 * * * for 300s, cons2 at 0 23 * * * for 600s | +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ > ceilometer alarm-show -a +---------------------------+-----------------------------------------------------------------------+ | Property | Value | +---------------------------+-----------------------------------------------------------------------+ | alarm_actions | [] | | alarm_id | 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 | | comparison_operator | eq | | description | Alarm when cpu is eq a avg of 50.0 over 60 seconds | | enabled | True | | evaluation_periods | 1 | | exclude_outliers | False | | insufficient_data_actions | [] | | meter_name | cpu | | name | test2 | | ok_actions | [] | | period | 60 | | project_id | 962f75ad22c24cbf99d40d7b82718505 | | query | | | repeat_actions | False | | state | insufficient data | | statistic | avg | | threshold | 50.0 | | time_constraints | [{name: cons1, | | | description: Time constraint at 0 11 * * * lasting for 300 seconds, | | | start: 0 11 * * *, | | | duration: 300}, | | | {name: cons2, | | | description: Time constraint at 0 23 * * * lasting for 600 seconds, | | | start: 0 23 * * *, | | | duration: 600}] | | type | threshold | | user_id | 76f335df8e2f4c7e9e8185e26ea85759 | +---------------------------+-----------------------------------------------------------------------+ > ceilometer alarm-history -a 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 +----------+----------------------------+--------------------------------------------------------------------------------+ | Type | Timestamp | Detail | +----------+----------------------------+--------------------------------------------------------------------------------+ | creation | 2014-03-06T07:41:35.362050 | name: test2 | | | | description: Alarm when cpu is eq a avg of 50.0 over 60 seconds | | | | type: threshold | | | | rule: cpu == 50.0 during 1 x 60s | | | | time_constraints: cons1 at 0 11 * * * for 300s, cons2 at 0 23 * * * for 600s | +----------+----------------------------+--------------------------------------------------------------------------------+ Change-Id: I3953276537b4526e46e5e6d229d6fa154f8ab0fc Closes-Bug: #1288246
* py3kcompat: remove in python-ceilometerclientJia Dong2014-02-211-4/+4
| | | | | | | | | Everything is already in six>=1.4.0 and we already depend on such a version. There's no reason to keep this file. So remove py3kcompat from python-ceilometerclient. Change-Id: Ide6876e7a60377cb3843816d1d9ab2c589bc8f1b Closes-Bug: #1280033
* Ensure url sent to proxy don't have redundant /Mehdi Abaakouk2014-02-131-1/+2
| | | | | | | | | | | When a proxy is set, the url requested to the proxy have a double // after the domain, but for ceilometer this kind of url is not valid. So, this patch ensures the url have only one / Closes-bug: #1274981 Change-Id: Id6fc5cf7ab7a3866bc23af7102785a9cede593fe
* Python 3: fix format_nested_list_of_dict()Cyril Roelandt2014-02-101-1/+1
| | | | | | | | In this function, we mean to add actual values, not a map object. In Python 2, map() did not return a map object, so this worked as expected, but not in Python3. Change-Id: Icc6467b7846d62c189765fdfd9dce1e30db7eb55
* Merge "Update client to display data type of traits"Jenkins2014-01-281-6/+8
|\
| * Update client to display data type of traitsJohn Herndon2014-01-241-6/+8
| | | | | | | | | | | | fixes bug 1268032 Change-Id: I47dfd3208fb3f7e5e5e2b33bd9b00c688d8283cd
* | Using common methods from oslo cliutilsJia Dong2014-01-241-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | There are some common methods in cliutils we can use in ceilometerclient: arg, env, unauthenticated, isunauthenticated. + Replaces utils.env to add alias env from cliutils. + Removes unused methods in utils: env To use methods from clituils. partially implements blueprint common-client-library-2 Change-Id: I295cc80635ed15c91e2832acb315e9deede09516
* | Using common method 'bool_from_string' from oslo strutilsllg82122014-01-221-4/+0
|/ | | | | | | | | Using common method 'bool_from_string' from oslo strutils to replace utils.string_to_bool. partially implements blueprint common-client-library-2 Change-Id: I101eb89174ac229aa1025bc4aea8b1c0c5594705
* Support the Event APIJohn Herndon2014-01-101-0/+15
| | | | | | | | | | | | This patch adds support for the currently available Event API, including events, event types, and traits. Add an optional data type to the query, ex: ceilometer list-events -q 'hostname=string::localhost" bp extend-client-operations Change-Id: Icea9bd67f8ee4ff2bf9da9ff6894218689580eb3
* Merge "Use Resource() class from common Oslo code"Jenkins2014-01-101-51/+2
|\
| * Use Resource() class from common Oslo codeekudryashova2014-01-081-51/+2
| | | | | | | | | | | | | | | | In the process of unification of the clients code we should reuse common functionality from Oslo. Resource() class from ceilometer duplicates Oslo funclionality, so we replace it with inheritance Change-Id: I4e4b83252cdc87e8484d15e351cd5dab08f3ed8a
* | Fix the ceilometerlient log curl request incorrectlyls11752013-12-201-1/+1
|/ | | | | | | | | | | | Have installed ceilometer on Ubuntu 12.04 (LTS) and added the keystone endpoint with the url (publicurl,internalurl and adminurl)like:http://192.168.83.7:8777/refer to the "OpenStack Installation Guide for Ubuntu 12.04 (LTS)". When using "ceilometer --debug meter-list",the ceilometerclient log request url with a double slash after 8777. Change-Id: I467704b1fe1d38fe0f0e928bd6f6efe3d8925845 Closes-bug: #1262498
* Python 3: use six.moves.zip() rather than itertools.izip()Cyril Roelandt2013-12-191-2/+1
| | | | | | This ensures compatibility with both Python 2 and Python 3. Change-Id: Id9838b7517f939e5ee3e3a8c37ae5ec2e9b1d18b
* Display message on HTTP 400Thomas Herve2013-12-161-1/+1
| | | | | | | | This patch parses the faultstring given by the server on 400 errors if available. Change-Id: Ieae2f0b39fed2c45f276d6c931bebfebab9f696e Closes-Bug: bug #1260394
* Merge "Add HTTP proxy support to ceilometer client"1.0.8Jenkins2013-12-021-3/+21
|\
| * Add HTTP proxy support to ceilometer clientIlya Tyaptin2013-11-281-3/+21
| | | | | | | | | | | | | | | | | | | | There is a need for HTTP Proxy support in Ceilometer client It's used in the case when Ceilometer API is not directly available Proxy url is taken from environment variables http_proxy or https_proxy Implements: blueprint proxy-support Change-Id: I839d704a7fa16521292205166d7cbea56497842b
* | Enable pep8 E711/E712/E721/H302 checkingLianhao Lu2013-11-221-4/+3
|/ | | | Change-Id: I229f1c15b46284fae94d4c786765baa18da0055f
* Ceilometer UnicodeEncodeError when update or show alarm fixChenZheng2013-10-301-0/+3
| | | | | | | | | | Fix display bug in ceilometer alarm-update ceilometer alarm-show when encounter a alarm with not unicode attributes. Change-Id: I0af0f1d6b8393c7117eb5b56fba3d5e1f4935ff1 Closes-bug: #1245317
* Fix order of sample listfujioka yuuichi2013-10-281-13/+15
| | | | | | | | | | | Samples of "ceilometer sample-list" are sorted by Resource ID and Volume. Expected order is Timestamp. This pache fixes this problem. Change-Id: I338014e5868b2176a3afd549e13d0dd6118b3ac1 Closes-Bug: #1227495
* Fix cacert argument to HTTPS connectionKieran Spear2013-10-241-1/+1
| | | | | | | | | | This fixes a typo that broke the client for HTTPS URLs. Added a basic test to cover this case. Coverage is very low in common/http.py. Change-Id: Ic440f20f463c3b8558a7639f1015096a01496cf8 Closes-bug: 1244091
* align the order of parameters for urlencode()Kui Shi2013-10-151-1/+1
| | | | | | | | | | | | | | | | | In Python 3.3, hash randomization is enabled by default. It causes the iteration order of dicts and sets to be unpredictable and differ across Python runs. In the test case, the fixed expecting string will not match the test result, it is relying on the dict order. This change transforms the input dict to a sequence of two-element list, with fixed order, and update the related expecitng string / fixture in test cases. Partial Implement: blueprint py33-support Change-Id: I6dccde9e584be8335a6375f5fbad5c5cbd7b9b6d
* replace basetring/xrangeKui Shi2013-10-141-1/+1
| | | | | | | | | basetring --> six.string_types xrange --> six.moves.xrange Partial Implement: blueprint py33-support Change-Id: Iedc2cd66ec65c0e4685e56a3bfbf8e9d38fd0072
* replace dict.keys() with list(dict)Kui Shi2013-10-141-1/+1
| | | | | | Partial Implement: blueprint py33-support Change-Id: I774e5a25d25ef19ffc217910987f2c9b68d13cd3
* Use six.iteritems() for dictKui Shi2013-10-142-3/+5
| | | | | | | | | Fix the error: AttributeError: 'dict' object has no attribute 'iteritems' Partial Implement: blueprint py33-support Change-Id: I5dff17d1df01d6583f882f818434804d65726c51
* Translate print statement to print functionKui Shi2013-10-141-3/+4
| | | | | | | | | Use "from __future__ import print_function" docs.python.org/3/howto/pyporting.html#from-future-import-print-function Partial Implement: blueprint py33-support Change-Id: I92fc07257851795a9972c8273d3278c8679d6628
* Fix module importing issues for Python 3Kui Shi2013-10-141-10/+6
| | | | | | | | | Copy py3kcompat from oslo for urlparse Substitute StringIO / httplib with six Partial Implement: blueprint py33-support Change-Id: Ic8da2ca53b4217ef13f15be094437f1f4e643001
* Merge "Added support to --os-cacert"Jenkins2013-10-031-8/+8
|\
| * Added support to --os-cacertStefano Zilli2013-10-011-8/+8
| | | | | | | | | | | | Closes-Bug: #1224343 Change-Id: Ib0549d4496c47900c81cc970b99bcff25cad0040
* | Allow to update an alarm partiallyMehdi Abaakouk2013-10-011-0/+9
|/ | | | | | | | | | | | | The patch allow to only modify a part of an alarm instead of force to set the full alarm description. This permit to an application that have been written code around alarm with ceilometerclient 1.0.4 and ceilometer pre havana-3. To update alarm without any change with this and ceilometer >= havana-3 (ie: heat). Fixes bug #1231303 Change-Id: I20250131d05d20bfadbca450dfe6b8237f4b7183
* Help messages: specify which options are requiredCyril Roelandt2013-09-251-0/+7
| | | | | | Closes-Bug: #1223283 Change-Id: I080fa73bd45a1f9f442dbcdfa65fdc24e30521da
* Improve the CM shell client alarm visualisationMehdi Abaakouk2013-09-251-2/+4
| | | | | | | | | | | | | | | | | | | This change aim to get a better alarm representation in shell. In alarm-list: * it add a short sentence to describe the alarm rule * it remove project_id/user_id because it always show the same id for all alarm for end-user In alarm-show, it show alarm rule attributes as alarm properties instead of a unparsable json in the rule property. example of short sentence for column 'Alarm condition': * combinated states (AND) of 8babd6a2-c457-42d0-9eb5-cdfb3cb50203, d0e11a94-8f59-48a9-8f6d-b0d68aaac8d0 * cpu_util >= 50.0 during 1 x 60s Change-Id: If4df2dc08f9f4cb7796fd98308c7d62e311d1138
* Merge "Replace OpenStack LLC with OpenStack Foundation"Jenkins2013-09-233-3/+3
|\
| * Replace OpenStack LLC with OpenStack FoundationZhiQiang Fan2013-09-203-3/+3
| | | | | | | | | | Change-Id: Ia007da282714d8ee7337fd3b51f6dcc3b64d7ec3 Fixes-Bug: #1214176
* | Use the new alarm formatMehdi Abaakouk2013-09-201-0/+11
|/ | | | | | | | | | | The change sync the client API with the new alarm type and keep compatibility with the previous format of the alarm. It allows to create the new type of alarm: combination alarm. Implements blueprint alarming-logical-combination Change-Id: Ie62265023cadc20cf36a0d0b3775f4d984e324cf
* Updated from global requirementsMonty Taylor2013-08-081-2/+4
| | | | Change-Id: Ibf423f14a5c37aa298b2115bfd4936f660c6f530
* Ensure keystoneclient.auth_token is re-evaluatedEoghan Glynn2013-08-021-2/+3
| | | | | | | | | | Fixes bug 1207441 Force the re-evaluation of the keystoneclient.auth_token property so as to avoid missing out on the in-built refresh logic when expiry is imminent. Change-Id: I8319e9e9a71e33e089fbe2fbc812d2b6c15da927
* Allow to set matching_metadata with the cli1.0.2Mehdi Abaakouk2013-07-221-0/+13
| | | | | | | | | | | This change allows to set the matching_metadata of a alarm like this: ceilometer alarm-create --matching-metadata 'key=value' \ --matching-metadata 'key2=value2' --name 'alarm' ... Fixes bug #1201877 Change-Id: I22bf261b0a9580a06ae107ed45d082171f21fcc4
* Make authenticated client easier to consume.Eoghan Glynn2013-06-211-1/+2
| | | | | | Encapsulate keystone logic in an convenience method. Change-Id: I0a048e02f57d657b8b414a76d759ceb9e0e025df
* Drop unnecessary arg when instantiating HTTP classBrian Waldon2013-06-131-1/+1
| | | | | | Fixes bug 1190111 Change-Id: I45e5e5d5af97a4f75833d9ca000b1b555bdda752
* Add client support for creating new alarms.Eoghan Glynn2013-05-281-3/+8
| | | | Change-Id: I4e3be2e480803eeaf4ec11079e69e7e6afd5e0d1
* Add client support for updating alarms.Eoghan Glynn2013-05-281-1/+1
| | | | Change-Id: I2a368f536ec440387d32a8076a86d143b94d7c90
* Fix pep H306 (import order)Angus Salkeld2013-05-201-2/+0
| | | | | | | | Also remove some unused imports This is an effort to get the pep ignores to be closer to nova. Change-Id: I35612de45084fac0ae1c96dad84bb23cfade0e4f