ecs_composex.alarms package ¶
Submodules ¶
ecs_composex.alarms.alarms_ecs module ¶
Module to define CloudWatch alarms in x-alarms and match these to services
- ecs_composex.alarms.alarms_ecs. add_service_actions ( alarm , alarms_stack , target , scaling_in_policy , scaling_out_policy ) [source] ¶
-
Function to update the alarm properties with OKActions and AlarmActions
- Parameters :
-
-
alarm ( ecs_composex.alarms.alarms_stack.Alarm ) –
-
alarms_stack ( ecs_composex.common.stacks.ComposeXStack ) –
-
target ( tuple ) –
-
scaling_in_policy –
-
scaling_out_policy –
-
- ecs_composex.alarms.alarms_ecs. alarms_to_ecs ( resources , services_stack , res_root_stack , settings ) [source] ¶
- ecs_composex.alarms.alarms_ecs. get_alarm_actions ( alarm ) [source] ¶
-
Function to get the alarm actions
- Parameters :
-
alarm –
- Returns :
-
the okay and alarm actions
- Return type :
-
tuple
- ecs_composex.alarms.alarms_ecs. handle_alarm_topics ( alarm , alarms_stack , settings ) [source] ¶
-
Function to add the topics actions for defined topics
- Parameters :
-
-
alarm ( ecs_composex.alarms.alarms_stack.Alarm ) –
-
alarms_stack ( ecs_composex.common.stacks.ComposeXStack ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- Returns :
-
- ecs_composex.alarms.alarms_ecs. handle_compose_topics ( alarm , alarms_stack , settings , topic_def , notify_on ) [source] ¶
-
Function to handle x-alarms to x-sns topics
- Parameters :
-
-
alarm ( ecs_composex.alarms.alarms_stack.Alarm ) –
-
alarms_stack ( ecs_composex.common.stacks.ComposeXStack ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
topic_def ( dict ) –
-
notify_on ( str ) –
-
- Returns :
-
- ecs_composex.alarms.alarms_ecs. handle_notify_on ( topic_def ) [source] ¶
-
Function to validate parameter NotifyOn
- Parameters :
-
topic_def ( dict ) –
- Returns :
-
- ecs_composex.alarms.alarms_ecs. handle_service_scaling ( alarm , alarms_stack ) [source] ¶
-
Function to create the scaling steps for defined services
- Parameters :
-
-
alarm ( ecs_composex.alarms.alarms_stack.Alarm ) –
-
alarms_stack ( ecs_composex.common.stacks.ComposeXStack ) –
-
ecs_composex.alarms.alarms_elbv2 module ¶
Functions to validate the inputs from Metrics for elbv2 https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html#load-balancer-metrics-alb https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-cloudwatch-metrics.html
- ecs_composex.alarms.alarms_elbv2. get_target_lb ( parts , dimension , resource , settings ) [source] ¶
-
Identifies and returns the Elbv2 from the x-elbv2 defined
- Parameters :
-
-
parts ( re.Match ) – The re.Match from dimension.Value
-
dimension ( troposphere.cloudwatch.MetricDimension ) –
-
resource ( ecs_composex.alarms.alarms_stack.Alarm ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- Returns :
-
The ELBv2 object
- Return type :
-
ecs_composex.elbv2.elbv2_stack.Elbv2
- Raises :
-
ValueError if the name provided does not match to an x-elbv2 resource
- ecs_composex.alarms.alarms_elbv2. handle_elbv2_dimension_mapping ( alarms_stack , dimension , resource , settings ) [source] ¶
-
Replaces x-elbv2::<name> with a pointer to the LB
- Parameters :
-
-
alarms_stack ( ecs_composex.alarms.alarms_stack.XStack ) – The alarms stack which has the alarm to modify
-
dimension ( troposphere.cloudwatch.MetricDimension ) –
-
resource ( ecs_composex.alarms.alarms_stack.Alarm ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- Returns :
-
The identified LB
- ecs_composex.alarms.alarms_elbv2. handle_elbv2_target_group_dimensions ( alarms_stack , dimension , resource , settings ) [source] ¶
-
Matches up the x-elbv2::<lb>::<service>::port provided input to the new resource for alarms
- Parameters :
-
-
alarms_stack ( ecs_composex.alarms.alarms_stack.XStack ) – The alarms stack which has the alarm to modify
-
dimension ( troposphere.cloudwatch.MetricDimension ) –
-
resource ( ecs_composex.alarms.alarms_stack.Alarm ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- Returns :
-
- ecs_composex.alarms.alarms_elbv2. validate_tgt_input ( dimension , settings ) [source] ¶
-
Validates given input is conform to expect format
- Parameters :
-
-
dimension ( troposphere.cloudwatch.MetricDimension ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- Returns :
-
The parts matched from the input
- Return type :
-
re.Match
- Raises :
-
ValueError
ecs_composex.alarms.alarms_helpers module ¶
- ecs_composex.alarms.alarms_helpers. add_composite_alarms ( template , new_alarms ) [source] ¶
-
- Return type :
-
None
- ecs_composex.alarms.alarms_helpers. create_alarms ( template , stack , new_alarms , settings ) [source] ¶
-
Main function to create new alarms Rules out CompositeAlarms first, creates “Simple” alarms, and then link these to ComopsiteAlarms if so declared.
- Return type :
-
None
- ecs_composex.alarms.alarms_helpers. create_composite_alarm ( alarm , alarms ) [source] ¶
-
Function to create the composite alarms
- Return type :
-
None
- ecs_composex.alarms.alarms_helpers. create_composite_alarm_expression ( mapping , expression ) [source] ¶
-
Function to create the composite alarms
- Parameters :
-
-
mapping ( dict ) –
-
expression ( str ) –
-
alarms ( list ) –
-
- Return type :
-
troposphere.Join
- Returns :
-
ecs_composex.alarms.alarms_module module ¶
ecs_composex.alarms.alarms_params module ¶
ecs_composex.alarms.alarms_stack module ¶
Main module to create x-alarms defined at the top level.
- class ecs_composex.alarms.alarms_stack. Alarm ( name , definition , module , settings ) [source] ¶
-
Bases:
ServicesXResource
Class to represent CW Alarms
- handle_dimensions ( settings ) [source] ¶
-
Handles the dimensions settings and tries to resolve
- Return type :
-
None
- handle_x_dependencies ( settings , root_stack = None ) [source] ¶
-
Function to cross reference alarm settings with other resources
- Parameters :
-
-
root_stack ( ecs_composex.common.stacks.ComposeXStacks ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- Return type :
-
None
- topics_key = 'Topics' ¶
- class ecs_composex.alarms.alarms_stack. XStack ( name , settings , module , ** kwargs ) [source] ¶
-
Bases:
ComposeXStack
Class to represent the root stack for alarms