Skip to content

Commit

Permalink
Update Redis alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Oct 1, 2024
1 parent 253b8c2 commit 3096f03
Showing 1 changed file with 65 additions and 20 deletions.
85 changes: 65 additions & 20 deletions spire/templates/shared-redis/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Resources:
Engine: Redis
EngineVersion: 7.1
MultiAZEnabled: true
# If node groups or replica quanities change, update the memory alarms
NumNodeGroups: 1 # NodeGroups are Shards. This replication group will always use cluster mode due to the parameter group.
ReplicasPerNodeGroup: 1 # **Update requires replacement** Replicas are nodes. N replicas will result in N+1 Nodes Per Shard.
ReplicationGroupDescription: !Sub Dovetail ${EnvironmentType} Redis
Expand All @@ -82,16 +83,39 @@ Resources:
${EnvironmentType} shared Redis's database memory usage has exceeded
the recommended safe level
ComparisonOperator: GreaterThanThreshold
Dimensions:
- Name: CacheClusterId
Value: !Ref RedisReplicationGroup
- Name: CacheNodeId
Value: "0001"
EvaluationPeriods: 2
MetricName: DatabaseMemoryUsagePercentage
Namespace: AWS/ElastiCache
Period: 120
Statistic: Maximum
Metrics:
- Id: node1
MetricStat:
Metric:
Dimensions:
- Name: CacheClusterId
Value: !Sub ${RedisReplicationGroup}-0001-001
- Name: CacheNodeId
Value: "0001"
MetricName: DatabaseMemoryUsagePercentage
Namespace: AWS/ElastiCache
Period: 120
Stat: Maximum
Unit: Percent
ReturnData: false
- Id: node2
MetricStat:
Metric:
Dimensions:
- Name: CacheClusterId
Value: !Sub ${RedisReplicationGroup}-0001-002
- Name: CacheNodeId
Value: "0001"
MetricName: DatabaseMemoryUsagePercentage
Namespace: AWS/ElastiCache
Period: 120
Stat: Maximum
Unit: Percent
ReturnData: false
- Id: max
Expression: "MAX(METRICS())"
ReturnData: true
Tags:
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
Expand All @@ -102,7 +126,6 @@ Resources:
- { Key: prx:dev:application, Value: Common }
Threshold: 0.85
TreatMissingData: notBreaching
Unit: Percent

RedisMemoryVeryLowAlarm:
Type: AWS::CloudWatch::Alarm
Expand All @@ -113,16 +136,39 @@ Resources:
${EnvironmentType} shared Redis's database memory usage has reached a
critically high level
ComparisonOperator: GreaterThanThreshold
Dimensions:
- Name: CacheClusterId
Value: !Ref RedisReplicationGroup
- Name: CacheNodeId
Value: "0001"
EvaluationPeriods: 2
MetricName: DatabaseMemoryUsagePercentage
Namespace: AWS/ElastiCache
Period: 120
Statistic: Maximum
Metrics:
- Id: node1
MetricStat:
Metric:
Dimensions:
- Name: CacheClusterId
Value: !Sub ${RedisReplicationGroup}-0001-001
- Name: CacheNodeId
Value: "0001"
MetricName: DatabaseMemoryUsagePercentage
Namespace: AWS/ElastiCache
Period: 120
Stat: Maximum
Unit: Percent
ReturnData: false
- Id: node2
MetricStat:
Metric:
Dimensions:
- Name: CacheClusterId
Value: !Sub ${RedisReplicationGroup}-0001-002
- Name: CacheNodeId
Value: "0001"
MetricName: DatabaseMemoryUsagePercentage
Namespace: AWS/ElastiCache
Period: 120
Stat: Maximum
Unit: Percent
ReturnData: false
- Id: max
Expression: "MAX(METRICS())"
ReturnData: true
Tags:
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
Expand All @@ -133,7 +179,6 @@ Resources:
- { Key: prx:dev:application, Value: Common }
Threshold: 0.93
TreatMissingData: notBreaching
Unit: Percent

Outputs:
ReplicationGroupName:
Expand Down

0 comments on commit 3096f03

Please sign in to comment.