grofers.rds-alarms
RDSアラーム
Amazon CloudWatch上でRDSインスタンス用の警告および重大なアラームを作成します。詳細については、ブログ記事を参照してください。
:boom: Grofersで実績があります。
要件
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt19471460522000",
"Effect": "Allow",
"Action": [
"cloudwatch:DeleteAlarms",
"cloudwatch:DescribeAlarms",
"cloudwatch:PutMetricAlarm"
],
"Resource": [
"*"
]
},
{
"Sid": "Stmt1947940274000",
"Effect": "Allow",
"Action": [
"rds:DescribeDBInstances"
],
"Resource": [
"*"
]
}
]
}
インストール
インストールするには、次のコマンドを実行します。
$ ansible-galaxy install grofers.rds-alarms
ロール変数
rds_alarms_region
- AWSリージョン(必須)rds_alarms_common_action_list
- AWS SNSのトピックのARNのリストrds_alarms_period
- メトリック評価の間隔(秒)rds_alarms_evaluation_periods
- 最終計算前にメトリックが評価される回数rds_alarms_common_action_list
- 常にこのアラームアクションを含めるrds_alarms_warning_threshold
- 警告の閾値(デフォルト - 75%)rds_alarms_critical_threshold
- 重大な閾値(デフォルト - 90%)rds_alarms_warning_cpu_credits_threshold
- CPUクレジットの警告閾値(デフォルト - 30)rds_alarms_critical_cpu_credits_threshold
- CPUクレジットの重大閾値(デフォルト - 15)rds_alarms_db_instances
- 次の形式の辞書:
rds_alarms_db_instances:
<rds-instance-identifier>:
warning_db_connections_threshold: 100
critical_db_connections_threshold: 200
warning_burst_balance_threshold: 100
critical_burst_balance_threshold: 200
alarm_action_list: ["arn:aws:sns:us-east-1:9783248248:MYALARM"]
critical_threshold: 90 # オプショナル
warning_threshold: 75 # オプショナル
credit_warning_threshold: 30 # オプショナル
credit_critical_threshold: 15 # オプショナル
replica_lag_threshold: 1800 # レプリカのみ必須。単位は秒
規約
Amazon CloudWatchで作成されるアラームの名前の形式は次の通りです:
rds-<インスタンス名>-<メトリック名>-<アラートタイプ>
。
例えば、識別子がmy-rds-instance
のインスタンスのCPU
用の警告
アラームは、rds-my-rds-instance-cpu-warning
として作成されます。
サンプルプレイブック
このプレイブックは、デフォルトの閾値でmy-rds-instance-identifier
のアラームを作成します。一方、my-replica-rds-instance-identifier
のアラームは、閾値80%の警告を持ち、重大な閾値はデフォルトの値(90%)になります。インスタンスがレプリカの場合、レプリカの遅延についてもアラームが作成されます。すべてのt2インスタンスでは、残りのCPUクレジットについてもアラームが作成されます。
- hosts: localhost
connection: local
vars:
rds_alarms_common_action_list:
- "arn:aws:sns:us-east-1:9783248248:ALARMS"
rds_alarms_period: 60
rds_alarms_evaluation_periods: 2
rds_alarms_region: us-east-1
rds_alarms_warning_threshold: 70
rds_alarms_critical_threshold: 90
rds_alarms_warning_cpu_credits_threshold: 60
rds_alarms_critical_cpu_credits_threshold: 30
rds_alarms_db_instances:
my-rds-instance-identifier: # これにはデフォルト値が使用されます
warning_db_connections_threshold: 100
critical_db_connections_threshold: 200
alarm_action_list: ["arn:aws:sns:us-east-1:9783248248:MYALARM"]
my-replica-rds-instance-identifier:
warning_threshold: 80
warning_db_connections_threshold: 100
critical_db_connections_threshold: 200
alarm_action_list: ["arn:aws:sns:us-east-1:9783248248:MYALARM"]
credit_warning_threshold: 20
credit_critical_threshold: 10
replica_lag_threshold: 1800
roles:
- rds-alarms
制限事項
異なるリージョンのために複数のプレイブックを作成する必要があります。