Skip to content

Instantly share code, notes, and snippets.

@pkilambi
Last active September 2, 2016 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkilambi/22b52e3c210ad1ff80cc89e167b7b499 to your computer and use it in GitHub Desktop.
Save pkilambi/22b52e3c210ad1ff80cc89e167b7b499 to your computer and use it in GitHub Desktop.
Testing gnocchi alarms with aodh in tripleo deployment
* Make sure you have these patches before starting:
- keepalived issue with redis: https://review.openstack.org/#/c/364917/ , https://review.openstack.org/#/c/364916/
- gnocchi keystone user_domain_name: https://review.openstack.org/#/c/365092/
- aodh auth url: https://review.openstack.org/#/c/365117/
* Deploy overcloud as usual
* source overcloudrc
* Create a metric in gnocchi
[stack@undercloud ~]$ gnocchi metric create -a high
+------------------------------------+-------------------------------------------------------------------+
| Field | Value |
+------------------------------------+-------------------------------------------------------------------+
| archive_policy/aggregation_methods | std, count, 95pct, min, max, sum, median, mean |
| archive_policy/back_window | 0 |
| archive_policy/definition | - points: 3600, granularity: 0:00:01, timespan: 1:00:00 |
| | - points: 10080, granularity: 0:01:00, timespan: 7 days, 0:00:00 |
| | - points: 8760, granularity: 1:00:00, timespan: 365 days, 0:00:00 |
| archive_policy/name | high |
| created_by_project_id | 95f382c2218b4df8a1e471469555d91f |
| created_by_user_id | eba328002fb8406899bcbf1fd2c8a6a6 |
| id | 538ec168-a855-44ac-965b-b36d5812d1e1 |
| name | None |
| resource/id | None |
| unit | None |
+------------------------------------+-------------------------------------------------------------------+
* Create an aodh gnocchi alarm
[stack@undercloud ~]$ aodh alarm create --name galarm --type gnocchi_aggregation_by_metrics_threshold --metrics 538ec168-a855-44ac-965b-b36d5812d1e1 --threshold 100 --aggregation-method mean --comparison-operator gt
Traceback (most recent call last):
File "/usr/lib64/python2.7/logging/__init__.py", line 851, in emit
msg = self.format(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 724, in format
return fmt.format(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 464, in format
record.message = record.getMessage()
File "/usr/lib64/python2.7/logging/__init__.py", line 324, in getMessage
msg = str(self.msg)
File "/usr/lib/python2.7/site-packages/aodhclient/exceptions.py", line 32, in __str__
formatted_string = "%s (HTTP %s)" % (self.message, self.http_status)
AttributeError: 'ClientException' object has no attribute 'http_status'
Logged from file app.py, line 351
* To fix above: upgrade to python-aodhclient 0.7.0
[stack@undercloud ~]$ aodh alarm create --name galarm --type gnocchi_aggregation_by_metrics_threshold --metrics 538ec168-a855-44ac-965b-b36d5812d1e1 --threshold 100 --aggregation-method mean --comparison-operator gt
Cannot use v2 authentication with domain scope (HTTP 503) (Request-ID: req-997c9b03-117f-489d-947a-50d63d166e91)
* To fix this issue apply this fix: https://review.openstack.org/#/c/365117/
Now create show work:
[stack@undercloud ~]$ aodh alarm create --name galarm --type gnocchi_aggregation_by_metrics_threshold --metrics 538ec168-a855-44ac-965b-b36d5812d1e1 --threshold 100 --aggregation-method mean --comparison-operator gt
+---------------------------+-----------------------------------------------------+
| Field | Value |
+---------------------------+-----------------------------------------------------+
| aggregation_method | mean |
| alarm_actions | [] |
| alarm_id | 93753647-0479-409b-ab2b-2b26c8b1f682 |
| comparison_operator | gt |
| description | gnocchi_aggregation_by_metrics_threshold alarm rule |
| enabled | True |
| evaluation_periods | 1 |
| granularity | 60 |
| insufficient_data_actions | [] |
| metrics | [u'538ec168-a855-44ac-965b-b36d5812d1e1'] |
| name | galarm |
| ok_actions | [] |
| project_id | 95f382c2218b4df8a1e471469555d91f |
| repeat_actions | False |
| severity | low |
| state | insufficient data |
| state_timestamp | 2016-09-02T19:43:51.937468 |
| threshold | 100.0 |
| time_constraints | [] |
| timestamp | 2016-09-02T19:43:51.937468 |
| type | gnocchi_aggregation_by_metrics_threshold |
| user_id | eba328002fb8406899bcbf1fd2c8a6a6 |
+---------------------------+-----------------------------------------------------+
[stack@undercloud ~]$ aodh alarm list
+-------------------------+-------------------------+--------+-------------------+----------+---------+
| alarm_id | type | name | state | severity | enabled |
+-------------------------+-------------------------+--------+-------------------+----------+---------+
| 93753647-0479-409b- | gnocchi_aggregation_by_ | galarm | insufficient data | low | True |
| ab2b-2b26c8b1f682 | metrics_threshold | | | | |
+-------------------------+-------------------------+--------+-------------------+----------+---------+
[stack@undercloud ~]$ gnocchi metric list
+--------------------------------------+---------------------+------+------+-------------+
| id | archive_policy/name | name | unit | resource_id |
+--------------------------------------+---------------------+------+------+-------------+
| 538ec168-a855-44ac-965b-b36d5812d1e1 | high | None | None | None |
+--------------------------------------+---------------------+------+------+-------------+
[stack@undercloud ~]$ gnocchi measures add 538ec168-a855-44ac-965b-b36d5812d1e1 -m 2016-09-02T15:00:00@130 -m 2016-09-02T15:48:00@130 -m 2016-09-02T15:50:00@142
* Check measures
[stack@undercloud ~]$ gnocchi measures show 538ec168-a855-44ac-965b-b36d5812d1e1
+---------------------------+-------------+-------+
| timestamp | granularity | value |
+---------------------------+-------------+-------+
| 2016-09-02T15:00:00+00:00 | 3600.0 | 130.0 |
| 2016-09-02T15:00:00+00:00 | 3600.0 | 136.0 |
| 2016-09-02T15:48:00+00:00 | 60.0 | 130.0 |
| 2016-09-02T15:50:00+00:00 | 60.0 | 142.0 |
| 2016-09-02T15:48:00+00:00 | 1.0 | 130.0 |
| 2016-09-02T15:50:00+00:00 | 1.0 | 142.0 |
+---------------------------+-------------+-------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment