in syndicate/connection/cloud_watch_connection.py [0:0]
def put_metric_alarm(self, alarm_name, metric_name, namespace, period,
evaluation_periods, threshold, comparison_operator,
statistic, actions_enabled=None, ok_actions=None,
alarm_actions=None, insufficient_data_actions=None,
extended_statistic=None, dimensions=None, unit=None,
description=None, datapoints=None,
evaluate_low_sample_count_percentile=None, tags=None):
"""
:type alarm_name: str
:type metric_name: str
:type namespace: str
:type period: int
:type evaluation_periods: int
:type threshold: float
:type comparison_operator: str
:param comparison_operator: 'GreaterThanOrEqualToThreshold'|
'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold'
:type actions_enabled: bool
:type ok_actions: list of strings
:type alarm_actions: list of strings
:type insufficient_data_actions: list of strings
:type statistic: str
:param statistic: 'SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum'
:type extended_statistic: str
:type dimensions: list of dicts
:param dimensions: [{ 'Name': 'string', 'Value': 'string' },]
:type unit: str
:param unit: 'Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|
'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|
'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|
'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|
'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|
'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None'
:type description: str
:param description: the description for the alarm
:type datapoints: int
:param datapoints: number of datapoints that must be breaching to
trigger the alarm
:type evaluate_low_sample_count_percentile: str
:param evaluate_low_sample_count_percentile: 'evaluate'|'ignore'
:type tags: list of dicts: List of resource tags key-value pairs
"""
params = dict(AlarmName=alarm_name, MetricName=metric_name,
Namespace=namespace, Period=period, Threshold=threshold,
EvaluationPeriods=evaluation_periods,
ComparisonOperator=comparison_operator,
Statistic=statistic)
if actions_enabled:
params['ActionsEnabled'] = actions_enabled
if ok_actions:
params['OKActions'] = ok_actions
if alarm_actions:
params['AlarmActions'] = alarm_actions
if insufficient_data_actions:
params['InsufficientDataActions'] = insufficient_data_actions
if extended_statistic:
params['ExtendedStatistic'] = extended_statistic
if unit:
params['Unit'] = unit
if dimensions:
params['Dimensions'] = dimensions
if description:
params['AlarmDescription'] = description
if evaluate_low_sample_count_percentile:
params['EvaluateLowSampleCountPercentile'] = \
evaluate_low_sample_count_percentile
if datapoints:
params['DatapointsToAlarm'] = datapoints
if tags:
params['Tags'] = tags
self.client.put_metric_alarm(**params)