From: Helena McGough Date: Mon, 18 Sep 2017 10:31:05 +0000 (+0100) Subject: Updated the Aodh plugin X-Git-Tag: v4.0.0~85^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=0e7809a12eba0c466923ff4783b8fbc3b932eb0d;hp=-c;p=osm%2FMON.git Updated the Aodh plugin - Normalised alarm statistic definition Signed-off-by: Helena McGough --- 0e7809a12eba0c466923ff4783b8fbc3b932eb0d diff --git a/plugins/OpenStack/Aodh/alarming.py b/plugins/OpenStack/Aodh/alarming.py index f530a35..b5e4a3e 100644 --- a/plugins/OpenStack/Aodh/alarming.py +++ b/plugins/OpenStack/Aodh/alarming.py @@ -53,6 +53,13 @@ SEVERITIES = { "CRITICAL": "critical", "INDETERMINATE": "critical"} +STATISTICS = { + "AVERAGE": "avg", + "MINIMUM": "min", + "MAXIMUM": "max", + "COUNT": "count", + "SUM": "sum"} + class Alarming(object): """Carries out alarming requests and responses via Aodh API.""" @@ -333,6 +340,7 @@ class Alarming(object): if alarm_state is None: alarm_state = "ok" + statistic = values['statistic'] # Try to configure the payload for the update/create request # Can only update: threshold, operation, statistic and # the severity of the alarm @@ -341,7 +349,7 @@ class Alarming(object): 'metric': metric_name, 'resource_id': resource_id, 'resource_type': 'generic', - 'aggregation_method': values['statistic'].lower()} + 'aggregation_method': STATISTICS[statistic]} payload = json.dumps({'state': alarm_state, 'name': alarm_name, 'severity': SEVERITIES[severity],