|
|
@ -167,7 +167,8 @@ def create_metric_alarm(connection, module):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
connection.create_alarm(alm)
|
|
|
|
connection.create_alarm(alm)
|
|
|
|
module.exit_json(changed=True)
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
alarms = connection.describe_alarms(alarm_names=[name])
|
|
|
|
except BotoServerError, e:
|
|
|
|
except BotoServerError, e:
|
|
|
|
module.fail_json(msg=str(e))
|
|
|
|
module.fail_json(msg=str(e))
|
|
|
|
|
|
|
|
|
|
|
@ -203,10 +204,28 @@ def create_metric_alarm(connection, module):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if changed:
|
|
|
|
if changed:
|
|
|
|
connection.create_alarm(alarm)
|
|
|
|
connection.create_alarm(alarm)
|
|
|
|
module.exit_json(changed=changed)
|
|
|
|
|
|
|
|
except BotoServerError, e:
|
|
|
|
except BotoServerError, e:
|
|
|
|
module.fail_json(msg=str(e))
|
|
|
|
module.fail_json(msg=str(e))
|
|
|
|
|
|
|
|
result = alarms[0]
|
|
|
|
|
|
|
|
module.exit_json(changed=changed, name=result.name,
|
|
|
|
|
|
|
|
actions_enabled=result.actions_enabled,
|
|
|
|
|
|
|
|
alarm_actions=result.alarm_actions,
|
|
|
|
|
|
|
|
alarm_arn=result.alarm_arn,
|
|
|
|
|
|
|
|
comparison=result.comparison,
|
|
|
|
|
|
|
|
description=result.description,
|
|
|
|
|
|
|
|
dimensions=result.dimensions,
|
|
|
|
|
|
|
|
evaluation_periods=result.evaluation_periods,
|
|
|
|
|
|
|
|
insufficient_data_actions=result.insufficient_data_actions,
|
|
|
|
|
|
|
|
last_updated=result.last_updated,
|
|
|
|
|
|
|
|
metric=result.metric,
|
|
|
|
|
|
|
|
namespace=result.namespace,
|
|
|
|
|
|
|
|
ok_actions=result.ok_actions,
|
|
|
|
|
|
|
|
period=result.period,
|
|
|
|
|
|
|
|
state_reason=result.state_reason,
|
|
|
|
|
|
|
|
state_value=result.state_value,
|
|
|
|
|
|
|
|
statistic=result.statistic,
|
|
|
|
|
|
|
|
threshold=result.threshold,
|
|
|
|
|
|
|
|
unit=result.unit)
|
|
|
|
|
|
|
|
|
|
|
|
def delete_metric_alarm(connection, module):
|
|
|
|
def delete_metric_alarm(connection, module):
|
|
|
|
name = module.params.get('name')
|
|
|
|
name = module.params.get('name')
|
|
|
|