Environment
Openstack version Ocata and pike
aodh 0.9.0
From CLI as well as from python api , alarm history shows the history as expected but if the same command is run twice it throws a type error as shown below :
########################
>>> acon = aclient.Client(session=sess,interface= 'internalURL')
>>> acon
<aodhclient.v2.client.Client object at 0x7f5bf0806f10>
>>> acon.alarm.list()
[{u'alarm_actions': [u'log://'], u'ok_actions': [], u'name': u'cpu_hi_30', u'timestamp': u'2017-12-09T17:35:57.624889', u'description': u'instance running hot', u'time_constraints': [], u'enabled': True, u'state_timestamp': u'2017-12-09T17:35:57.624889', u'state_reason': u'Not evaluated yet', u'gnocchi_resources_threshold_rule': {u'evaluation_periods': 3, u'metric': u'cpu_util', u'resource_id': u'7422e342-085d-4936-a0c5-2b54d02aa6b3', u'threshold': 50.0, u'granularity': 60, u'aggregation_method': u'mean', u'comparison_operator': u'gt', u'resource_type': u'instance'}, u'alarm_id': u'92f1ef38-e027-420d-b601-453397ae4afb', u'state': u'insufficient data', u'insufficient_data_actions': [], u'repeat_actions': False, u'user_id': u'4a3c972a86564a4784bf4f0ba77b4b49', u'project_id': u'373b270dc9a649d0b36671bdeec1e7e9', u'type': u'gnocchi_resources_threshold', u'severity': u'low'}, {u'alarm_actions': [u'log://'], u'ok_actions': [], u'name': u'cpu_hi', u'timestamp': u'2017-12-09T17:14:01.280756', u'description': u'instance running hot', u'time_constraints': [], u'enabled': True, u'state_timestamp': u'2017-12-09T17:14:01.280756', u'state_reason': u'3 datapoints are unknown', u'gnocchi_resources_threshold_rule': {u'evaluation_periods': 3, u'metric': u'cpu_util', u'resource_id': u'7422e342-085d-4936-a0c5-2b54d02aa6b3', u'threshold': 50.0, u'granularity': 300, u'aggregation_method': u'mean', u'comparison_operator': u'gt', u'resource_type': u'instance'}, u'alarm_id': u'0b9cb494-1ce7-41cb-9e54-3426a9a8fb64', u'state': u'insufficient data', u'insufficient_data_actions': [], u'repeat_actions': False, u'user_id': u'4a3c972a86564a4784bf4f0ba77b4b49', u'project_id': u'373b270dc9a649d0b36671bdeec1e7e9', u'type': u'gnocchi_resources_threshold', u'severity': u'low'}]
>>> acon.alarm_history.get('92f1ef38-e027-420d-b601-453397ae4afb')
[{u'on_behalf_of': u'373b270dc9a649d0b36671bdeec1e7e9', u'user_id': u'4a3c972a86564a4784bf4f0ba77b4b49', u'event_id': u'18ac3dfb-21d1-4e3a-aad6-e974ce9db75b', u'timestamp': u'2017-12-09T17:35:57.624889', u'detail': u'{"state_reason": "Not evaluated yet", "user_id": "4a3c972a86564a4784bf4f0ba77b4b49", "name": "cpu_hi_30", "state": "insufficient data", "timestamp": "2017-12-09T17:35:57.624889", "description": "instance running hot", "enabled": true, "state_timestamp": "2017-12-09T17:35:57.624889", "rule": {"evaluation_periods": 3, "metric": "cpu_util", "resource_id": "7422e342-085d-4936-a0c5-2b54d02aa6b3", "aggregation_method": "mean", "granularity": 60, "threshold": 50.0, "comparison_operator": "gt", "resource_type": "instance"}, "alarm_id": "92f1ef38-e027-420d-b601-453397ae4afb", "time_constraints": [], "insufficient_data_actions": [], "repeat_actions": false, "ok_actions": [], "project_id": "373b270dc9a649d0b36671bdeec1e7e9", "type": "gnocchi_resources_threshold", "alarm_actions": ["log://"], "severity": "low"}', u'alarm_id': u'92f1ef38-e027-420d-b601-453397ae4afb', u'project_id': u'373b270dc9a649d0b36671bdeec1e7e9', u'type': u'creation'}]
>>> acon.alarm_history.get('92f1ef38-e027-420d-b601-453397ae4afb')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/aodhclient/v2/alarm_history.py", line 38, in get
self.url = self.url % alarm_id
TypeError: not all arguments converted during string formatting
###############################################################################
Posting a patch that solved the problem for my environment .