From 3bb8de94f780a6227e2484cf417ca32440f5b61b Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Wed, 27 Nov 2019 11:22:10 +1300 Subject: [PATCH] Some minor improvements for doc and log Change-Id: I7901f9a4d871a20d833049db11c39f0270ccc098 --- .gitignore | 2 ++ .../controllers/v2/alarm_rules/composite.py | 2 +- aodh/evaluator/event.py | 8 +++++-- .../functional/api/v2/test_alarm_scenarios.py | 8 ++----- doc/source/admin/telemetry-alarms.rst | 22 ++++++++++++++++--- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index fb4dcc0a7..423682f9b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ releasenotes/build /doc/source/contributor/api/ doc/source/_static/aodh.policy.yaml.sample doc/source/_static/aodh.conf.sample + +.vscode/ diff --git a/aodh/api/controllers/v2/alarm_rules/composite.py b/aodh/api/controllers/v2/alarm_rules/composite.py index 58d6cb65e..5062a899a 100644 --- a/aodh/api/controllers/v2/alarm_rules/composite.py +++ b/aodh/api/controllers/v2/alarm_rules/composite.py @@ -41,7 +41,7 @@ class CompositeRule(wtypes.UserType): threshold_plugins = None def __init__(self): - threshold_rules = ('ceilometer', + threshold_rules = ('threshold', 'gnocchi_resources_threshold', 'gnocchi_aggregation_by_metrics_threshold', 'gnocchi_aggregation_by_resources_threshold') diff --git a/aodh/evaluator/event.py b/aodh/evaluator/event.py index 0ba95f28c..2b4dd1e18 100644 --- a/aodh/evaluator/event.py +++ b/aodh/evaluator/event.py @@ -237,10 +237,14 @@ class EventAlarmEvaluator(evaluator.Evaluator): for condition in alarm.query: if not _compare(condition): - LOG.debug('Aborting evaluation of the alarm due to ' - 'unmet condition=%s .', condition) + LOG.info('Aborting evaluation of the alarm %s due to ' + 'unmet condition=%s .', alarm.id, condition) return + LOG.info('Triggering the alarm %s by event for project %s, ' + 'event_type: %s', + alarm.id, event.project, event.obj.get('event_type')) + self._fire_alarm(alarm, event) def _fire_alarm(self, alarm, event): diff --git a/aodh/tests/functional/api/v2/test_alarm_scenarios.py b/aodh/tests/functional/api/v2/test_alarm_scenarios.py index bddb238f6..0d29edd36 100644 --- a/aodh/tests/functional/api/v2/test_alarm_scenarios.py +++ b/aodh/tests/functional/api/v2/test_alarm_scenarios.py @@ -2586,13 +2586,9 @@ class TestAlarmsCompositeRule(TestAlarmsBase): expect_errors=True, headers=self.auth_headers) - err = ("Unsupported sub-rule type :non-type in composite " - "rule, should be one of: " - "['gnocchi_aggregation_by_metrics_threshold', " - "'gnocchi_aggregation_by_resources_threshold', " - "'gnocchi_resources_threshold']") + err = "Unsupported sub-rule type" faultstring = response.json['error_message']['faultstring'] - self.assertEqual(err, faultstring) + self.assertIn(err, faultstring) def test_post_with_sub_rule_with_only_required_params(self): sub_rulea = { diff --git a/doc/source/admin/telemetry-alarms.rst b/doc/source/admin/telemetry-alarms.rst index 6e23d9436..26435f72a 100644 --- a/doc/source/admin/telemetry-alarms.rst +++ b/doc/source/admin/telemetry-alarms.rst @@ -43,9 +43,13 @@ governed by: * A sliding time window to indicate how far back into the recent past you want to look. -Valid threshold alarms are: ``gnocchi_resources_threshold``, -``gnocchi_aggregation_by_metrics_threshold``, or -``gnocchi_aggregation_by_resources_threshold``. +Both Ceilometer and Gnocchi are supported as data source of the threshold rule +alarm. Valid threshold alarms are: + +* threshold +* gnocchi_resources_threshold +* gnocchi_aggregation_by_metrics_threshold +* gnocchi_aggregation_by_resources_threshold Composite rule alarms --------------------- @@ -105,6 +109,18 @@ These are a lightweight alternative to webhooks, whereby the state transition is simply logged by the ``alarm-notifier``, and are intended primarily for testing purposes. +**heat** + +This notifier works together with ``loadbalancer_member_health`` evaluator. +Presumably, the end user defines a Heat template which contains an autoscaling +group and all the members in the group are joined in an Octavia load balancer +in order to expose highly available service to the outside, so that when the +stack scales up or scales down, Heat makes sure the new members are joining the +load balancer automatically and the old members are removed. However, this +notifier deals with the situation that when some member fails, the Heat stack +could be recovered automatically. + + Workload partitioning ---------------------